Melee: horrible server to non-owning client position replication

Intro

Eternal Crusade Resurrection is a multiplayer shooter with extensive melee usage (swords, knives, other weapons) based on animations with root motion. We use GAS for all melee abilities.

Problem

Sometimes while fighting in melee, your opponent’s position (who is also fighting in melee and playing animation montages) can be replicated wrong during several seconds up to 10 seconds or more. It seems that it can happen not only when ping is bad (150 ms+), but also during rather good ping (40 ms).

6th second: enemy jump pack assault is attacking the box, but dealing damage to the player, apparently being in from of him on the server (ping near 120ms)

30th second: enemy tactical is hitting the corner, but dealing damage to the player, (ping is near 70ms)

4th second: enemy raptor is hitting while being in other location than on the server (40 ms)

Suspected main problem thesis: lack of replication of current position from server to simulated proxies or incorrect prediction from the simulated proxies overwhelming the correct data received from the server.

Melee implementation

Tracing, damage and stun application is done on the server only in N seconds after ability start.

Playing montage is done via PlayMontageAndWait GAS task.

Ending ability is done only with “End Ability Locally”, which is fired on both server and owning client at their time.

During melee and some seconds after it, Client Authoritative movement is used (to smooth animations for people with 100ms+ ping), in the end of ability validation occurs (end position - start position length) and in 0.2 seconds, if another melee ability wasn’t initiated, the movement becomes server authoritative back (the booleans below are set to false).

To prevent attack from mishit, there is a box in front of the character which accepts overlap events (on client) and freezes movement (by calling “Disable movement” and since movement is client authoritative) when another pawn overlaps it. In the end of ability the movement is enabled (by setting walking or falling mode depending on “is falling”).

Smoothing is disabled to give correct coords ASAP (below are character properties).

Attempted solutions:

  1. Disable client authoritative movement swap, check for box overlap events on server.

Results:

  • Bad box overlap events, characters often seem to fly through each other during attack
  • Unpleasant correction of your movement with high ping, interruption of abilities
  • Seems that incorrect position replication from server to client still occurs
  1. Use custom function for replicating montage (reliable server and reliable multicast):

Results:

  1. Still incorrect positions of enemies hitting you but seeming to be in high distance / looking in other directions - didn’t help (3rd video is after applying this change)

Another attempted solution:

Fearing that calling DisableMovement can cause disabling character position replication, I changed movement stop during montage method by implementing GAS attribute RootMotionScale and changing Character’s AnimRootMotionScale according to this attribute. When overlap event happens, instead of disabling movement, I apply a Gameplay Effect which sets the attribute to 0 and stops root motion.

For some reason it never worked with client overlap events so I had to check for them on server, so the movemnt freezing events became worse.

It still didn’t solve the incorrect position replication from server to autonomous proxy.

Another attempted solution:

Increase min network update frequency

Results:

  1. The same error occurs

Similar issues:

https://www.reddit.com/r/unrealengine/comments/108by55/bug_root_motion_completely_broken_in_51_want_to/

After finding other topics complaining about root motion replication in UE 5.1 I understood that it’s the engine version problem and I can hardly do something with it.

My “dirty fix” around this problem is having replicated position and rotation and applying them when position delta between automomous proxy character location and new replicated position property is higher than threshold (1m)

I also suppose we didn’t have that issue before we switched to 5.1 from 5.0 so I don’t recommend such switch. But it’s also possible it was even in 5.0, we just didn’t notice it as we did lower amount of testing back then. Though the first video with the desync we have was just after update to 5.1.

UPDATE 15/10/23:

Same problem happens in 5.3. Again, don’t recommend going away from 5.0.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.