Opened 8 years ago

Last modified 7 years ago

#3963 new enhancement

Rejoined clients should be able to download the full replay from the host

Reported by: elexis Owned by:
Priority: Should Have Milestone: Backlog
Component: Network Keywords: beta
Cc: Patch:

Description

If someone rejoins a game, the replay will end with the disconnect and a new one will be written starting after the connect, containing only turns after that time.

Thus rejoining means the replay will become unreplayable, which is unfortunate as many ggs become lost unless the host is doing extra work to find the replay, upload it somewhere and every client wanting the replay having to download it and sort it.

The rejoining client should have a chance to download the full replay in a running game. (The new turns will have to be appended to the downloaded replay).

It would be more comfortable to automatically download the full replay on rejoin, but might not be feasible as the server often already has a lot of data to transmit on rejoin. The download could become optional (download after pressing a button) and could be delayed until every pending rejoin was completed. It could be zipped to reduce the traffic significantly. The client could also be smart and only download the subset of turns that it missed, but that would increase the complexity significantly.

The partial replay is useful for debugging OOS on rejoin errors. The commands.txt could be renamed commands_rejoined.txt for clarity (or it could be removed and only save the turnnumber when the rejoin started).

Furthermore considering #3556, every client might rejoin. Thus the server might want to keep a full replay itself.

Change History (6)

comment:1 by Imarok, 8 years ago

I just write this comment to cc me ;)

comment:2 by elexis, 8 years ago

On the implementation: A 2mb replay file is zip-compressed to 300kb, so should be okayish.

The NetServerTurnManager needs to cache all commands of all players for every turn and the hash values of the host (or a player that isn't considered OOS). The turn lengths are already cached in m_SavedTurnLengths.

After the client has finished the rejoin and received the previous commands, it must unzip the data, then start appending the commands after the rejoin to that file.

The partial commands.txt wouldn't need to be written to the disk anymore. Since for debugging only the turn-number of the rejoin is relevant of that file, the turnnumber might be written to a separate file, like rejoin.txt.


Optionally we could add a new option in the server settings to limit the downloading. Choices:

  1. No downloads allowed
  2. Downloads only on request
  3. Automatic downloading allowed

This way both power-hosters and low-end computers with bad connections can be served. If done so, there should be a "Download replay" button in the main menu which becomes disabled once the replay had been downloaded.

comment:3 by elexis, 8 years ago

This feature seems to have been planned since more than 8 years ago when NetServer.h was added:

	// The game is over and someone has won. Players might linger to chat or
	// download the replay log.

comment:4 by elexis, 8 years ago

Component: Core engineNetwork

(set component to network)

comment:5 by elexis, 8 years ago

Keywords: beta added

comment:6 by Itms, 7 years ago

Similar issue on single player: #4367.

Note: See TracTickets for help on using tickets.