FAForever / server

The servercode for the Forged Alliance Forever lobby
http://www.faforever.com
GNU General Public License v3.0
67 stars 62 forks source link

Issue/#995 Improve player state tracking #997

Closed Askaholic closed 7 months ago

Askaholic commented 7 months ago

The state tracking was pretty messed up by the fact that the HOSTING and JOINING states don't get set until the game sends back GPGNet messages, so clients could do a game_host and then before their game was opened they could join a matchmaker queue. Once their game opened their player state would be set to HOSTING and any matches that they got would be stuck in the queue until they manually stopped searching because the matchmaker would refuse to launch matches when one of the players had a state other than SEARCHING_LADDER. Even if they closed their game instance, the player state would then be set to IDLE which still would not allow matches to launch.

This also makes an adjustment to how players are considered to be in a game. Now, if players disconnect from the lobby server without sending a GameState: Idle command they will still be considered part of the lobby. This is closer to how the behavior used to be except when someone does leave the game through the 'happy path' by closing their game, they should be completely removed from the internal state and consequently only be re-added when the host sends a new PlayerOption for them. This hopefully will reduce some of the issues that people have reported with there being more people in the lobby when they connect than it says in the client view.

Related to #995 We won't mark it as closing since we should deploy these changes first and watch the logs to see if the issue has actually been solved. There may be other ways still in which the state tracking can go awry.