Add frame aware advance gate - #74
Draft
11EJDE11 wants to merge 3 commits into
Draft
Conversation
|
Nightly build for this pull request:
This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build. |
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.
To advance a frame,
Wait_For_Playerscurrently checkstheir[i].recv >= their[i].sent. If a peer is behind on that count, the game stalls, even if the missing commands are for future frames andMaxAheadstill allows simulation to continue.This PR replaces the count-based check with a frame-aware one. A peer is considered caught up once all commands for frames
<= currentare known to have been received, based on each packet's(Frame, cumulative count)stamp.In practice, this lets the game continue for a few more frames instead of stalling immediately. If the delayed packet arrives before those frames are reached, the stall is avoided entirely.
Also fixes a bug found along the way: CommandCountStalls was writing to the wrong per-peer index under packet loss, corrupting and unrelated frame-timing accumulator.
I've tested a few games. 3 players, 1 with 20% drop (using Clumsy) in/out.
So not huge savings, but in my testing with a < 5000 frame game, there were about ~50 times this kicked in.
Vanilla:

With this PR:

Draft until Phobos-developers/YRpp#75