Continuing from my last post, I added the minotaur to the maze, focusing on rebuilding its AI and improving its behavior from the original project.
The original AI code was made using a state machine. It got the job done, but as the requirements grew, so did the number of states and their complexity.
For this project, I’m using Behavior Trees instead to drive the Minotaur’s actions and reduce the amount of complexity.
I wanted to keep it simple, sticking to typical indie horror monster intelligence.
The minotaur will roam around the maze, moving from one dead-end to another, endlessly searching. When it sees the player, it will start chasing them, trying to hit them. If the player is unlucky, they die.
A set of sensors on the minotaur, each with different sensitivity, help detect the player and allow the behavior tree to react and make decisions. If the Minotaur sees the player, it will store that information so that the behavior tree can react. If the minotaur losses sight of the player, that information is updated so that the minotaur can decide what to do next.
The minotaur also has the ability to jump over pits. This is done using customized Off Mesh Links with Unity’s Navigation Mesh to help connect the gaps. Without them, the minotaur would fail to find a path around the maze.
The minotaur is not smart, but it’s menacing enough that when you run into it, you’ll want to change directions.
Since the major threat in this maze is the Minotaur, I wanted to make sure the player always knows it.
In the original project, there were only loud stomping footsteps that could be heard to emphasize the minotaur’s presence. It helped, but it wasn’t enough, especially if it was played without sound.
To make improvements, I added a camera shake to help communicate visually when the Minotaur’s nearby. Now when it’s near the player or chasing, the screen will shake, increasing in intensity as it gets closer.
The player isn’t completely defenseless. They can find rocks that they can use to throw at the minotaur’s head to temporarily stun him, creating an opportunity for the player to run away.
The rocks can also help keep track of paths that they may suspect to loop around. So it can be a useful tool or a defensive weapon.
But how you get these rocks I’ll write about in the next article, “Objectives”.