You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is an observation I made while working on #244.
AFAIK, we are currently (#244 or not) doing synchronous updates & rendering, with variable time steps, i.e. rendering is tied to game world updates, and both happen at non-deterministic times (tied to physical time & how fast things execute).
This means game-world updates are non-deterministic, which will likely be a major issue once we want to implement networking support: many/most approaches to networked games are much simpler (or possible at all) with deterministic state updates.
The standard solution is to decouple game-world updates from rendering, run updates on fixed time steps, and interleave rendering in-between world updates; this way, state updates are deterministic and do not lag behind (assuming the platform can keep up with state updates at all), and running on an underspec'd platform only results in fewer frames being rendered each second.
If we want to be fancy about it, we can even interpolate the position of objects at render-time (i.e. use obj.position + time_delta * obj.velocity as the effective position) for smoother motion.
That would involve introducing an (optional) API for position interpolation, since motion (and physics in general) isn't a core part of PPB (we don't even provide the concept), and users are free to implement their own.
The text was updated successfully, but these errors were encountered:
run updates on fixed time steps, and interleave rendering in-between world updates
We already do this. And after #221 we actually do this better. PPB has done fixed step simulation since the first version. Look at Updater for how it's currently implemented.
This is an observation I made while working on #244.
AFAIK, we are currently (#244 or not) doing synchronous updates & rendering, with variable time steps, i.e. rendering is tied to game world updates, and both happen at non-deterministic times (tied to physical time & how fast things execute).
This means game-world updates are non-deterministic, which will likely be a major issue once we want to implement networking support: many/most approaches to networked games are much simpler (or possible at all) with deterministic state updates.
The standard solution is to decouple game-world updates from rendering, run updates on fixed time steps, and interleave rendering in-between world updates; this way, state updates are deterministic and do not lag behind (assuming the platform can keep up with state updates at all), and running on an underspec'd platform only results in fewer frames being rendered each second.
If we want to be fancy about it, we can even interpolate the position of objects at render-time (i.e. use
obj.position + time_delta * obj.velocity
as the effective position) for smoother motion.That would involve introducing an (optional) API for position interpolation, since motion (and physics in general) isn't a core part of PPB (we don't even provide the concept), and users are free to implement their own.
The text was updated successfully, but these errors were encountered: