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.
LuaGameScript or LuaBootstrap is_headless_server [boolean]
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
LuaGameScript or LuaBootstrap is_headless_server [boolean]
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.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: LuaGameScript or LuaBootstrap is_headless_server [boolean]
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
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
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: LuaGameScript or LuaBootstrap is_headless_server [boolean]
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.
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.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.