
Power Out it a Horror-Stealth game developed in Unreal Engine in July 2025 as part of a 48-hour game jam
AI Enemy



I utilized a behavior tree to handle the three different states of the AI: chasing, investigating and patrolling (passive). The tasks within each sequence drive the main behaviors of the enemy within each of those states.
Patrolling
During the patrolling/passive state, the enemy follows along a set route. Nothing about this path will change except the direction the enemy goes once it reaches the end (it turns around and goes back the way it came). The only time the AI will deviate from this path is if it sees the player or hears it pick up bread.


Investigating
The investigating state is triggered when the player picks up bread within the enemy's hearing radius, which will cause it to target the location of the sound and move toward it. If the AI doesn't see the player, then it will wait 1.5 seconds before returning to its path. If the player is within the enemy's line of sight, the chase state with be triggered.
Chasing
The chase state is triggered when the AI sees the player and can be triggered from both the patrolling and investigating states. Once the chase state is triggered, the enemy will target the player non-stop until the player is either caught or collects all the bread.




The AI enemy class uses enumerators and blackboard keys to control the switching of states.

The "Can Sense Actor" function allows the enemy to detect the player through sight and sound by setting up it's perception senses.


Separate functions handle the detection of sight and sound and sets their respective states based on the perception of the player.
Reflection
During this project I learned a ton about creating AI in Unreal Engine using behavior trees. Due to the limited time frame of this jam, I had to manage my time and prioritize certain aspect of development so that I would have enough time to test. I think this helped me a lot with my rapid prototyping skills, since I was able to develop ideas quickly and abandon things that didn't work.