After fiddling around with experimental blueprints and modifiying character movement component, I’m now asking for some advice ._.
I want to get two things working:
I’m trying to get players replicated on moving objects without stuttering. The moving object hasn’t to accelerate or turn fast. A good example would be a boat or ship.
What I’ve done is setting up a basic actor, which position gets replicated over the network from server to client. The client will simultaneously accelerate with the server. If there’s too much offset, the client’s boat will interpolate to the server position. So really basic networking stuff. The clients boat also extrapolates the servers position, considering the network latency, so it doesn’t gets corrected to a position back in time. I even visualized the servers real position with the extrapolated ones, compared with mine, to get better visual feedback.
Almost everything is working fine. There are no problems if I just accelerate, no matter how fast it speed up or stops. There is only one thing, I couldn’t get a rid of.
That stuttering and jittering when the platform rotates on the yaw axis (left and right turning). I slowed down the turnspeed to a minimum of about 6 units per second (times deltatime).
I even slowly adding a value from 0-1, which gets multiplied by the turnrate. But after a second or so, it still jitters.
The strange thing what I’m wondering about is, why it doesn’t stutters when I’m accelerating, even at 500*deltatime per second, without slowly increasing speed. Everything is fine.
But turning at a constant slow speed, the player starts to stutter.
on top of that problem. If the player jumps on a moving platform, he gets shifted a few units, basically teleporting to the servers position. I investigated the character movement component, especially the “setbase” function, because I wanted to get a rid of the “teleport” what happens, if you jump on a moving platform in multiplayer at a given lag.
The server will jump [lag]ms later on the moving platform, causing the platform being a little further X units and will correct the players position not smoothly, but immediately.
To visualize the teleporting problem, I made up a graphic:
I could minimize this behavior by turning off the “setbase” function, if the player jumps. So as long he enters a boat/ship which doesn’t move, it should be fine. He can move around and even jump without being rebased twice, after the jump and right after landing.
Faking the objects movement is no option for me, as they can be more moveble platforms, on which other player can stand on.
I even bought an unreal engine c++ multiplayer course, which was really great to dive in, but at the end, same problems occure:
- jittering / rotational offset by the player on a moving platform which is turning in one direction while accelerating forward
- teleport / rebaseing if I jump on a moving platform
After some search for games made up in unreal, I find “sea of thieves” as a good working example.
- player can walk smooth and free on a moving platform (ship)
- player can even jump on, without being corrected/teleported immediately
The questions I had in mind when I saw the gameplay were:
Does they somehow edited the character movement component or
did they write up a whole new character movement component, which replicates its position relative to the platform origin, extrapolating the movement of the ship to the player?
I’m out of ideas. Do I overcomplicate this issue? Is there a good workaround, to get this two features working?
edit: one thing I forgot to add:
If the platform is rotating just a little faster, so the offset is greater than the “walls” thickness of the object, preventing the player walking off the ledge, there is another issue, caused by the same logic. I can move on the client, at certain positions, through the walls, off the platform, hover in the air, jittering around. On the server, I’m still on the platform, but the offset is causing the difference, letting the client move outside in his state of the game.
Here’s another graphic, which highlights a green area, which marks the offset, in which the clients is standing on, hovering in the air: