Turn timeout

Programmers discuss here anything related to FreeOrion programming. Primarily for the developers to discuss.

Moderator: Committer

Message
Author
o01eg
Programmer
Posts: 1998
Joined: Sat Dec 10, 2011 5:46 am

Turn timeout

#1 Post 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.
Gentoo Linux x64, gcc-11.2, boost-1.78.0
Ubuntu Server 22.04 x64, gcc-12, boost-1.74.0
Welcome to the slow multiplayer game at freeorion-lt.dedyn.io.Version 2024-01-30.0dd6806.
Donations're welcome:BTC:bc1q007qldm6eppqcukewtfkfcj0naut9njj7audnm

o01eg
Programmer
Posts: 1998
Joined: Sat Dec 10, 2011 5:46 am

Re: Turn timeout

#2 Post by o01eg »

I need some UI help of how to manage those option in the playing game.
Gentoo Linux x64, gcc-11.2, boost-1.78.0
Ubuntu Server 22.04 x64, gcc-12, boost-1.74.0
Welcome to the slow multiplayer game at freeorion-lt.dedyn.io.Version 2024-01-30.0dd6806.
Donations're welcome:BTC:bc1q007qldm6eppqcukewtfkfcj0naut9njj7audnm

User avatar
The Silent One
Graphics
Posts: 1129
Joined: Tue Jul 01, 2003 8:27 pm

Re: Turn timeout

#3 Post 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?
If I provided any images, code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0.

o01eg
Programmer
Posts: 1998
Joined: Sat Dec 10, 2011 5:46 am

Re: Turn timeout

#4 Post 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?
Gentoo Linux x64, gcc-11.2, boost-1.78.0
Ubuntu Server 22.04 x64, gcc-12, boost-1.74.0
Welcome to the slow multiplayer game at freeorion-lt.dedyn.io.Version 2024-01-30.0dd6806.
Donations're welcome:BTC:bc1q007qldm6eppqcukewtfkfcj0naut9njj7audnm

o01eg
Programmer
Posts: 1998
Joined: Sat Dec 10, 2011 5:46 am

Re: Turn timeout

#5 Post 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.
Gentoo Linux x64, gcc-11.2, boost-1.78.0
Ubuntu Server 22.04 x64, gcc-12, boost-1.74.0
Welcome to the slow multiplayer game at freeorion-lt.dedyn.io.Version 2024-01-30.0dd6806.
Donations're welcome:BTC:bc1q007qldm6eppqcukewtfkfcj0naut9njj7audnm

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13586
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Turn timeout

#6 Post 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...

o01eg
Programmer
Posts: 1998
Joined: Sat Dec 10, 2011 5:46 am

Re: Turn timeout

#7 Post 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.
Gentoo Linux x64, gcc-11.2, boost-1.78.0
Ubuntu Server 22.04 x64, gcc-12, boost-1.74.0
Welcome to the slow multiplayer game at freeorion-lt.dedyn.io.Version 2024-01-30.0dd6806.
Donations're welcome:BTC:bc1q007qldm6eppqcukewtfkfcj0naut9njj7audnm

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13586
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Turn timeout

#8 Post by Geoff the Medio »

o01eg wrote: Wed Apr 17, 2019 8:07 amI 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.

o01eg
Programmer
Posts: 1998
Joined: Sat Dec 10, 2011 5:46 am

Re: Turn timeout

#9 Post by o01eg »

Geoff the Medio wrote: Sun Apr 21, 2019 8:04 am
o01eg wrote: Wed Apr 17, 2019 8:07 amI 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).
Gentoo Linux x64, gcc-11.2, boost-1.78.0
Ubuntu Server 22.04 x64, gcc-12, boost-1.74.0
Welcome to the slow multiplayer game at freeorion-lt.dedyn.io.Version 2024-01-30.0dd6806.
Donations're welcome:BTC:bc1q007qldm6eppqcukewtfkfcj0naut9njj7audnm

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13586
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Turn timeout

#10 Post 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 amI 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.

o01eg
Programmer
Posts: 1998
Joined: Sat Dec 10, 2011 5:46 am

Re: Turn timeout

#11 Post 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 pmAlso 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
Gentoo Linux x64, gcc-11.2, boost-1.78.0
Ubuntu Server 22.04 x64, gcc-12, boost-1.74.0
Welcome to the slow multiplayer game at freeorion-lt.dedyn.io.Version 2024-01-30.0dd6806.
Donations're welcome:BTC:bc1q007qldm6eppqcukewtfkfcj0naut9njj7audnm

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13586
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Turn timeout

#12 Post by Geoff the Medio »

o01eg wrote: Mon Apr 22, 2019 10:39 amI 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.

Ophiuchus
Programmer
Posts: 3427
Joined: Tue Sep 30, 2014 10:01 am
Location: Wall IV

Re: Turn timeout

#13 Post by Ophiuchus »

Geoff the Medio wrote: Mon Apr 22, 2019 10:46 am
o01eg wrote: Mon Apr 22, 2019 10:39 amI 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?
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

Look, ma... four combat bouts!

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13586
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Turn timeout

#14 Post by Geoff the Medio »

Ophiuchus wrote: Tue Apr 23, 2019 2:49 pmMaybe 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.

o01eg
Programmer
Posts: 1998
Joined: Sat Dec 10, 2011 5:46 am

Re: Turn timeout

#15 Post by o01eg »

Gentoo Linux x64, gcc-11.2, boost-1.78.0
Ubuntu Server 22.04 x64, gcc-12, boost-1.74.0
Welcome to the slow multiplayer game at freeorion-lt.dedyn.io.Version 2024-01-30.0dd6806.
Donations're welcome:BTC:bc1q007qldm6eppqcukewtfkfcj0naut9njj7audnm

Post Reply