namreeb / namigator

An intelligent navigation API for World of Warcraft Alpha, Vanilla, TBC and WotLK
MIT License
49 stars 32 forks source link

Correct behavior over hills #29

Open namreeb opened 2 years ago

namreeb commented 2 years ago

When pathfinding over hilly ADT terrain free from obstacles, we likely need intermediate points on the path to give the unit proper elevation along the way.

namreeb commented 2 years ago

The below log from classic TBC shows that intermediate points for Z correction ARE needed. Note that the 0.25 increments in the delta Z values are due to spline point packing, and not indicative of a pattern in the Z correction.

Map: 0 Position: X: -8722.004 Y: -164.2404 Z: 85.61569
(MovementMonsterSpline) Id: 44015187
(MovementMonsterSpline) Destination: X: 0 Y: 0 Z: 0
(MovementMonsterSpline) CrzTeleport: False
(MovementMonsterSpline) StopDistanceTolerance: 0
(MovementMonsterSpline) (MovementSpline) Flags: 18874368 (CanSwim, Unknown5)
(MovementMonsterSpline) (MovementSpline) Elapsed: 0
(MovementMonsterSpline) (MovementSpline) MoveTime: 7835
(MovementMonsterSpline) (MovementSpline) FadeObjectTime: 0
(MovementMonsterSpline) (MovementSpline) Mode: 0
(MovementMonsterSpline) (MovementSpline) TransportGUID: Full: 0x0
(MovementMonsterSpline) (MovementSpline) VehicleSeat: -1
(MovementMonsterSpline) (MovementSpline) Face: 2 (Target)
(MovementMonsterSpline) (MovementSpline) PointsCount: 1
(MovementMonsterSpline) (MovementSpline) VehicleExitVoluntary: False
(MovementMonsterSpline) (MovementSpline) Interpolate: False
(MovementMonsterSpline) (MovementSpline) PackedDeltasCount: 31
(MovementMonsterSpline) (MovementSpline) HasSplineFilter: False
(MovementMonsterSpline) (MovementSpline) HasSpellEffectExtraData: False
(MovementMonsterSpline) (MovementSpline) HasJumpExtraData: False
(MovementMonsterSpline) (MovementSpline) FaceDirection: 0
(MovementMonsterSpline) (MovementSpline) FacingGUID: <redacted>
(MovementMonsterSpline) (MovementSpline) [0] Points: X: -8703.304 Y: -197.8098 Z: 91.31413
(MovementMonsterSpline) (MovementSpline) [0] WayPoints: X: -8721.154 Y: -165.0251 Z: 86.2149
(MovementMonsterSpline) (MovementSpline) [1] WayPoints: X: -8720.904 Y: -166.0251 Z: 86.4649 delta z = 0.25
(MovementMonsterSpline) (MovementSpline) [2] WayPoints: X: -8720.404 Y: -166.7751 Z: 86.9649 delta z = 0.5
(MovementMonsterSpline) (MovementSpline) [3] WayPoints: X: -8719.404 Y: -168.5251 Z: 87.9649 delta z = 1.0
(MovementMonsterSpline) (MovementSpline) [4] WayPoints: X: -8718.904 Y: -169.5251 Z: 88.4649 delta z = 0.5
(MovementMonsterSpline) (MovementSpline) [5] WayPoints: X: -8718.404 Y: -170.2751 Z: 89.4649 delta z = 1.0
(MovementMonsterSpline) (MovementSpline) [6] WayPoints: X: -8717.904 Y: -171.2751 Z: 90.2149 delta z = 0.75
(MovementMonsterSpline) (MovementSpline) [7] WayPoints: X: -8717.404 Y: -172.0251 Z: 91.4649 delta z = 1.25
(MovementMonsterSpline) (MovementSpline) [8] WayPoints: X: -8716.904 Y: -173.0251 Z: 91.9649 delta z = 0.5
(MovementMonsterSpline) (MovementSpline) [9] WayPoints: X: -8716.404 Y: -173.7751 Z: 92.4649 delta z = 0.5
(MovementMonsterSpline) (MovementSpline) [10] WayPoints: X: -8715.904 Y: -174.7751 Z: 92.9649 delta z = 0.5
(MovementMonsterSpline) (MovementSpline) [11] WayPoints: X: -8715.404 Y: -175.5251 Z: 93.4649 delta z = 0.5
(MovementMonsterSpline) (MovementSpline) [12] WayPoints: X: -8714.904 Y: -176.5251 Z: 94.2149 delta z = 0.75
(MovementMonsterSpline) (MovementSpline) [13] WayPoints: X: -8714.404 Y: -177.2751 Z: 94.7149 delta z = 0.5
(MovementMonsterSpline) (MovementSpline) [14] WayPoints: X: -8713.904 Y: -178.2751 Z: 96.4649 delta z = 1.75
(MovementMonsterSpline) (MovementSpline) [15] WayPoints: X: -8712.904 Y: -180.0251 Z: 98.2149
(MovementMonsterSpline) (MovementSpline) [16] WayPoints: X: -8712.654 Y: -180.7751 Z: 98.7149
(MovementMonsterSpline) (MovementSpline) [17] WayPoints: X: -8712.154 Y: -181.5251 Z: 99.7149
(MovementMonsterSpline) (MovementSpline) [18] WayPoints: X: -8711.904 Y: -182.2751 Z: 99.9649
(MovementMonsterSpline) (MovementSpline) [19] WayPoints: X: -8711.404 Y: -183.2751 Z: 100.2149
(MovementMonsterSpline) (MovementSpline) [20] WayPoints: X: -8709.904 Y: -185.7751 Z: 99.9649
(MovementMonsterSpline) (MovementSpline) [21] WayPoints: X: -8708.904 Y: -187.5251 Z: 99.2149
(MovementMonsterSpline) (MovementSpline) [22] WayPoints: X: -8708.404 Y: -188.5251 Z: 98.4649
(MovementMonsterSpline) (MovementSpline) [23] WayPoints: X: -8707.904 Y: -189.2751 Z: 98.7149
(MovementMonsterSpline) (MovementSpline) [24] WayPoints: X: -8707.404 Y: -190.2751 Z: 97.9649
(MovementMonsterSpline) (MovementSpline) [25] WayPoints: X: -8706.904 Y: -191.0251 Z: 97.2149
(MovementMonsterSpline) (MovementSpline) [26] WayPoints: X: -8706.404 Y: -192.0251 Z: 96.2149
(MovementMonsterSpline) (MovementSpline) [27] WayPoints: X: -8705.904 Y: -192.7751 Z: 94.7149
(MovementMonsterSpline) (MovementSpline) [28] WayPoints: X: -8705.404 Y: -193.7751 Z: 93.4649
(MovementMonsterSpline) (MovementSpline) [29] WayPoints: X: -8704.904 Y: -194.5251 Z: 92.4649
(MovementMonsterSpline) (MovementSpline) [30] WayPoints: X: -8703.904 Y: -196.2751 Z: 91.7149
pikdum commented 2 months ago

Could this be what occasionally causes these issues near hills?

https://github.com/user-attachments/assets/6fc8a4c0-88e0-452b-8497-9ceee434f464

https://github.com/user-attachments/assets/e1d7f1ef-9091-45d5-abbd-b18f79730bf7

devw4r commented 2 months ago

Could this be what occasionally causes these issues near hills?

No, that seems to be a wrong implementation of movement/spline handling server-side.

pikdum commented 2 months ago

Yeah, that's very possible. I couldn't figure out how splines work, so I'm doing movement one point at a time right now. Basically using namigator to get a path, then looping through it to move to every point in order.

devw4r commented 2 months ago

We also do one point at a time except for taxi flights. Im not sure if you are updating the spline server side but once you trigger a monster move command you need to also update/sync the spline server side in order to keep the mob position updated so the next point you use starts from the last position of previous spline. You will probably need to implement some in-game visual helper like leaving a trail for movement, that way you can tell if you're synced with the spline the client is executing.

https://streamable.com/73spub

pikdum commented 2 months ago

Yeah, I'm doing some basic syncing for each point in a path. No issues with having mobs walk properly around obstacles, at least.

I've really only noticed weirdness rarely on hills and in cities. I'll have to test more to see what exactly is going on - adding a visual helper is a good idea.