Whilst developing AI for Underhell today, I ran into a rather amusing issue.
I walked into Terry’s Office / Saferoom and found that everyone was….dead!
It turns out that the Infected NPC that I had placed a few rooms earlier (the one that breaks the lever to a door after you leave the Butchery) had gone rogue. Since AI can open doors, the AI randomly wandered out of his room and into the Safe Room, which wasn’t locked either! Since he was able to open all the doors, he helped himself to a room full of enemies who have no weapons to defend themselves with. He slaughtered them all and wandered off, leaving me to find the massacre a few minutes later.
So to fix this, I’ve locked the door, however the Infected can still attempt to get in as they have no knowledge that the door can never be opened. I’ve added the missing logic for AI so that if doors are locked, they will abort the navigation and try to find another way in / just resume behaviour. I’ve shown a video of a basic version of this below working for human AI.
This should look better as the animations are tweaked, the AI moves / grabs the handle correctly and the AI has newer sounds added to say things like “Hey, who the hell locked this door?”
I also want to store this door knowledge on the AI so that a soldier in a squad will appear to be communicating this to the rest of the team, that way you won’t end up with a train of soldiers all trying to access the same door – which would look a little dumb considering they would all just stand and watch each one fail.
For the infected, I am working on adding some ‘rage’ type behaviour to the locked door, so that Infected will try to bash the door down but give up after x fruitless attempts.
I would also like to see if I can add a way where AI that is currently in a combat situation will attempt to kick open doors instead of just opening them, as I feel it will help with the urgency of the situation to see PMC soldiers kick doors down and start firing on you 🙂
Back to the original issue, to prevent AI from doing anything in the map before they are needed, I changed the Infected to spawn when only when required. This was done by use of a new editor actor which makes NPC’s for me. It doesn’t have much use yet other than to spawn certain classes of enemies, but it will expand in future to spawn them with weapons or from different types of infected (E.G Worker, Prison Guard, Inmate etc)
This NPC Maker will also track active spawned NPC’s in future, which Underhell makes use of to identify how intense music should become etc. I think this would work well but I haven’t started on a dynamic music system, so I’m just guessing here.
Thank you for reading!