Kromster80 / kam_remake

"KaM Remake" is an RTS game remake written in Delphi from scratch.
http://www.kamremake.com
GNU Affero General Public License v3.0
356 stars 90 forks source link

New ability to reconnect to the MP game from multiplayer page (server list) #188

Open reyandme opened 7 years ago

reyandme commented 7 years ago

This feature is common to many games and it will very nice to have it in KaM Remake too.

How should it work:

MP game in Game stage. Player disconnects due to some network/pc problems (not intentionally quits).

Now if this happens, then Back to lobby is the only chance for this player to come back again, or if other players will want to wait for him in the game (and his game did not crash). So his desire of reconnecting is up to host of the game (will he drop him or not) or other players (for back to lobby option).

How it should probably be:

  1. After fixing his problems he will be able to reconnect to the game without going back to lobby and without game pausing.

  2. In servers list his game is highlighted and always on 1st position in list.

  3. Player choose it and try to reconnect.

  4. Host should identify the player. For that purpose when game initially starts all the players get their UIDs, store them in ini file and use when reconnecting. Also do not allow players to change names, it will confuse other players. So identification should be done by pair of nikname and UID.

  5. If identification was successful then game is paused, host make game save, player downloads it and reconnects to the game. If identification was not successful, then error posted to player on multiplayer page.

While downloading Host can drop player (in case of very bad player network connection).

Also there should be an ability to block abusers - who could all the time disconnecting via disabling network connection, then enabling it and trying to reconnect. May be Allies panel could have some icon near disconnected player name.

Alternatively in par.5. we can show dialog window to the host, so he decides allow player to reconnect or not. Then abusers will not able to abuse anymore.

Please share your thoughts about this feature.

lewinjh commented 7 years ago

I agree this would be a useful feature. "Return to lobby" was meant to solve this problem but I don't think it did, as you said the disconnected player has no way to ask the other player's to let them rejoin.

I think it would be best if the host is shown a message "Lewin asked to rejoin the game" so they can accept or ignore it.

The easiest way to implement it (least complex changes required) would be something like this:

  1. Rejoining player sends request to host with ID/Nickname
  2. If the ID/nickname match the host's records, the host user is given the option to allow player to rejoin, which returns the game to the lobby instantly (no vote)
  3. The rejoining player will automatically join the lobby, then once everyone has downloaded the save then host can click start (or start could be clicked automatically once the save is transferred to everyone). Everyone should be set to ready automatically.

Going via the lobby like this would be less complex than trying to do it in-game.

Also, matching via the player's ID on the server could be problematic. This ID changes every time a player reconnects (so maybe in some situations e.g. failed reconnect the player and host could have a different ID stored). A better solution might be to have a secret key for that room (like a password) similar to way the host agrees on a random seed to start the game.

reyandme commented 7 years ago

I also like the idea of message for host, so he could manage this situation in any way.

What about ID - I did not mean client ID on server, I mean another new ID for every player (and spectator) in the game. These IDs are generated on game start, then sent to all players and when player reconnects, he use this ID. So its basically same idea as your secret key. Secret key is easier, and I do not see why we need ID for every player and can't use one for all of them.

Heh, I've found couple of ways: 1) 2 players are disconnected, then swap their names (for instance they want to continue to on swapped positions, do not know why, but anyway) then they could reconnect to game tricking the host who is who. 2) Because it will be good if player could reconnect even if he PC crashes, then we must save this ID in ini (the easiest way). Then one can send this ID (or 'secret key') from ini to other player, who could reconnect instead of disconneted one with known name.

In both cases this is not a big deal, but anyway players could try to slightly cheat about who is who. Ofc they could do it easily now in any game or when 'back to lobby' - we have no actual registration, just nicknames. Both options most likely will never happen, but anyway.

Adding secret key for every player seems to be fixing this small 'issues' and just a bit 'harder' to implement.

The rejoining player will automatically join the lobby, then once everyone has downloaded the save then host can click start (or start could be clicked automatically once the save is transferred to everyone). Everyone should be set to ready automatically.

At first I agreed with you, that we can start with easier way to implement this new feature, then may be upgrade to a better one (in-game rejoining). But then I start thinking about what you said in par.3 and do we need to do all the staff manually (let ppl set to rdy, download map, may be quit, maybe rejoin again etc etc) or automatically (then better disable all controls, except exit room, then do we need to allow ppl from outside join the room, if no, then if person left room why he cant rejoin again etc etc). Finally in this case it looks like that we can only let rejoining person auto join the lobby and download the map. Then it should be normal 'back to lobby'.

So I realised, that may be we can simulate all back to lobby procedures without any graphic changes for players (go back to lobby without actual opening lobby page). And allow to join only 1 person (disconnected one, so even if game will be in lobby state for a while nobody else could enter it). This will be easier then implementing real in-game rejoining and at the same time will looks like it