# Melee: horrible server to non-owning client position replication

**URL:** <https://forums.unrealengine.com/t/melee-horrible-server-to-non-owning-client-position-replication/1191124>\
**Category:** Multiplayer & Networking\
**Tags:** unreal-engine, Gameplay-Ability-System, Blueprint, question\
**Created:** [June 6, 2023, 10:08pm UTC](https://forums.unrealengine.com/t/melee-horrible-server-to-non-owning-client-position-replication/1191124 "2023-06-06T22:08:53Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![JediKnightChan](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jediknightchan/32/1156960_2.png) [@JediKnightChan](https://forums.unrealengine.com/u/JediKnightChan)\
**Post date:** [June 6, 2023, 10:08pm UTC](https://forums.unrealengine.com/t/melee-horrible-server-to-non-owning-client-position-replication/1191124/1 "2023-06-06T22:08:53Z")

</div>

# 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)

![](https://d3kjluh73b9h9o.cloudfront.net/optimized/4X/5/4/6/546d059c3d416206d9646e8b0d4006c438bd40a7_2_690x388.jpeg)https://www.youtube.com/embed/YX0bSlxmJZE?feature=oembed&wmode=opaque&start=6

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

![](https://d3kjluh73b9h9o.cloudfront.net/optimized/4X/5/4/6/546d059c3d416206d9646e8b0d4006c438bd40a7_2_690x388.jpeg)https://www.youtube.com/embed/YX0bSlxmJZE?feature=oembed&wmode=opaque&start=30

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

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/a/6/5a67f0f749de6478df71cd83d241e82859a7e460.jpeg "ECR Melee Bug 1") ](https://www.youtube.com/watch?v=vCfC53LQfJo)

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.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/3/9/039fe09cd9f494e7024f24ae22a831e84e7f6816.png)

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).

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/8/c/48ce710a4c0d2ae7452fd63a67b60d1d15716121.jpeg)

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”).

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/e/c/6ec6456f1fbf3fda3734110b21550fd12df74482.png)

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

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/2/7/627b1370ec5443649b3d1f5f7b47bc64935e095e.jpeg)

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/f/5/6f5bb9c79c8c0519eda3803975d9f4c748d699e6.jpeg)

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):

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/2/5/c2520dc5b5fecf2abf82f5276d07b06c40985064.jpeg)

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)**

---

<div class="post-metadata">

**Author:** ![JediKnightChan](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jediknightchan/32/1156960_2.png) [@JediKnightChan](https://forums.unrealengine.com/u/JediKnightChan)\
**Post date:** [June 8, 2023, 7:57pm UTC](https://forums.unrealengine.com/t/melee-horrible-server-to-non-owning-client-position-replication/1191124/2 "2023-06-08T19:57:22Z")

</div>

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.**

---

<div class="post-metadata">

**Author:** ![JediKnightChan](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jediknightchan/32/1156960_2.png) [@JediKnightChan](https://forums.unrealengine.com/u/JediKnightChan)\
**Post date:** [June 17, 2023, 6:50pm UTC](https://forums.unrealengine.com/t/melee-horrible-server-to-non-owning-client-position-replication/1191124/3 "2023-06-17T18:50:59Z")

</div>

Another attempted solution:

Increase min network update frequency

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/1/6/c16e67e18f4c0d6d28f1374734a78bed9d75cecc.png)

Results:

1. The same error occurs

---

<div class="post-metadata">

**Author:** ![JediKnightChan](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jediknightchan/32/1156960_2.png) [@JediKnightChan](https://forums.unrealengine.com/u/JediKnightChan)\
**Post date:** [July 3, 2023, 4:56pm UTC](https://forums.unrealengine.com/t/melee-horrible-server-to-non-owning-client-position-replication/1191124/4 "2023-07-03T16:56:48Z")

</div>

Similar issues:

> [@Root motion allowing rotation client arbitrary desync in 5.1, but happening since 5.0EA](https://forums.unrealengine.com/t/root-motion-allowing-rotation-client-arbitrary-desync-in-5-1-but-happening-since-5-0ea/791224):
>
> Hi! I wanted to flag an ongoing issue that happens over time in multiplayer sessions in 5.1 and has been happening for 2-3 years in 5.0EA, 5.0 etc . Allowing root motion rotations can desync server/client locations. It happens in around 5% of spawned AIs under exactly the same conditions. The more time you are in a multiplayer session, the more likely you will see this type of teleport behaviour due to server-client desynchronization. You can see in this video (playing as client)…

---

<div class="post-metadata">

**Author:** ![JediKnightChan](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jediknightchan/32/1156960_2.png) [@JediKnightChan](https://forums.unrealengine.com/u/JediKnightChan)\
**Post date:** [July 3, 2023, 5:01pm UTC](https://forums.unrealengine.com/t/melee-horrible-server-to-non-owning-client-position-replication/1191124/5 "2023-07-03T17:01:03Z")

</div>

> [@Root motion completely broken in UE 5.1](https://forums.unrealengine.com/t/root-motion-completely-broken-in-ue-5-1/744362/6):
>
> Thanks for try to fix this problem

[https://www.reddit.com/r/unrealengine/comments/108by55/bug\_root\_motion\_completely\_broken\_in\_51\_want\_to/](https://www.reddit.com/r/unrealengine/comments/108by55/bug_root_motion_completely_broken_in_51_want_to/)

---

<div class="post-metadata">

**Author:** ![JediKnightChan](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jediknightchan/32/1156960_2.png) [@JediKnightChan](https://forums.unrealengine.com/u/JediKnightChan)\
**Post date:** [July 7, 2023, 12:12am UTC](https://forums.unrealengine.com/t/melee-horrible-server-to-non-owning-client-position-replication/1191124/6 "2023-07-07T00:12:36Z")

</div>

**UPD 14/03/2026:**

**Problem appears to be fixed in 5.4 with this commit:**

[https://github.com/EpicGames/UnrealEngine/commit/fe450c1057b2da0ff5a6d65936a4e3778ce1aa40](https://github.com/EpicGames/UnrealEngine/commit/fe450c1057b2da0ff5a6d65936a4e3778ce1aa40)

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 sim proxy character location and new replicated position property is higher than threshold (1m)

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/a/0/0a0501cb6384bb961a43df1be74aaa8be45479cd.jpeg)

**UPD 14/03/2026:**

**Problem is fixed in 5.4 with this commit:**

[https://github.com/EpicGames/UnrealEngine/commit/fe450c1057b2da0ff5a6d65936a4e3778ce1aa40](https://github.com/EpicGames/UnrealEngine/commit/fe450c1057b2da0ff5a6d65936a4e3778ce1aa40)

---

<div class="post-metadata">

**Author:** ![JediKnightChan](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jediknightchan/32/1156960_2.png) [@JediKnightChan](https://forums.unrealengine.com/u/JediKnightChan)\
**Post date:** [July 7, 2023, 12:14am UTC](https://forums.unrealengine.com/t/melee-horrible-server-to-non-owning-client-position-replication/1191124/7 "2023-07-07T00:14:32Z")

</div>

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.

**Problem is fixed in 5.4 with this commit:**

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [August 6, 2023, 12:15am UTC](https://forums.unrealengine.com/t/melee-horrible-server-to-non-owning-client-position-replication/1191124/8 "2023-08-06T00:15:23Z")

</div>

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