Besides other circumstances for my game where I need lots of NPC’s interactacting with each other, I’m having a very erratic behavior that is becoming so obvious that something is wrong (or maybe a setting that I haven’t changed that I don’t know of). Even though, I started to notice this behavior after I updated to the latest plyGame, but with a reserve that I haven’t been using this spell so can’t tell for sure… but I would have noticed it the first time I made it.
The spell is “Army of the dead”, and the player can point and click a location and there are created (instantiated) a bunch of NPC’s (ghouls) to fight for him. The number of ghouls increases depending on how many skill points you add to it. One point are 5 ghouls, two points are 10 ghouls, three points are 25 ghouls, four points are 30 ghouls… and so on, you get the idea.
For this specific situation, the ghouls are ordered to of course, spawn at the clicked location, and they will move until they reach an specific location (the center of the map). For that specific situation, the ghouls created have a “Request MoveTo” block in the “On AI Think” event. With this I can achieve that they will find a path to reach that location (using nav mesh agent), but at the same time if they find enemies on their way, they will engage and kill them and then they will continue on their way.
Since you can spawn them at any location/point, there’s not a path to follow because I want them to find the path because of the obstacles around (buildings, props, followers, etc). Anyway, the pathfinding is no issue. The erratic behavior begins when I increase the number of ghouls in the pack, and the problem is that the ghouls don’t detect the enemies and they pass by next to them and they don’t engage them. At times, the ghouls sort of “realize” there were enemies left behind and they sort of go back. But most of the time, they keep walking ignoring enemies and they reach the location and they simply stay there, not attacking enemies even when there are a lot of enemies around them. Here’s a description of what happens depending on the number of ghouls:
5 ghouls = Everything works fine. They detect and engage all enemies on their way (as long as they are on their detection radius, which is big enough. As soon as they kill the enemy they are engage with, they switch to the next enemy target and so on, until there are no enemies within the detection radius and then they continue to walk to the requested location/point.
10 ghouls = Everything works fine, sames as above.
15 ghouls = It begins to behave erratically. Some ghouls don’t detect the NPC’s but after a few seconds, they get back to them to attack and then back on their way. Sort of like if they were waiting more cycles to finally decide to detect the enemies.
25 ghouls = Completely fails. All the pack of ghouls walk by enemies even when the enemies are attacking them. The ghouls don’t seem to detect them at all. At times, some of the ghouls detect enemies, but usually they ignore the enemies and they keep walking until they reach the location and they simply stand there, with enemies around them shooting arrows at them but the ghouls don’t engage with them.
I have changed many things around the NPC controller in the hopes that it is configuration but nothing changes, nor for good nor to make it worse. But, using logic, if the behavior is because of a setting, it should act erratically with 5, 10, or N number of ghouls, but no, it only starts to break apart as I increase the number of ghouls. If I create a 50 ghoul pack, they attack none, like if they were the only ones in the map.
Many words, but here are some short videos, showing the odd behavior with 5, 15 and 25 ghouls. Also, the videos were taken looking at the scene, to be able to select the NPC’s to show you the radius to realize that they should be detecting enemies but they simply walk by instead.
Red cylinders = Ghouls. Melee attack, so you will see them getting next to the blue cylinders when attacking until the blue cylinder disappears (killed).
Blue cylinders = Archers (ranged, you will see yellow “projectiles/arrows” flying when they attack. Archers are wandering in a rectangular area.
You will see a greenish sphere at the center of the map, that’s the location the Ghouls must reach.
This is the video with 5 ghouls, everything works fine. The five ghouls wipe the area (the red cylinders kill all the blue cylinders).
This is the video with 15 ghouls. You can see how the Ghouls behavior (red cylinders) begins to be erratically, ignoring enemies even when they are in the detection radius and angle.
This is the video with 25 ghouls. You can notice that the ghouls (red cylinders) completely ignore the enemies and they simply stay in their pack not attacking anyone while they are being hit by arrows shot from the archers (blue cylinders).
Things I have changed to the NPC controller of the ghouls, but with no good results nor something different:
Wander Radius - Increased the radius way too big almost covering all map but no change (even when they are not staying, but they are walking to a location)
Idle times - Changed them up and down, from 1 second up to 20 but no difference.
Think interval - from very low to very high, no difference.
Detect interval - from very low to very high, no difference in terms of detection, only the higher the longer to detect, but lower didn’t solve the issue.
Can detect NPC’s - This seems obvious, it should be ON all the time, but changed it to OFF to see what happens and pretty much in 5 ghouls with this in OFF behaves exactly as when I add a 25 ghoul pack, they don’t detect enemies…
Skip if engaged - Switched on and off, no difference.
Engaged min/max distances - played with distances but no difference, unless the max distance is too small
Detection 360 distance, forward distance and forward angle - No difference… as you saw in the videos, the detection radius is big enough to catch enemies…
360/Forward obstacles - Made no difference if configured something or specifying “nothing”.