Citizens2 icon indicating copy to clipboard operation
Citizens2 copied to clipboard

New finder over-explores when unable to find a path to target entity

Open hkkongou opened this issue 3 years ago • 9 comments

/version output

[18:17:38 INFO]: Checking version, please wait...
[18:17:39 INFO]: This server is running Paper version git-Paper-151 (MC: 1.18.1) (Implementing API version 1.18.1-R0.1-SNAPSHOT) (Git: 6663747)
You are 1 version(s) behind
Download the new version at: https://papermc.io/downloads
Previous version: git-Paper-407 (MC: 1.17.1)

/version Citizens output

[18:17:40 INFO]: Citizens version 2.0.29-SNAPSHOT (build 2448)
[18:17:40 INFO]: Website: http://www.citizensnpcs.co
[18:17:40 INFO]: Author: fullwall
[18:17:42 INFO]: [serveritem][give] Ha

Log file

https://paste.denizenscript.com/View/92230

config.yml

https://paste.denizenscript.com/View/92232

saves.yml

https://paste.denizenscript.com/View/92231

Profiler report

https://spark.lucko.me/rDZZKEsi3p

Description

using finder 1 is causing npc moving so strangely, so i used finder 2, but when i use finder 2, it have very serious lag spikes, you can see in the spark profiler.

hkkongou avatar Jan 15 '22 10:01 hkkongou

Can you show a picture of the path?

fullwall avatar Jan 15 '22 10:01 fullwall

Can you show a picture of the path?

the old one is like red and new one is like yellow image

attached 2 video

use-new-finder: false https://youtu.be/4_oxggWT-A0

use-new-finder: true https://youtu.be/4R2j_gL0-J8

the reason why i try to use new finder is because old finder move very abnormal, so i use new, but new is laggy

hkkongou avatar Jan 15 '22 12:01 hkkongou

Hm looks like you're flying and using NPC targeting which may account for some lag.

fullwall avatar Jan 15 '22 12:01 fullwall

Hm looks like you're flying and using NPC targeting which may account for some lag.

i am actually using sentinel guard

in the video ,indeed i was flying, but is the same when i walk on the ground, it just doesn't walk diagonally. (i have player tested , they can't fly)

hkkongou avatar Jan 15 '22 12:01 hkkongou

There are several config options in plugins/Citizens/config.yml that might help with pathfinding performance, notably:


npc:
  pathfinding:
    new-finder:
      iterations-per-tick: 5000
    maximum-new-pathfinder-iterations: 10000

tweaking those iteration counts to be lower counts to be lower can generally help with new finder performance.

Also, as you're using Sentinel, the Sentinel config option:

    # Whether to use Sentinel's entity chase pathfinder.
    # If set to 'false', will use the Citizens built-in one instead.
    workaround entity chase pathfinder: true

May be relevant. false might potentially have better performance, at the cost of the NPC being less effective at reaching and hitting the target.

mcmonkey4eva avatar Jan 17 '22 02:01 mcmonkey4eva

There are several config options in plugins/Citizens/config.yml that might help with pathfinding performance, notably:

npc:
  pathfinding:
    new-finder:
      iterations-per-tick: 5000
    maximum-new-pathfinder-iterations: 10000

tweaking those iteration counts to be lower counts to be lower can generally help with new finder performance.

Also, as you're using Sentinel, the Sentinel config option:

    # Whether to use Sentinel's entity chase pathfinder.
    # If set to 'false', will use the Citizens built-in one instead.
    workaround entity chase pathfinder: true

May be relevant. false might potentially have better performance, at the cost of the NPC being less effective at reaching and hitting the target.

thank you, i just tuned down those two citizen config and for the sentinel one is default false

i will see for some moment , thank you

hkkongou avatar Jan 17 '22 02:01 hkkongou

There are several config options in plugins/Citizens/config.yml that might help with pathfinding performance, notably:

npc:
  pathfinding:
    new-finder:
      iterations-per-tick: 5000
    maximum-new-pathfinder-iterations: 10000

tweaking those iteration counts to be lower counts to be lower can generally help with new finder performance.

Also, as you're using Sentinel, the Sentinel config option:

    # Whether to use Sentinel's entity chase pathfinder.
    # If set to 'false', will use the Citizens built-in one instead.
    workaround entity chase pathfinder: true

May be relevant. false might potentially have better performance, at the cost of the NPC being less effective at reaching and hitting the target.

hello i just changed to new finder with the settings you provided, however there are still lag spikes, previously can cause a 1000-2000ms spike from spark tickmonitor and now can do a 500-700 spike, which is still, not good as compare with old finder, which have no spikes at anytime, what should i do?

https://spark.lucko.me/ujwlSQYGsT

hkkongou avatar Jan 19 '22 13:01 hkkongou

image

https://spark.lucko.me/1WJUePvOfE

my tps just dropped to 1 with 30players , spark checked, is citizen lag

hkkongou avatar Jan 19 '22 13:01 hkkongou

I believe it's because the sentinel is unable to find a path to the player. There are mitigation strategies I need to implement for this; I have not done it yet.

fullwall avatar Jan 19 '22 16:01 fullwall