Jump to content
Sign in to follow this  
Erkor

waypoints break at a certain distance from the npc(?)

Recommended Posts

idk what causes it i imagine it's related to whether the npc can "see" the waypoint or not/if it de-renders for it, but if you make a waypoint system with a very high range, npcs will start jogging instead, and at some point just break entirely. idk what causes it but it seems similar to the formation issue, which makes me think that spline curves on waypoints might break at a certain distance? idk


[Gunmar] says: "I can't believe this 'Arahi' woman went down so fast. Storm my arse."

GUd5X5D.png

Spoiler

wye3c336bj4.jpg

spacer.pngspacer.pngspacer.pngspacer.png

Share this post


Link to post

YOU ARE INDEED CORRECT!!!!!

Here's the indepth explanation

WoW engine sends "MovementSpline" packet to broadcast where NPC walks to when you use default waypoint behaviour, that is, a delay of 0. This is not observed on delay of 10.

With example NPC of waypointing 100 yards north 3 times, then turn,, then come back south, the client receives

Points: X: 995 Y: 5 Z: 0
WayPoints: X: 1000 Y: 0 Z: 0
WayPoints: X: 1100 Y: 0 Z: 0
WayPoints: X: 1200 Y: 0 Z: 0
WayPoints: X: 788 Y: 0 Z: 0
WayPoints: X: 788 Y: 5 Z: 0
WayPoints: X: 1200 Y: 4.75 Z: 0
WayPoints: X: 1100 Y: 4.75 Z: 0
WayPoints: X: 1000 Y: 4.75 Z: 0

Obviously we expect to see X: 1300.

 

However, WoW Client is not receiving 'float' positions. It is receiving 'packed positions', which is storing X, Y and Z coordinates into 4 bytes. How is this accomplished?

packed |= ((int)(x / 0.25f) & 0x7FF);
packed |= ((int)(y / 0.25f) & 0x7FF) << 11;
packed |= ((int)(z / 0.25f) & 0x3FF) << 22;

The 0.25f = a granularity of 0.25. That means that's your smallest increment.

The 0x7FF is how many unique values are supported. It is 2048.

Multiply together and you get 2048*0.25 = 512.

 

Clearly there's a thing going on here, we should have 30k coordinates. What's going on is that the server is sending you the 'deltas' andtthen using the Points field to calculate the correct positions ahead of time. So, it's actually taking +5, +105, +205, +305, +305, +205, +105, +5, +0.

Looks like this:

m_positionX = 0.0285644531, m_positionY = -0.701850891, m_positionZ = 0.000503270887, m_orientation = 0
m_positionX = -2.93139648, m_positionY = -0.395553589, m_positionZ = 0.000503270887, m_orientation = 0
m_positionX = -102.961426, m_positionY = 9.15584564, m_positionZ = 0.000503270887, m_orientation = 0
m_positionX = -202.501465, m_positionY = 18.8446503, m_positionZ = 0.000503270887, m_orientation = 0
m_positionX = -302.981445, m_positionY = 18.1867447, m_positionZ = 0.000503270887, m_orientation = 0
m_positionX = -306.211426, m_positionY = 16.5373459, m_positionZ = 0.000503270887, m_orientation = 0
m_positionX = -302.841431, m_positionY = 16.7536469, m_positionZ = 0.000503270887, m_orientation = 0
m_positionX = -202.951416, m_positionY = 17.585144, m_positionZ = 0.000503270887, m_orientation = 0
m_positionX = -103.38147, m_positionY = 8.27894592, m_positionZ = 0.000503270887, m_orientation = 0
m_positionX = -3.88146973, m_positionY = -1.75905609, m_positionZ = 0.000503270887, m_orientation = 0}}}

Because of that, it needs to support negatives. This means that our unique values actually half from 0 to +512, to -256 to +256

 

305 is in excess of 256. How does it handle this? It overflows:

305-256 = 49

995 - 256 = 739

739 + 49 = 788

 

This cannot be fixed. You must simply not use the MovementSpline techonlogy when you are working with patrols that go beyond 256 yards from the original point.

OR, you can be clever, and put the npc at the midpoint between the waypoints.

 

When using a delay of 10, each packet explicitly sends the new position,

(MovementMonsterSpline) (MovementSpline) PointsCount: 1
(MovementMonsterSpline) (MovementSpline) [0] Points: X: 995 Y: 0 Z: 0
(MovementMonsterSpline) (MovementSpline) PointsCount: 1
(MovementMonsterSpline) (MovementSpline) [0] Points: X: 1000 Y: 0 Z: 0
(MovementMonsterSpline) (MovementSpline) PointsCount: 1
(MovementMonsterSpline) (MovementSpline) [0] Points: X: 1100 Y: 0 Z: 0
(MovementMonsterSpline) (MovementSpline) PointsCount: 1
(MovementMonsterSpline) (MovementSpline) [0] Points: X: 1200 Y: 0 Z: 0
(MovementMonsterSpline) (MovementSpline) PointsCount: 1
(MovementMonsterSpline) (MovementSpline) [0] Points: X: 1300 Y: 0 Z: 0

As Points contains full granularity and is not packed.

 

Share this post


Link to post

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  
  • Recently Browsing   0 members

    No registered users viewing this page.

×