Skip to content
New issue

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

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

Already on GitHub? # to your account

Update HistoryBuffers during client TickEvents #798

Merged
merged 6 commits into from
Jan 11, 2025

Conversation

cBournhonesque
Copy link
Owner

  1. Refactor ResourceHistory and ComponentHistory to use the same HistoryBuffer under the hood. The HistoryBuffer doesn't use a heap anymore but a VecDeque. That's because the updates to the HistoryBuffer are pushed/removed in sequential order.
    TODO: the same can be applied to InterpolationHistory since the replication updates are ordered on the receiver side)

  2. Make sure that rollback for non-networked resource works correctly.
    An issue was that the history was only updated once the client was synced. Therefore we would get in a situation where:

  • insert Resource
  • client sync (client tick goes from X' to X)
  • run history system, so insert Resource in history for tick X
  • receive server packet for tick X-Rollback, which triggers a rollback
  • the history doesn't contain anything for the resource on tick X-Rollback, so the resource gets removed.

My fix is:

  • make sure that the HistoryBuffer gets updated when we receive a TickEvent -> all the ticks inside the buffer get updated
  • make sure the PredictionPlugin runs if the client is connected, not synced. This ensures that the resource gets added will be present in the history when the first server packet arrives

@cBournhonesque cBournhonesque merged commit ca52843 into main Jan 11, 2025
1 of 4 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant