Search the Community
Showing results for tags 'deterministic lockstep'.
-
Hello, the game I'm currently working on will be multi-player and needs to show replays. Instead of snapshotting complete game states, I would like to have a deterministic engine, so supplying the same initial state and the same inputs should result in same state evolutions over time. To achieve this, I need physics and animations to be frame-rate independent and to be in sync with each other. The idea is quantize the state execution time, by updating the game state at a fixed frequency, keeping an accumulator so to carry over exceeding time to the next frame update (the code would be similar to the one featured by CannonJS in its step function. The amount of internalStep can be capped to a maximum value, to avoid accumulating delay into the so-called spiral of death. I would be patching BABYLON.Scene.render() code, which is where animations and physics steps are triggered, by adding a conditional change if BABYLON.Engine is constructed with deterministicLockstep flag set to true, defaulting to false to keep compatibility with today code. I would add even a couple of observable events like onBeforeInternalStepObservable and onAfterInternalStepObservable so to be able to plug game logic code to execute before and after each internal discrete step. So, particularly to @Deltakosh would a pull request matching the criteria above be accepted? Thank you in advance, santarcade