FilUnderscore / ImprovedHordes

7 Days To Die Server/Client Mod - Improves existing hordes by reworking their core behaviours.
https://community.7daystodie.com/topic/26781-improved-hordes/
Other
8 stars 3 forks source link

Hordes just standing around and only moving when player approaches close enough #30

Open DOA2021 opened 7 months ago

DOA2021 commented 7 months ago

I am running the current version of improved hordes on a dedicated server and I noticed the following behavior from some hordes. The horde just stands around and the only way to get them to move is to approach them close enough. The closest one will then activate and begin approaching you if others are within some form of activation radius they will activate after a short pause as well. Zombies that are further away will not activate until you also approach them close enough. Animal Hordes do not seem to have the same problem. I saw wolf packs and chicken flocks moving around.

At first I thought it might be redbeardt's path smoothing mod causing the issue but the error occurs even when I remove the path smoothing mod.

I was doing additional testing and it seems almost as if the zombies are sleeping until you approach close enough.

An additional thing I noticed is it is possible in debug mode to determine which zombies are controlled by the standard AI and which by the IH AI. The Invisible command does not work on the zombies controlled by the IH AI.

FilUnderscore commented 7 months ago

Thanks for the report.

Off the top of my head, this could be related to the "sleeping hordes" functionality that does have similar behavior as you've described (zombies waking up when you get close). Hordes will enter sleep mode after a determined amount of time as part of their AI cycle, waking up when enough time has passed.

The bug seems to be that the zombies spawn later than expected and don't get the sleeping pose command, which leads them to remain standing but still acting as though they are sleeping. Only the zombie hordes do this, so the animal hordes wouldn't be affected as they don't have this behavior programmed into their AI (the IH AI). As for the waking up behavior, it could be improved such that when one zombie wakes up, the rest nearby wake up triggering a domino-like effect.

Regarding your last point about the IH AI detecting invisible players, I have run into this issue in the past and fixed it, though it looks like it hasn't properly been fixed if you're running into it.

DOA2021 commented 7 months ago

What would happen if you added in an option in the config files to not allow the sleep mode. That way an admin could decide if the hordes never sleep or not. If they never sleep then the zombies spawning later not getting the sleeping pose command would not be an issue.

Alternatively perhaps a loop in the AI that periodically checks if there are zombies are in sleep mode and then reissues the sleep command. I realize that is sloppier programming because it does not solve the issue of the command never arriving when a zombie initially spawns, but it might be a workaround.

The rest of the zombies waking up when one wakes up is also a good idea. I admit this is what I thought would happen if I attacked a zombie from a horde. That all zombies in that horde would react. One for all and all for one :)

FilUnderscore commented 7 months ago

What would happen if you added in an option in the config files to not allow the sleep mode. That way an admin could decide if the hordes never sleep or not. If they never sleep then the zombies spawning later not getting the sleeping pose command would not be an issue.

This could work as a temporary workaround for this issue. There is a planned feature where you will be able to customize the horde AI using a list of commands, similar to how vanilla allows you to use the AITask properties on entities, where you would be able to control whether hordes sleep, what hordes can choose to investigate, etc. This feature requires a slight overhaul to how AI is currently handled, but it is something I am continuing to look into.