server icon indicating copy to clipboard operation
server copied to clipboard

Newly foed/friended players don't receive necessary game_info messages

Open Askaholic opened this issue 1 year ago • 1 comments

Scenario 1 - Adding a foe

Imagine you are hosting a game, a player joins the lobby who is just trolling and you don't want them in the game so you kick them. But they keep joining back into the lobby, so you add them as a foe to keep them out of the lobby. The server will now consider the game to be 'invisible' to that player and will prevent them from joining. But because the game is 'invisible' to them, they will stop receiving updates about the game including the updates that say the game has launched or ended and should be removed from the games view. The lobby will stick around on their client until they re-log.

Scenario 2 - Adding a friend

Similarly, imagine you hosted a game for 'friends only'. Now you want to let someone join who wasn't on your friends list yet, so you add them as a friend. The server now considers the game to be visible to them, however it will not actually send them the game_info message needed to display the game in their client until an update is naturally triggered via another player joining/leaving or the game settings being changed.

Log messages

This can cause the following log message to appear:

Client error: You cannot join games hosted by this player.

Reproduce

Scenario 1

  1. Player 1 host a game
  2. Player 1 add player 2 as a foe

Scenario 2

  1. Player 1 host a game with visibility set to 'friends'
  2. Player 1 add player 2 as a friend

Solution

The social_add command should check if the current player is hosting a game, and if so immediately send a game_info message to the added player as follows:

If the player was foed and the game was previously visible to the player:

  • Send a 'fake' game_info message with "state": "closed" to the foed player immediately. Otherwise, if the player was friended and the game was previously not visible to the player:
  • Send a game_info message to the friended player immediately.

Askaholic avatar Jan 10 '24 05:01 Askaholic