Very nice that you got both of those working, good job!
You can get better results than that yes, but I’d recommend to aim for the Average profile, not the Bad at the moment.
It’s hard to point towards specific fixes, networked physics is quite a complex area and it’s still experimental so we don’t have all the documentation, settings and features implemented yet.
But it looks to me like the issue for both vehicle and crane is the same thing that sim-proxies forward predict too much, the clients physics simulation is forward predicted, the autonomous proxy is acting in the forward predicted timeline, it’s moving forward sends that input to the server which then move forward and sends the input and state to sim-proxies which then move forward. That creates a time delay so sim-proxies act in the “interpolated timeline" behind the server while autonomous proxies act in the “forward predicted timeline”. And for physics interactions to work they need to act in the same timeline (preferably).
With bad networking you probably receive inputs and states from the server that should have been applied 10-15 frames ago, i.e. the forward predicted timeline is 15 frames ahead of the interpolated timeline. And to get sim-proxies into the forward predicted timeline we trigger a resimulation, sets physics back 15 frames, apply the received input there and then resimulate forward to the forward predicted timeline again. But sim-proxies only have inputs for the interpolated timeline, so for the first resim frame essentially. The next 14 frames during resimulation the sim-proxy will be using the latest received input which means the sim-proxy crane will turn right for 14 frames but we don’t know if it will actually turn right during those frames. Say when you receive the next input from the server the input is that the crane have stopped moving, but on the sim-proxy it has forward predicted moved right for 14 frames, so it has overshot its stopping point. It will rewind 15 frames and then apply input with no movement for 15 frames. Then rendering will cover up that correction by moving it smoothly back to the left from the overshot position.
This means that instant movements with networked physics is quite hard to make look well since everything needs to be forward predicted but if things can stop on a dime they will overshoot and need to get corrected backwards.
From a game design view it’s best to make the crane have momentum, so it doesn’t stop instantly, it slows down gradually to a full stop. That will help along with the following..
To make sim-proxies not fully forward predicted during resimulations the only thing we have at the moment is input decay, which means we decay the input during forward prediction for sim-proxies, so the crane can turn less and less right the further into forward prediction it comes.
I would say you need to balance input decay and you do that via NetworkPhysicsSettingsComponent and the DataAsset along with your implementation function for decaying inputs.
It is sometimes also better to make the input decay curve a flat line at say 0.35 instead of a curve or linear increase, it depends on what your pawn.
One downside with input decay is that it doesn’t scale with network conditions yet, so if you balance it to look good at Bad then it might not look good at Average.
UE 5.8 will see a couple of improvements to input decay and also a new way of keeping sim-proxies not fully forward predicted without decaying inputs.
You can also in the settings DataAsset make it trigger a resimulation when it receives inputs, that will make it resimulate very often but it will most likely also help you with the overshoot issue.
Also if you are making a coop / casual game then resimulation is a bit overkill at the moment, it’s designed for 100% server authority with dedicated servers.
We don’t have a solution for client authority between autonomous proxy and server when the pawn is physics-based at the moment though. But if you were to run client authority the replicated physics objects could use Predictive Interpolation which generally looks much better out of the box.
You can use that replication mode for physics pawns also but you will have input latency depending on your network latency in that case.
So the three things you should look into to start with is:
- Add momentum to the cranes rotation
- Balance Input Decay
- Enable resimulation on received inputs