It Will Find You - Devlog 10: How It Hunts
It’s been a busy few weeks! I’ve gotten some light testing done, development continues, and the first trailer for It Will Find You was released! We also announced a release date, October 18th, and that the game will be available on Gamejolt, Itch and Steam.
If you haven’t seen it yet, check out the link below, I hope you enjoy your first glimpses of what It Will Find You has to offer.
At the end of the last devlog we had discussed the core AI of the monster and were ready to look at how its hunting process began to develop, so lets dive right in!
The first step was to give the monster the ability to see, so I created a trigger to act as a base for the monster’s vision using a cone. This gave the monster a wide and realistic area in front of it which, if entered, would trigger a ‘checksight’ function that could determine if the creature could see the player. The checks involved were designed to ensure that the creature could see the player directly, and that they were not hidden behind a wall or object, and so upon calling checksight a ray would be cast from the monster to the player. If the ray intersected any other objects before hitting the player, checksight would come back as false and the monster would be unable to see the player. If the ray hit the player, then the monster would enter its ‘hunting’ phase. If the player remained within the trigger, checksight would continue being called until either the player or monster left the area.
Entering into the hunting phase the creature sets the NMA (Nav Mesh Agent) destination as the player’s position and increases the NMA speed to allow it to catch up to the player that would now likely be on the run. A Vector3.Distance is then used to detect how far the creature is from the player. If the player manages to put enough distance between the creature and the themselves, the hunt is cancelled, and the creature returns to the idle state with a new alert function.
The alert function begins a countdown that determines how long the monster will now search for the player having made contact, with additional clues expanding the search time, and contact refreshing it completely. During this function the monster’s speed remains slightly higher than average, and it sets it’s NMA destination points based around a random unit sphere centred on the player, so as to mimic the action of tracking.
If the player does not manage to escape, and the distance between both objects is small enough, the creature triggers an attack. To do this he first disables the players character controller so they cannot move, then triggers the camera animator to Slerp to a predesignated kill point attached to the monster. A specific animation is then selected based on the player’s current health, and an animation for both the player camera and the creature would then play, lowering the players health in the process.
Once the animation is complete, the monster directs the player camera to reset, and enters a “Gloating” state where it cannot attack, and essentially rests for 8 seconds before making its next move, allowing the player to escape. Initially this gloating phase did not exist, but escaping the creature became too difficult and he would often take 3 levels of health in short succession causing game over. Introducing the cooldown period also improved realism, as it matched the earlier mentioned behaviour of an apex predator, with the creature landing a blow, then letting its prey run itself out while it stalked them from a distance, making the kill easier.
The AI could now navigate by itself and was capable of catching and killing the player to a limited degree. This became a solid foundation upon which I could develop more advanced behaviour, turning the creature from a simple robot into a more living, breathing predator with its own intelligence which would add to the immersive, and realistic quality of the game.
So that’s where we’ll stop for this week, I hope you found that somewhat informative.
Tune in next week for more discussion on the AI, and the additional layers that were created to make its behaviour more natural.
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 itch.io to leave a comment.