zapzombies / zap-community

This is a public repository used for keeping track of bugs, suggestions, and general information (see the wiki for more). If you really like our project and want to support us, see our Patreon page: https://www.patreon.com/zapzombies
GNU General Public License v3.0
1 stars 0 forks source link

Retargeting is too slow #38

Closed ghost closed 3 years ago

ghost commented 3 years ago

Describe the bug (I don't know if this should be reported as a feature req or bug) Retargeting is "zz slow" as Josh would say.

Where did the bug occur Hades' Dominion

To Reproduce

  1. Play with more than one person
  2. Have a mob target them
  3. Have them run past you
  4. The mob will continue chasing them for a couple of seconds

Expected behavior Mob should've retargeted in a shorter time-frame

Additional context Had an incident just now where mob ignored the closest player for some unknown reason.

Steanky commented 3 years ago

This is necessary for performance reasons, unfortunately. After I implement (clean) path merging at some point in the future I can "fix" this.

Also, fun fact: it isn't that mobs are retargeting every few seconds. They actually retarget twice per SECOND, because the actual target selection algorithm is basically free. However, their path isn't updated until after a certain delay, which is dependent on several factors (a constant delay + a slight random delay + the number of nodes in the previous path). This lessens massive CPU spikes on rounds with 70+ mobs that spawn far away from the player.

Steanky commented 3 years ago

I take it back — read over the code again and there's something I can maybe do to improve it.

Steanky commented 3 years ago

Likely fixed or at least improved now, so I will close (feel free to reopen if it turns out it's not actually fixed)