alpha-core icon indicating copy to clipboard operation
alpha-core copied to clipboard

[Core] Pathing involving water.

Open GizzleBizzle opened this issue 3 years ago • 2 comments

Describe the bug There are general pathfinding problems involving mob behaviour either being in water or moving from land to water (and vice versa)

First one is about fighting underwater. Instead of choosing the shortest possible way (green), mobs seem attatched to the bottom of the sea, trying to swim to the target, but being teleported back after some interval (red) pathing The mob doesn't have to be initially in water. I've managed to pull some crocolisks from the shore and they behave the same once they go underwater.

Funny thing I've noticed is that some types of mobs go into a limbo once they touch water. They theoretically reset, but most of the time do not reset their health to full. Mobs I could find near the shore, which are affected by this bug: Bluegill Murloc Bluegill Puddlejumper Mottled Raptor There are also mobs, which were unaffected by this, despite my best efforts: Cursed Sailor Giant Wetlands Crocolisk

Steps to reproduce First Bug

  1. Find a mob underwater.
  2. Pull the mob while being higher than the mob.

Second bug

  1. Pull above-mentioned mob from shore to water.

Expected behavior Mobs should travel to the target in a straight line, which is the fastest way and shouldn't evade while reaching water.

GizzleBizzle avatar Aug 31 '22 11:08 GizzleBizzle

What defines if a mob should be able to enter water or not is something called CreatureStaticFlags (also known as CreatureDifficultyFlags). There are two flags related to water movement:

AQUATIC = 262144  # Can only move in water.
AMPHIBIOUS = 524288  # Can enter water and walk on terrain.

These are the static flags for the mobs you mentioned (all are amphibious except the Mottled Raptor and the Bluegill Murloc:

+-------+--------------------------+--------------+
| entry | name                     | static_flags |
+-------+--------------------------+--------------+
|  1020 | Mottled Raptor           |           16 |
|  1024 | Bluegill Murloc          |         5449 |
|  1025 | Bluegill Puddlejumper    |    268959744 |
|  1157 | Cursed Sailor            |    268959744 |
|  2089 | Giant Wetlands Crocolisk |    268959760 |
+-------+--------------------------+--------------+

~~Interestingly enough, according to original data we have (these flags are stored in the WDB files) some murlocs CAN'T enter water at all (see Bluegill Murloc). The thing is that due to our database being a fork of the 1.2 VMaNGOS version, there are actually some mobs that CAN'T be in water but are currently spawned INSIDE the water (should probably despawn them?), creating some weird behaviors when pulled.~~ I really think Bluegill Murloc had wrong flags 5449: Mountable, Unkillable, Immune NPC, Sessile, No auto regen, Corpse raid, I changed them to match other amphibious murlocs in https://github.com/The-Alpha-Project/alpha-core/commit/e3266207692eb39b3d9eb4b0ed5d5c77c12d504a.

This is from 1.3 Patch notes:

World of Warcraft Client Patch 1.3.0 (2005-03-22)
- Most humanoids NPCs have gained the ability to swim.

More investigation might be needed regarding this... It's also possible that these mobs were just spawned near the shore.


Anyway, this Issue is still valid because there are actually pathing issues for mobs underwater as you noticed.

GrenderG avatar Aug 31 '22 11:08 GrenderG

For the record, in case anyone wants to double check everything.

Our current static flags values have been obtained like this, and applied on this order:

  1. Extracted from WoWD 2006 db. WoWD - 03.2006.zip
  2. Extracted from Kobold v3 db. KoboldServerLite.zip
  3. Extracted from SDB db. static_flags_sdb.zip
  4. Extracted from crfusion db. crfusion.zip
  5. Extracted from WoWD 2005 db. WoWD-2005.zip
  6. Extracted from all of our archived WDB files (they come right after the subname). https://github.com/The-Alpha-Project/WDB

Values are in the client itself (they are meant to be read from bottom to top): https://github.com/ratkosrb/ClientStrings/blob/5c8b8839189ef373aa67c1c3edfa1253c2943518/Strings.txt#L5711-L5731

GrenderG avatar Aug 31 '22 14:08 GrenderG