Page 1 of 2

Turn timeout

Posted: Sat Mar 30, 2019 4:56 pm
by o01eg
I'm going to implement turn timeout. There some thoughts about implementation. Mostly I got ideas from freeciv https://freeciv.fandom.com/wiki/Server_options especially its longturn fork.

There will be three parameters. I didn't decide how they will be implemented but I think they should be allowed to change dynamically in the game.
  • First turn advance - it is a analogue of first_timeout freeciv option but instead of relative time offset it uses absolute time point to be more predictable. It determines time point when there will be first turn advance after the server went to PlayingGame state from new or loaded game. If it isn't set then next turn advance will happened after turn interval time.
  • Turn interval - it is a analogue of timeout freeciv option. It's a maximum interval between turn advances. It it isn't set then next turn advance will happened when all players will be ready.
  • Fixed turn interval - it is a analogue of fixedlength freeciv option. If it's enabled then turn advance will happened only when turn interval would be expired. It it disabled then turn advance could happened earlier if all players will be ready.
Then on each turn update or game start messages the server sends time left before turn advance. Also to get time more correctly the clients pings the server and the server returns new time left before turn advance.

Re: Turn timeout

Posted: Sun Apr 14, 2019 7:58 pm
by o01eg
I need some UI help of how to manage those option in the playing game.

Re: Turn timeout

Posted: Mon Apr 15, 2019 11:52 am
by The Silent One
You'll probably need a checkbox labelled "(Use) turn timeout" that, if checked, enables:
- another checkbox labelled "Fixed turn interval" (checked: don't care if players finished their turn)
- an editbox for the interval of the first turn
- an editbox for the turn interval (doesn't matter if it's fixed or not)
(and labels that go along with them)

Is that what you meant?

Re: Turn timeout

Posted: Mon Apr 15, 2019 11:57 am
by o01eg
As I known currently it is impossible to update options or game rules in the playing game. Should it be part of common editor? Or it's better to have a separate UI?

Re: Turn timeout

Posted: Tue Apr 16, 2019 8:05 am
by o01eg
I've got thought to refactor game rules and make them editable. Then it will be possible implement timeout parameters as editable in the playing game rules.

Re: Turn timeout

Posted: Wed Apr 17, 2019 7:40 am
by Geoff the Medio
Timeout seems like a server setting, not a game rule. Rules are more about how the game mechanics work. Cycling turns is something players or the server do occasionally...

Re: Turn timeout

Posted: Wed Apr 17, 2019 8:07 am
by o01eg
Geoff the Medio wrote:
Wed Apr 17, 2019 7:40 am
Timeout seems like a server setting, not a game rule. Rules are more about how the game mechanics work. Cycling turns is something players or the server do occasionally...
I want to have those parameters allowed to be changed by players in the playing game like it done in FreeCiv.

Re: Turn timeout

Posted: Sun Apr 21, 2019 8:04 am
by Geoff the Medio
o01eg wrote:
Wed Apr 17, 2019 8:07 am
I want to have those parameters allowed to be changed by players in the playing game like it done in FreeCiv.
Still sounds like an option, not a rule. Clients, perhaps just the host, can alter options.

Re: Turn timeout

Posted: Sun Apr 21, 2019 1:02 pm
by o01eg
Geoff the Medio wrote:
Sun Apr 21, 2019 8:04 am
o01eg wrote:
Wed Apr 17, 2019 8:07 am
I want to have those parameters allowed to be changed by players in the playing game like it done in FreeCiv.
Still sounds like an option, not a rule. Clients, perhaps just the host, can alter options.
I prefer to re-use already existing UI for editing rules. Also I consider options to be more static (per instance) than rules (per game).

Re: Turn timeout

Posted: Mon Apr 22, 2019 10:15 am
by Geoff the Medio
o01eg wrote:
Sun Apr 21, 2019 1:02 pm
Geoff the Medio wrote:
Sun Apr 21, 2019 8:04 am
o01eg wrote:
Wed Apr 17, 2019 8:07 am
I want to have those parameters allowed to be changed by players in the playing game like it done in FreeCiv.
Still sounds like an option, not a rule. Clients, perhaps just the host, can alter options.
I prefer to re-use already existing UI for editing rules.
The meaning of this is unclear... Do you mean you want to use the rule-editing interface to modify this setting, or you want to use the UI for rules to continue editing rules independent of what happens with this setting?
Also I consider options to be more static (per instance) than rules (per game).
What is an "instance" and what is a "game"? To me, it sounds like the turn timer should be an option, because that can be changed (dynamic), unlike a rule that can't be changed (static) after the initial game setup.

Re: Turn timeout

Posted: Mon Apr 22, 2019 10:39 am
by o01eg
Geoff the Medio wrote:
Mon Apr 22, 2019 10:15 am
o01eg wrote:
Sun Apr 21, 2019 1:02 pm
Geoff the Medio wrote:
Sun Apr 21, 2019 8:04 am
Still sounds like an option, not a rule. Clients, perhaps just the host, can alter options.
I prefer to re-use already existing UI for editing rules.
The meaning of this is unclear... Do you mean you want to use the rule-editing interface to modify this setting, or you want to use the UI for rules to continue editing rules independent of what happens with this setting?
First, I want to use the UI for rules to modify this and other settings.
Geoff the Medio wrote:
Mon Apr 22, 2019 10:15 am
o01eg wrote:
Sun Apr 21, 2019 1:02 pm
Also I consider options to be more static (per instance) than rules (per game).
What is an "instance" and what is a "game"? To me, it sounds like the turn timer should be an option, because that can be changed (dynamic), unlike a rule that can't be changed (static) after the initial game setup.
I mean instance is a server process itself and game is a game session between game initialization or loading and finishing game. For each option settings we should have dedicated messages but for the game rules it could be more generic as I proposed in https://freeorion.org/forum/viewtopic.php?f=9&t=11251

Re: Turn timeout

Posted: Mon Apr 22, 2019 10:46 am
by Geoff the Medio
o01eg wrote:
Mon Apr 22, 2019 10:39 am
I mean instance is a server process itself and game is a game session between game initialization or loading and finishing game.
Not sure I entirely understand, but it still sounds like the turn timer period should be an option, not a rule. The server's current turn timer server option could be adjusted by players / the host whenever they want, subject to relevant permissions / roles, with the current implementation. There's no need for python or FOCS to access the option setting for turn time as with many existing rules.

Re: Turn timeout

Posted: Tue Apr 23, 2019 2:49 pm
by Ophiuchus
Geoff the Medio wrote:
Mon Apr 22, 2019 10:46 am
o01eg wrote:
Mon Apr 22, 2019 10:39 am
I mean instance is a server process itself and game is a game session between game initialization or loading and finishing game.
Not sure I entirely understand, but it still sounds like the turn timer period should be an option, not a rule. The server's current turn timer server option could be adjusted by players / the host whenever they want, subject to relevant permissions / roles, with the current implementation. There's no need for python or FOCS to access the option setting for turn time as with many existing rules.
Maybe I am asking the obvious - but what is the difference between an option and a rule? Option is command line option? The access to rules in focs/python?

Re: Turn timeout

Posted: Wed Apr 24, 2019 7:33 am
by Geoff the Medio
Ophiuchus wrote:
Tue Apr 23, 2019 2:49 pm
Maybe I am asking the obvious - but what is the difference between an option and a rule? Option is command line option? The access to rules in focs/python?
Options mainly determine how the program runs (eg. window/screen resolution, GUI colours, sounds, stringtable, whether to render starfields, default galaxy setup settings), while rules determine how a particular game being played function (enabling content, adjusting balance). Options are stored independent of a particular game, eg. you could start a new game without changing the FPS limit option in the GUI, while rules are set when starting a new game and are stored in the save file for a particular game, and loading a different game save would continue that game game with its rules, not the rules of the previously started game. Rules are accessible to FOCS scripts, which options are not, and rules are accessible in Python scripts. Options are accessible in Python scripts but not in FOCS. Options can be set from the command line, while rules cannot, at least directly; some options relate to what default rules to set when starting a game, but in that case there are both option and a rule with similar names.

Re: Turn timeout

Posted: Sun May 05, 2019 8:41 pm
by o01eg