Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Oldest command to send is off by 1 with sparsetickbuffer #120

Open
AnthonyB28 opened this issue Jun 11, 2020 · 0 comments
Open

Oldest command to send is off by 1 with sparsetickbuffer #120

AnthonyB28 opened this issue Jun 11, 2020 · 0 comments

Comments

@AnthonyB28
Copy link

var oldestCommandToSend = Mathf.Max(prevTick, m_PredictedTime.tick - NetworkConfig.commandClientBufferSize);

This appears to be off by 1.
Suppose the predicted tick is 21444.
21444 - 32 (the constant buffer size) = 21412

This will try to store from 21412 up to and including 21444. Notice that after the loop ends, we store the predicted tick. So this method is storing 33 elements, not 32.

If you try to do a TryGetValue with tick 21412 it will return false being an "Invalid" tick to the buffer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant