I’m not familir with UE C++, so I can only help by describing the technique for you in abstract. I suspect doing something like this is very complicated and non-trivial in UE, because it will touch many data-paths (physics, rendering, animation state).
In a system with decoupled simulation and rendering, and a low-rate fixed timestep simulation (like Starcraft 2), you have three (or four!) sets of “state” for each object that include orientation and animation-state.
Let’s assume 10fps physics, and 60fps rendering
- sim-state-next (calculated at 10fps)
- sim-state-minus-1
- sim-state-minus-2
- render state (interpolated between #2 and #3 at 60fps)
What you end up with is:
sim-state-minus-2 --------- sim-state-minus-1 --- (now) --- sim-state-next
/\
+------ rendering this moment
The simulation (physics) will run when the 10fps (10hz) timer has indicated a new physics step is due, and it will calculate a new simulation step based on the old step and mob actions…
However, during the time you write to sim-state-1/2, you can’t render interpolate, so if there is any chance the simulation step calculation can take longer than the rendering frame (which is likely if you want to support 144hz rendering), you can’t overwrite sim-minus-1 and sim-minus-2 until you are finished calculating the next simulation step. This leads to a triple buffering solution above, where you calcualte into sim-state-next, and copy into 1/2. If you know you can finish the simulation state calculation during a render frame (or you are willing to hold up the render frame because of it), you can collapse #1 and #2 above, but I don’t recommend it, because the simulation is calculated infrequently and this can lead to fps “hitches”.
In addition to interpolating between orientations (position/rotation), it’s also necessary to interpolate animation paths and states. This requires calculating the current animation state as a delta in time from sim-state-minus-2, which requires copying any animation state calculations, initiations, and creations through the triple buffering (cur → minus-1 → minus-2)
As for doing this in UE, some of the things you’ll need to look at include:
- fully separating the physics and actor AI loops from the rendering loop
- setting up the double-buffered “sim-state-1” and “sim-state-2” history for each sim object
- copying from sim-state-next → sim-state-1 → sim-state-2 at the right time
- changing rendering orientation and animation to be based on sim-state-2 → sim-state-1 interpolation, instead of rendering from “current” like UE does now
One way to do this, such as what is being done in Stormgate, is to turn off UE physics and AI code and create your own totally new simulation and physics system that handles all of this… and then just copy whatever you’d like UE5 to render into the “current” state. If you do this, you either won’t be using blueprints, or you’ll have to find your own way to compile and/or execute blueprints.
you can see the stormgate folks talk a little about this in their tech reveal: