CitizensDev / Citizens2

Citizens - the premier plugin and API for creating server-side NPCs in Minecraft.
https://citizensnpcs.co
Open Software License 3.0
589 stars 313 forks source link

Citizens pathfinding bug in water #1298

Closed Blamo27 closed 1 month ago

Blamo27 commented 7 years ago

Hello,

I'm just posting that : https://github.com/mcmonkey4eva/Sentinel/issues/201 Sentinel's author just replied that this is a Citizens bug.

Thanks.

Blamo27 commented 6 years ago

@mcmonkey4eva Any news ? :/

Midnight9746 commented 6 years ago

For me, citizens don't go anywhere in water, they just float there until the target comes back to land.

It could be a citizens bug, Try using /npc path and make an npc go through water, if it makes it. Then it's just the plugin's communication with each other.

You could try setting the sentinel npc to avoid water all together, so when it's target is in the water, it act like an enderman and walk around. Or maybe it's the range at which the npc chases you at. Try setting it higher to see if the npc would still try to go after you.

The close / range combat might be an issue, then again they could just be guarding you or walk on their own into this mess. So idk

Blamo27 commented 6 years ago

@Midnight9746 What's your Citizens version ?

Midnight9746 commented 6 years ago

Well my server is 1.12.2 and my Citizens version worked on 1.12.1, so it has to be the 1.12 version.

How are your npcs bugging out in the water? (I'm not adev but I could probably still help)

Blamo27 commented 6 years ago

/ver Citizens

Midnight9746 commented 6 years ago

It just says "2.0.22-snapshot (build 1487)"

Blamo27 commented 6 years ago

@mcmonkey4eva @fullwall Any news ?

fullwall commented 6 years ago

Latest build includes a fix for the Citizens pathfinder.

Blamo27 commented 6 years ago

@fullwall thanks ! 😄

Blamo27 commented 6 years ago

@fullwall I'm affraid it's still not working properly. NPCs still don't know how to move in water. Here is a video demonstrating how a NPC tries to move from point A to point B (both red wools) when there is water involved.

https://cf-e2.streamablevideo.com/video/mp4/106zp.mp4?token=1521239930-RSJF%2BX6mEihpkOgTRQCcdRWWIBOUi09ObIxU%2BXWPvGY%3D

fullwall commented 6 years ago

Can you try with debug-pathfinding turned on? Also you are using the new finder correct?

Blamo27 commented 6 years ago

@fullwall It does work with newfinder. However, we can't seem to use that config option with our save.yml, because it considerably destroys our server performance, causing this :

https://cf-e2.streamablevideo.com/video/mp4/rky95.mp4?token=1521294301-lHecoEkz1O4PlCDtL14PQujgS7srfeVuZ1K0LbdVsRc%3D

Do you know why does it do that ? It seems like newfinder is making a ton of calculations... Note : we have a very heavy save.yml, if this can have an effect on that (over a thousand NPCs).

Ferocimo commented 6 years ago

We did numerous testing, and it IS caused by the size of our save.yml. The more NPCs we have, the more time the server takes to make this kind of calculations after a restart : that means that, if we have less NPCs but still a lot, after let's say 20 seconds, the server will stop lagging and the NPCs will normally walk again. That isn't the case without new finder. This means we can't use new finder with too much NPCs. Do you know why ?

Midnight9746 commented 6 years ago

Sounds like it's telling all of them to pathfind. But it should only tell the ones in loaded chunks.

Edited: Please tell me that you did not edit the margin value that was originally set to 2. (It's under the new pathing) That causes NPCs to fail their pathfinding.

Blamo27 commented 6 years ago

@Midnight9746 We tried different configurations, and with the default configuration.

Midnight9746 commented 6 years ago

Ah, understood. Are you forcing chunks to be active anywhere? (Just trying to figure out if you're NPCs are facing lag more than anything. If they are calculating new paths when no one is near them.)

I have the new paths, but under about 500 NPCS, and they don't lag like that.

Ferocimo commented 6 years ago

I don't think we have anything specific forcing chunks to be active. I suspect the size itself of the save.yml file to be related to that issue (ours weighs over 9 mo).

Midnight9746 commented 6 years ago

My NPCs did the same walking movement, but it was being ran on my pc, with tons of plugins. Once I've removed those, and made sure to solve lag. They fixed themselves.

If you want, I could try loading your citizens save on my server (not on my pc) and figure out from there. Assuming they run as intended with like 76+ plugins, it might just be the spigot build or citizens build. In any case, I want to help you! :D (and I don't care for what citizens you have, just didn't want to run around a world spamming the create button lol).

Ferocimo commented 6 years ago

We actually managed to make it work in water without new-finder. In other terms, they now move normally in water, even without new-finder (which we don't want since it's lagging the server).

So, there's still that issue with new-finder, but it's not really a problem for us anymore. Thank you anyway for the help provided !

mcmonkey4eva commented 6 years ago

Update: per https://github.com/mcmonkey4eva/Sentinel/issues/262 it apparently works now with new-finder, but not with following an entity specifically (as in: setTarget(Entity) fails, but setTarget(Location) works.)

fullwall commented 1 year ago

Is this still an issue?

mcmonkey4eva commented 1 year ago

NPCs still are very bad at navigation in water. They seem to sometimes be able to get through, but very slowly.

fullwall commented 1 month ago

Tracking here https://github.com/CitizensDev/Citizens2/issues/2993