First Playable - Containment

 

AI Navigation Pathways

Now this week as I said I in my previous blog I wanted to focus on getting the enemy AI in order and have it running with its code. I started off by adding a Nav Mesh Agent which gave the enemy ai basic understanding of the map and allowed it to move around without getting stuck on objects. I soon realised that it's no good having this feature if the AI isn’t even moving around or testing its environment and so I added an “Idle” and “Walk” state to the script which would check to see if the enemy was idle if so it would change that state to “walk” and grab a random position within the nav-mesh and send the ai there, once it reaches its destination it will set the state back to “idle” and the whole sequence repeats itself again. This gave the Enemy AI a nice patrolling feature which I think I will keep in my game.

After that came the hard part, adding a line of sight or a FOV like feature to the AI to allow the enemy to chase the player when it sees it. Now I looked up a few tutorials and had no luck, but I found a page on the wiki which showed how to add a new game object to the editor, a cone-like structure. I just designed the cone the way I wanted it and placed it in front of my AI. I made the cone a trigger and such whenever the player entered it, it would alert the AI by changing its state to “chase” and running the code to set the Ai’s nav mesh destination to the player's position, now I made the speed of the AI the same as the player but because the player can sprint, as long as they don’t overuse their sprint feature they should be able to get away from the monster. I plan on also adding in some hiding places like lockers and rooms to allow the player to hid in more locations.


Comments

Popular posts from this blog

An introduction to... me?

Game Design

Game Idea Research