mcmonkeyprojects / Sentinel

Combat NPCs for Spigot!
MIT License
168 stars 84 forks source link

Sentinels don't know what to do in water, 2 #262

Closed Ferocimo closed 6 years ago

Ferocimo commented 6 years ago

Versions : http://www.noelshack.com/2018-35-7-1535896700-2018-09-02-15-57-11.png

Hello,

I'm opening a new issue on this because updating the old ones would be really messy considering all the referencing I'm gonna have to do.

So, basically our issue is this :

With Citizens' new-finder set to true, we have massive lags, related to this issue : https://github.com/CitizensDev/Citizens2/issues/1561 With Citizens' new-finder set to false, we have this issue : https://github.com/mcmonkey4eva/Sentinel/issues/201

We initially thought that all bugs related to pathfinding in water were solved with latest builds of Citizens, like I said here : https://github.com/CitizensDev/Citizens2/issues/1298#event-1526568800

But actually, the pathfinding is still buggy with new-finder false, with Sentinel specifically. Indeed, with new-finder set to false, the pathfinding of NPCs in water is not perfect, but it works, however a Sentinel doesn't know what to do at all. Example : https://cdn-b-east.streamable.com/video/mp4/09th7.mp4?token=1ZLxLUEa_yfP1wTX80dz-Q&expires=1535903793 On this set-up, at the beggining the player in the back is in Creative, so the Sentinel ignores him and does its normal path from point A to point B in water. It's a bit messy, but it works. But, later in the clip, the player removes his Creative mode : as soon as the Sentinel pathfinding takes over to reach its new target, the NPC doesn't move anymore. This is why we believe this is a bug of Sentinel, or at least a bad compatibility between Sentinel and Citizens : a normal Citizen manages to move in water, while a Sentinel can't.

Now, let's see what happens with new-finder set to true : https://cdn-b-east.streamable.com/video/mp4/8mydp.mp4?token=XtRhe2B561HHcmNsTkKuww&expires=1535904342 As you can see everything works fine. BUT, new-finder causes the massive lag issue referenced higher up.

So, one of this two issues should be fixed somehow. What do you think should be done on that matter ?

mcmonkey4eva commented 6 years ago

Build DEV-185+ from http://ci.citizensnpcs.co/job/Sentinel/ contains a potential solution for this.

New config option workaround entity chase pathfinder can be set to true to test the solution idea.

My idea of what might be going wrong is: Pathfinding normally tells the Citizens navigation system to go to a location. Sentinel NPCs going to attack an enemy tells the Citizens navigation system to go to an entity. It's possible that the Citizens navigation system does not quite properly interact with the Minecraft pathfinder ('new-finder false') in this case, and that's the issue. The config option will treat the target as a continually updating location target.

I used to have this as just the way Sentinel worked (run towards a location) but that caused some weirdness (the NPC regularly trying to turn around and run back to their path point while in combat). If it's confirmed to be a fix we can move towards getting the specific issue patched in Citizens so that the workaround can be turned off again.

Ferocimo commented 6 years ago

It does work indeed ! We turned off new-finder. I hope new-finder will be fixed some day though, because it's a lot smoother. But for now it works, it's all that we asked, thanks.