I’m prototyping a custom multiplayer system with a mesh of game servers, a replication server (only handles data) and state interpolation for the clients. Currently using UE 5.3 built from source.
I would like to use the built-in systems (apart from the networking, as I wrote a custom system myself) as much as I can, so think its physics system, character movement component and the chaos vehicles for example. While I do think that for a core system like networking it would be good to actually integrate it into the engine source, it would be way out of scope for a prototype and would make updating to new UE versions harder. So far things are working great as far as the custom server mesh logic goes (data replication, authority transfer, client/server side entity streaming etc). We've been able to play pretty smoothly on hosted infra during tests.
Where I’m running into issues, is when a player changes their input on an actor that they control. Let’s use a vehicle as an example. Imagine they’re driving along in their vehicle and now begin to apply steering input to the left. The server has already simulated a few updates ahead and transmitted these to the client (so that we have some data buffered in case of high latency for the client) and in order to have a buffer on the replication server (that would be correct if nothing changes in the object’s trajectory/state). These buffered updates are now incorrect both on the servers and on the client because of the input change, so in this situation we’d like to re-simulate the out of date updates on the server and push those to the client, using the new state values. So in my head that would be placing the actor back at the point where the input state changed, set the new state values and then advance the physics simulation forward by the required amount of steps/deltatime. Because vehicles are not a simple 'move in direction X with chosen velocity X and check collision' entity (having properties like engine/wheel speed, wheel grip etc etc) I think I need to rely on the physics system to calculate the simulation result.
Now, the question;
How can we manually simulate one or more physics ticks for an actor? I haven’t been able to find any way to execute manual physics updates for an actor using the built-in physics system. While I did stumble across some similar posts online, everything I could find was either very old (pre-UE5) or had no resolution.
If manually simulating a single actor isn’t possible, perhaps is there a way to simulate a copy of the entire physics world / a subset of relevant actors that I put into a separate physics world? In that case maybe I can have the server re-simulate that and pull the updated data from there.
What I've tried so far is looking through documentation, UE source code and trying things like manually executing engine main tick functions (which is actually not recommended as far as I know).
Any input would be appreciated. I’ve been messing around with this for so long that I may have ended up with tunnel vision, so outside input could be refreshing.
Thanks for your time!