-
Notifications
You must be signed in to change notification settings - Fork 32
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
Client-prediction tracking ("Client-mapped entities") #78
Conversation
i haven't added any sort of special way for the client to tell the server about predictions, imo that should be part of the game's existing custom protocol. all the game server needs to do is detect that, and update the prediction tracker. |
If we made a new shared config struct that the client and server plugins take, this kind of feature can be opt in depending on the style of game. (perhaps we how about something like: #[derive(Default)]
struct RepliconConfiguration {
// Makes the `PredictionTracker` available on the server,
// and supports client-predicted entity mapping.
pub client_predictions: bool,
} Another option might be to not insert the |
Codecov ReportAttention:
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #78 +/- ##
==========================================
- Coverage 96.16% 95.53% -0.63%
==========================================
Files 13 13
Lines 834 874 +40
==========================================
+ Hits 802 835 +33
- Misses 32 39 +7
☔ View full report in Codecov by Sentry. |
reverted the entity encoding commit and added a currently-failing test showing the edge case @Shatur pointed out relating to mapped components referencing the predicted entity.
also noted there's no need for the prediction hit callback, since successful prediction means the predicted entity will receive (at least) the i will change it to using an entity mapping array as discussed. |
This reverts commit bcb29c2.
8bf6b61
to
d12971a
Compare
We already have `to_client`, it's even shorter.
I think we should either move all readings there or nothing. But I don't think that reading should be a part of `ReplicationBuffer`, I would prefer to see them as free functions or as a part of some reader-like struct. Also saves us from `Vec<(Entity, Entity)>` allocation.
- Use a dedicated struct instead of aliases. - Provide more detalied example - Remove filtering acknowledged ticks (acknowledged ticks are cleaned up). - Use more consistent API inside `ReplicationBuffer` related to mappings.
Private functions do not need to be marked as inline, they are inlined automatically. See this awesome article: https://matklad.github.io/2021/07/09/inline-in-rust.html
I prefer to avoid them. It's obvious what is going on from the function name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason server.rs
contains duplicate code from client_entity_map.rs
. I am not going to transfer all my comments over to the correct file.
Co-authored-by: UkoeHB <[email protected]>
Co-authored-by: UkoeHB <[email protected]>
These ones I applied almost as is, but instead of writing (`client_entity`, `server_entity`) I referenced the argument in one place and the type in general documentation. For consistency with Rust docs.
This is working fine, in the test and in my game (which has a misprediction cleanup system similar to the new docs describe).
I'm currently sending Entity::PLACEHOLDER where there is no prediction, so still need to decide on the packet format.
EDIT: pushed a change to encode compactly now
With a bit more code complexity, like a shared config between client and server, we can make it totally opt-in and zero cost if the feature isn't used, otherwise I think i can make it cost 1 bit per entity to mark if there's a predicted entity too.
This is to fix #67