LuaGameScript or LuaBootstrap is_headless_server [boolean]

Things that we aren't going to implement
Post Reply
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5026
Joined: Tue Jul 12, 2016 9:03 am
Contact:

LuaGameScript or LuaBootstrap is_headless_server [boolean]

Post by eradicator »

What?

A method to know if the game is hosted on a dedicated server.

Why?

I'm currently working with LuaPlayer.request_translation(). To not cause network congestion I have to limit the amount of requests I send each tick. If I could know that a game is not hosted on a dedicated server then I could send all requests at once if the hosting player is the only player. (Presuming that no network traffic is generated if there's no other players to send it to.) This would allow me to finish translation much faster and before any other players join.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 1505
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: LuaGameScript or LuaBootstrap is_headless_server [boolean]

Post by boskid »

Unfortunately no.

This is not part of the game state so it cannot be exposed (as a simple change). When considering a game with replay, it could contain parts when the game was hosted on headless server and could contain parts where it was run in single player and in that case it will be a single long recording with lua being loaded only once. This value would have to change at points when game was saved and rehosted so it would require some extra input actions sent only for those changes to be recorded. Value which is part of the game state and is as close to what is requested here is `isLoadedInMultiplayer` which is changed by SingleplayerInit and MultiplayerInit InputActions but this value is already exposed by LuaGameScript::is_multiplayer

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5026
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: LuaGameScript or LuaBootstrap is_headless_server [boolean]

Post by eradicator »

boskid wrote:
Wed Jun 16, 2021 1:22 pm
LuaGameScript::is_multiplayer
I'm already using that for singleplayer optimization, I was just hoping to also optimize the case of a player directly hosting their singleplayer savegame as a non-headless server. Not terribly important but worth a shot I thought.
boskid wrote:
Wed Jun 16, 2021 1:22 pm
When considering a game with replay
Hm, never really thought about replay. Makes me wonder if I'm not breaking that somewhere already. Something new to consider every day.

Thanks for looking into it. And for the usual nice explanation.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

Post Reply

Return to “Won't implement”