-
Notifications
You must be signed in to change notification settings - Fork 600
Description
The most accurate description of these methods, at this time, is "repeatedly retry spawning the entity, deleting it every tick until either we stop trying or the real one comes in."
This doesn't work, and breaks basically everything that has longer-term state, including:
- Audio.
- Sprite animations.
- UI.
- Anything predicted from the newly spawned entity itself.
I'd hazard to say it's an outright antipattern and we must do something smarter than that.
One of the best ways to handle predicting discrete events is to give those events unique identifiers, saying that "okay, here's the identifier for this event, if the server says it happens then we're all good otherwise we mispredicted and gotta undo it"
I've also noticed content has tried to come up with various solutions to unique identifiers (for rng, mostly). The following do not work in the general case:
- Coordinates (The game's coordinate math is not deterministic.)
- EntityUid (nondeterministic)
- NetEntity (breaks prediction of events caused by predicted entities, as it doesn't exist w/o the server)
- Sequence numbers (Order dependent)
The following solutions work in the general case:
Unfortunately, that's pretty few general solutions.
So here's the things we can use as unique identifier, sometimes:
- NetEntity (for entities not spawned as part of prediction)
- Sequence numbers (It's just incrementing an integer, as long as the order stays the same there's no problem)
I'm going to try to figure out a proper predicted spawn (likely involving sequence numbers) because the current methods cannot stay.