I’m looking to find out how I could make an AI who is searching for the player intelligently find the room the player is hiding in, and open that door. Right now I have a setup where the AI will randomly patrol and as he passes door triggers, the doors will open, however this breaks the realism, as the AI wouldn’t just open every door as he walked by- how can I get an AI to store the last seen location of a player and if any doors are within a range of that location, have him stop and open the door?
I’m probably asking for too much at once- how about this, how could I simply make the AI stop at a random door (mabye a one in 10 chance of him stopping each time he passes a trigger), and then open it in sync with an animation? The main game I am referencing is Outlast- if a player hides in a room, the AI will usually come and smash the door down, but they always come to the right room, and the animations are all synced up nicely.
Idea: Drop a marker at the last seen location of the Player and when the AI is within range of the marker, have it run a scan for any available doors in the area. Usually the marker would be right near a door if the AI was able to see the Player at its last known location. Then you can have it open the closest door to the marker (the door most likely to hide the Player).
Think of it like you were the AI and you caught a glimpse of the Player for a second before the Player vanished further down the hallway you are in. If the hallway was lined with side-to-side with doors or if it had 3 doors in it, you would still have a general idea of the location where you last saw the Player. You don’t have the ability to just drop a marker where you last saw the Player, but you do have the ability to judge approximate distance and recognize landmarks. That same process would require quite some coding in AI, but dropping a marker is an easy thing to do in virtual environments.
Awesome idea, thanks for the reply! Definitely seems like a logical option to drop a marker (the AI perception node does have a lose sight radius but I’m not sure how to take advantage of that, as there doesn’t seem to be much documentation up right now, so I may just do everything through blueprint logic (custom timer every .5 seconds- if canseeplayer bool is false then call the search event).
EQS could then be used to find the best scoring door in the area, or even a simple line trace in the area, returning all doors and opening the closest one to the last seen location.
Any ideas for making the AI intelligently open doors correctly? For example, if the AI currently sees me going into a room, it will follow, but if I close the door it just gets caught on the wall and will just glitch out right next to the door (assuming because it wants to go to my location, but the door is blocking the navmesh. I wonder if there is a way to get the AI to still succeed in getting to that point, and if any doors are in the way, have the AI correctly open them and move forward.
You could have a collision box on the door that detects for the AI and auto-opens the door if the AI enters its volume. AI usually bumps into where it wants to go, so the collision box does not have to extend too far from the door mesh.
also interested to this, what if there are a lot of doors, and a lot of passageways…
how can the ai “know” which door to open so it can proceed to its target destination…
especially if the doors blocks the nav mesh, therefore, any ai will never know that there is a path beyond the door…
if only they “know” when to open it…
i tried to make a trigger that opens any door any ai is near… but it looks bad…