miwarnec / uMMORPG

4 stars 0 forks source link

Entity position on the client is different to server causing scriptable skills distance condition to fail on the server only #20

Closed trippah closed 4 years ago

trippah commented 5 years ago

Versions (please complete the following information)

Describe the bug If a skill.CheckDistance() is executed in a [server] block like UpdateServer_IDLE() on player.cs, CheckDistance() is executed on both the client and server.

Trying to cast a skill (slash) would sometimes fail as the skill CheckDistance method is returning different values on client and server, and on occasion the server value is greater than the skill.castRange that it does not cast the skill. From what I understand this happens because at times, the monster position is not synced on client and server.

To Reproduce

Expected behavior Utils.ClosestDistance(caster.collider, caster.target.collider) in skill.CheckDistance() should be the same value for both the client and server so that CheckDistance() will pass conditions on both the server and client

Screenshots/Video image (left is client, right is server value of Utils.ClosestDistance(caster.collider, caster.target.collider))

System (please complete the following information):

miwarnec commented 4 years ago

this happens because we use the collider distances. the colliders are on the hips, and affected by animations. sometimes, animations are happening at different times on server and client, hence different positions.

I have a few ideas around this problem. will keep you updated.

miwarnec commented 4 years ago

fixed in V1.184: https://gyazo.com/f308e50115185db5cf576a55b2a76dff