Replies: 1 comment 2 replies
-
There is more state than contacts. E.g. the bodies store information to determine when they can go to sleep. Constraints store information about the previous update that is used in the next update. Failing to send this information will make the simulation go out of sync.
Position, orientation and velocity are part of the state, so
Several things are keyed off the BodyIDs that would need to be updated when reordering bodies (e.g. the contact cache). I don't see the advantage of doing that and I would recommend to send the BodyIDs in the initial state message and using |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
First off, thanks Jorrit for all the great work you've done with Jolt and all the help you've given to the community. It's a really cool project!
I've seen in the docs and in the discussions, mentioning approaches for deterministically getting state consistent over the network. So another one for the pile.
As a game/simulation goes on, with bodies being created and destroyed, the body vector can become sparse. So if a client were to join/rejoin later on, even if they know the order to create bodies, the body ids will not line up. And they will also need any cached contacts. So the guidance I've seen is something along the lines of
(omitting constraints)
But theoretically, I could see us getting around the need for actually sending body ids if the runtime input alone is enough to determine which bodies should be created, in a deterministic order, if we had a way to remap the bodies to the bodies as if we were to allocate them in order from a blank slate.
I imagine this would need to happen before sending off the SaveState or running the physics system update for all clients and server. What isn't clear to me is how much of a perf hit this would be, and maybe likely isn't worth a continual cpu cost to make a one-time network save on join. But I could potentially see this benefiting shared authority or p2p games where there may not be as clear of a centralized authority for body id creation.
I'm still pretty new to the codebase, so my apologies if I'm a bit ignorant.
Beta Was this translation helpful? Give feedback.
All reactions