It Will Find You - Devlog 9: Monster AI Part 1 - The Core

Hey Folks,

So continuing last weeks discussion on the monster, and how its AI developed, I thought today i'd discuss the initial AI loop that was created as a foundation for the monster, and which laid the groundwork for the system to expand and become more complex. As this was my first experience creating an AI that worked in 3D, it was very much a learning process for me, and hopefully discussing that journey can help anyone else that's interested.

Fair warning in advance, the next few devlogs will be somewhat technical : )

As a core element of both the narrative and gameplay, it was important to ensure the Monster felt like a living entity to the player, as oppose to a generic basic AI.

The foundation of this monsters brain is a string-based state system built around the Nav Mesh Agent, that allows the monster to cycle through different states depending on what scenario it finds itself in. These states can also be referenced and called by external scripts, allowing the Master Event System to influence the monster’s behaviour as a secondary AI brain. 

The initial AI paper prototype
At the core of this system was a Nav Mesh Agent (NMA) attached to the creature, with an adjustable radius and height that could be altered as development continued to ensure the creature had free mobility throughout all environments. The NMA would then have its behaviour determined by the string state machine or external factors like collisions and behave accordingly. This presented a good base to build the AI on, as the inbuilt tools of the NMA and Unity’s navigation system meant the creature could navigate the space consistently without too many additional calculations needing to be made to compensate for tight spaces, with the baked mesh often providing all the navigation detail needed.

With this in place I began to create the core cycle the monster would work through during its active phase whilst hunting. The idea was to have an AI loop that it would move through, step by step, whilst exploring its environment that could then be deviated from when exceptions, like contact with the player, occurred. This took the form of an idle phase, a movement phase and a search phase. In the idle phase the creature would pick a random point inside of a unit sphere centred on itself, then set this as the navigation point. The movement phase would then set the NMA speed so that the creature could begin walking towards the selected point, and upon arrival it would search the spot for the player, rotating 360 degrees before returning to idle, choosing another point and repeating the process if the player was not detected. This loop was a simple but effective base on which to begin expanding, and with the creature able to move, it was time to give it the ability to chase and catch the player. 

And that's where we'll leave it for this week, I hope this first insight into AI's basic foundation was interesting!

Tune in next week for more on the AI. and how it hunts the player,

Until then,


If you want to come discuss the game, have a general chat, or reminisce about Captive Audience, why not join our discord or Facebook pages, or follow us on twitter for more news!




Get Captive Audience

Leave a comment

Log in with to leave a comment.