Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial turn timeout implementation #2441

Merged
merged 11 commits into from
May 10, 2019

Conversation

o01eg
Copy link
Contributor

@o01eg o01eg commented May 5, 2019

This PR add three options to manage turn timeout:

  • network.server.turn-timeout.first-turn-time - absolute time in format "2002-01-20 23:59:59" when first turn advance occured. Requires fixed-interval to be enabled
  • network.server.turn-timeout.max-interval - maximum interval in seconds between two subsequent turn advances
  • network.server.turn-timeout.fixed-interval - if enabled intervals should be strictly equals to have predicted turn advance time. Without it turn interval could be shorter if all players are ready or longer if turn processing time exceeds timeout.

Each new turn or for each new player connection it sends TURN_TIMEOUT message with seconds remaining before turn advance or 0, if disabled.

New UI control shows remain time and update it each second: fo-timeout

This PR doesn't allow to edit option.

Forum thread: https://freeorion.org/forum/viewtopic.php?f=9&t=11234

@geoffthemedio
Copy link
Member

Clarify what the third fixed-interval does?

@geoffthemedio geoffthemedio added category:feature The Issue/PR describes or implements a new game feature. component:internal The Issue/PR deals with any project component that has no explicit `component` label. labels May 6, 2019
@geoffthemedio geoffthemedio added this to the Next Release milestone May 6, 2019
@o01eg
Copy link
Contributor Author

o01eg commented May 6, 2019

@geoffthemedio Added more detailed options description.

fixed-interval works as lt_cmd_syncturn command in longturn freeciv patches (http://forum.longturn.net/viewtopic.php?id=419) and fixedlength server option (https://freeciv.fandom.com/wiki/Server_options)

@geoffthemedio
Copy link
Member

geoffthemedio commented May 6, 2019

Perhaps rename to turn maximum interval, and turn fixed interval?

@o01eg
Copy link
Contributor Author

o01eg commented May 6, 2019

@geoffthemedio Renamed. I suppose those options already have a turn in their names.

@o01eg o01eg changed the title Initial turn timeout implementation [WIP] Initial turn timeout implementation May 7, 2019
@o01eg o01eg changed the title [WIP] Initial turn timeout implementation Initial turn timeout implementation May 7, 2019
@o01eg
Copy link
Contributor Author

o01eg commented May 7, 2019

Added TURN_TIMEOUT message with remaining time before turn advance.

@o01eg
Copy link
Contributor Author

o01eg commented May 7, 2019

I moved here code to show remaining time in UI.

@@ -1402,6 +1402,15 @@ Count of minutes after the cookie record will be considered expired.
OPTIONS_DB_PUBLISH_STATISTICS
Enable sending empire staticstics to the player.

OPTIONS_DB_FIRST_TURN_TIME
Absolute time point in format "2019-01-20 11:59:59" in UTC. If empty, first turn advance will happen after expiring interval. Requires fixed interval to be enabled.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does a fixed time for ending the first turn require fixed turn time intervals to be enabled...?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If fixed interval disabled, WaitingForTurnEnd clears all timers set before. I couldn't quickly find solution to fix it.

server/ServerApp.h Outdated Show resolved Hide resolved
@geoffthemedio geoffthemedio merged commit 0d6b28b into freeorion:master May 10, 2019
@geoffthemedio geoffthemedio added the status:merged All relevant commits of this PR were merged into the master development branch. label May 10, 2019
@o01eg o01eg deleted the turn-timeout-init branch May 10, 2019 17:58
@geoffthemedio
Copy link
Member

When quickstarting a single player game, I get this in the logs:
08:29:08.149582 [error] FSM : HumanClientFSM.cpp:116 : A TurnTimeout event was not handled by any of these states : [struct WaitingForTurnData]. It is being ignored.

@o01eg
Copy link
Contributor Author

o01eg commented May 21, 2019

@geoffthemedio Oh, I suppose I should handle TurnTimeout in a base PlayingGame. I'll open PR to fix that.

@o01eg
Copy link
Contributor Author

o01eg commented May 21, 2019

Fixed in #2453

@Vezzra Vezzra modified the milestones: Next Release, v0.4.9 Sep 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:feature The Issue/PR describes or implements a new game feature. component:internal The Issue/PR deals with any project component that has no explicit `component` label. status:merged All relevant commits of this PR were merged into the master development branch.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants