Harakiri brought something to my attention the other day reminding me that our spawn position update routine is incomplete. I feel like we are pretty close to finalizing this area so it has stolen my attention from the line of sight revamp for now.
When the server wishes to let PCs know that a mob is on the move, the server sends out a spawn position update packet, which describes a mob's physical location in space (x, y and z coordinates), cardinal heading, velocity and deltas (x, y, z and heading). The deltas were not previously utilized for NPC movement because it appeared they were not necessary. The client exports the same packet with populated delta values to the server when the player moves, so we simply just pass this packet onto other clients in the zone, as we assumed the delta values were reserved for special PC movements (strafing, turning, jumping, etc.).
It did not occur to me until yesterday that the deltas are most likely responsible for describing a mob's movement in environments that affect velocity (e.g., ice and water). Surely enough, kiting an NPC in water produced a staggered path as the NPC was teleporting between locations as the client received additional updates. Introducing a second PC into the water produced a smooth, fluid path, which strongly suggests that in order to get NPCs to follow suit, we need to figure out how to calculate the delta values.
Early attempts to assign known, working delta values (those derived from PC movements) to NPC updates were unsuccessful. In fact, the only way I got NPCs to swim fluidly underwater is to assign them insanely high velocities, nearly twenty-fold their original. That may have been a decent fix if it were not for velocities capping at 128, which means faster NPCs (e.g., Shadow Men) would not be able to approach their true velocities under water.
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment