Repository navigation
feat(server): add onesync_minFrameRetention - #4400
Open
OneEarJoe5 wants to merge 1 commit into
Open
OneEarJoe5 wants to merge 1 commit into
OneEarJoe5 wants to merge 1 commit into
Conversation
Since frame retention is based on client silence, a client that stops receiving for a while but keeps sending only gets the default backlog of 650 frames. When packets come through again it NAcks frames that are already gone and gets dropped with "Timed out after 60 seconds (1, ...)". Before that change every client effectively kept the 60 s worst case. Add onesync_minFrameRetention (seconds, 0 = off) so servers that see these drops can keep frames longer for everyone. The seconds are turned into frames with the current sync rate and capped at the worst-case backlog. The default doesn't change anything. Signed-off-by: OneEarJoe5 <212275319+OneEarJoe5@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Goal of this PR
Since bd84727 (retain frames based on client silence) a client only gets the 60 s worst-case backlog after 5 s without any update from it. A client that stops receiving for a bit but keeps sending its own sync never hits that, so it keeps the default 650 frames. Once packets get through again it NAcks the frames it missed, those are already erased, and it's dropped with
Timed out after 60 seconds (1, ...). Before that commit the check was always true, so every client kept ~60 s and recovered from short network hiccups. That's what #4394 is seeing.How is this PR achieving the goal
Adds a convar
onesync_minFrameRetention(seconds, default0). When set, the frame backlog for every client is at least that long. The seconds are turned into frames with the current sync rate (effectiveTicksPerSecond, the frame index goes up once per sync tick) and capped atmaxSavedClientFramesWorstCase. With0nothing changes, so the memory improvement from bd84727 stays for everyone who doesn't need it.I went with a convar because in NAK mode the server has no way to tell that a client is behind until the NAck comes in, and by then the frames are gone. If you'd rather change the default (or have a better signal for "client is behind"), happy to adjust.
This PR applies to the following area(s)
Server
Successfully tested on
Game builds: 3889
Platforms: Windows (server)
Official client against a server built from current master (5412ed8), with and without this commit. To get a reproducible stall I used a local test-only hack that stops sending
msgPackedClonesto the client for N seconds while it keeps sending (not part of this PR). With one player the server runs at 40 sync ticks per second, so the default 650 frames is ~16 s here.Timed out after 60 seconds (1, 985, 938)set onesync_minFrameRetention 30in the cfg(1, 1372, 144), so 30 s really is ~30 s (1200 frames)0at runtime(1, 982, 63), same as without the convaronesync_automaticResend true, convar 0 and 30Added unit tests for the backlog limit next to the existing ones, they pass.
Not tested: Linux, real packet loss (only the stall hack above) and servers with many players.
Checklist
Fixes issues
fixes #4394