Hi, I’m developing a multiplayer game and sometimes I need to roll back in time, and process inputs for each step until I get to the current step. how can I do this? is there a method on the engine or scene object for stepping physics and animations manually when lockstep is active?
Here’s what we do to animate when deterministic lockstep is used:
scene._animate() will make the regular animations run (ie. all animations but physics ones) and
scene._advancePhysicsEngineStep will advance the physics animations.
Hello @Evgeni_Popov, I’m implementing a rollback networking model, and stepping manually this way works but there is an issue! physics animations and movements are deterministic because when I use
scene._advancePhysicsEngineStep I can pass a time to it but there is no such thing for the
scene._animate method and after rolling back to a specific step and stimulating to the current step the master frame of each animation group on each rollback step is different than the real step that was rendered before. is there a way to fix this? Here are some screenshots for a better understanding:
and this is my rollback logic:
This PR will allow you to pass a custom delta time to
Also, I have a question! when can I get these new changes? I checked and there is no new release that includes this PR.
I agree but that would be a breaking change… I don’t know if we can consider it a bug or not.
The merged PRs are visible on the Playground the day after they are merged. New NPM packages are created each Thursday morning (EU time).
I was trying to think as well if it is a bug or not. My gut feeling is - it is a bug. Deterministic step should be deterministic. As long as we don’t change the
else context I am fine with making this change, as it makes sense. If we want to be really safe here we can add a flag to the scene, but I think it will be hard to explain why we have a “isSceneDeterministicer” flag in the scene.
I also think it’s a bug, here’s the PR: