Hello again, it’s me Dennis here again! I hope you all had a merry Christmas and a happy new year! I’ve had a nice holiday but now it’s time to work again. I’ve already managed to get some nice things done.
Hiding
Like I said I would do last time, the player can now hide from the AI in hiding spots. At the moment it can only hide under tables. I used Anton’s interaction system so that the player can look at and interact with hiding spots which will initiate hiding. The player will firstly be taken away all controls and be dragged to the entry point. Then an animation will play for the player and the hiding spot if it requires one. When the player is inside the spot it can then press the interaction button again to exit it with another animation.
While inside a hiding spot, the player is no longer visible to the AI at all. The only way for the AI to spot the player is to search the hiding spot. If it does, the AI will play another animation for searching that drags the player out. If the AI actually see that the player is about to enter a hiding spot, it will know that the player is inside and will search it.
AI and doors
We’ve had doors in the game for some time now, but the AI hasn’t known how to handle them before. There had to be some tweaking for the door so that it can handle stuff for the AI.
The most basic part that needed to be done was that it should open when the AI attempts to go through it. There already existed two trigger boxes for each side of the door so it can open to both sides, so I used them to detect if the AI is close to the door. When the AI enters one of the boxes the door will try to open if it can. One problem with this is that the door could open even if the AI doesn’t actually want to go through it, it just needs to be close enough.
Doors can be locked so the AI needed to know when they are and handle it correctly. Most importantly, the navigation mesh needed to be blocked while the door is locked. To solve this, I added a small and thin collision block inside the door that is activated only when the door is locked. This is the only collision box of the door that ignores all other collisions and blocks the nav mesh. Se differences between locked and unlocked below.
There might be room nodes inside locked rooms, so the AI need know that it shouldn’t go to it. To solve this, I added a check in the system that finds the next path node to go to. If the room node has a door that can block it and if that door is locked, the AI will choose to go to that nodes next node instead.
The biggest problem for the doors was when the AI hears a sound inside a locked room. I couldn’t come up with any good way to prevent it from trying to enter that room. I couldn’t do it the same way as the room nodes since they are set in the level beforehand so we can control which doors blocks which rooms. What the AI actually does when it hears a noise inside a locked room is that it tries to get to that point as close as it can. This means that it hugs the wall until it can’t get any closer and the does what it would have done if it had reached that point. This is how Unreal Engine works, but I accept it for now. It doesn’t get stuck in the door at least, which it did until I added the nav mesh blocker.
What’s next?
The only remaining big feature of the AI is the fear of light. The AI should avoid being in light as much as possible and if it is exposed to it too much it will run away and cower in fear for a short while.
The AI character is still missing a real body that should look more human. Erik is currently working on it a model so it will hopefully be done soon. We will also have to make some new animations for attacking, searching etc.
I also need to do some tweaking to the systems of the AI. Our level designers, Erik and Max, needed some more options for the patrolling of the AI. They wanted a type of node that doesn’t do anything at all, just a point that the AI should go to. They also didn’t like that each room node required at least one search node.
Another tweak that we wanted is that the AI shouldn’t search hiding spots if it has no reason to. To solve this, I plan to implement some kind of suspiciousness to the AI. This means that the AI will only search spots if it has recently seen or heard the player. After a while the suspiciousness will be gone and no searches will be done.
I have already started work on some of these tweak but they are not ready yet. They will most likely be done by the next time I publish my next devlog. See you then!
0 comments