Capstone Development Blog #1
Updated: Mar 8, 2022
What I've Done -
This semester I have primary been working on upgrading Achromatics Ai systems and implementing new Ai enemy's for our players to combat. Our Ai had a huge upgrade this semester due to the college purchasing us Opasives behavior Designer which brings the power of behavior trees to unity. Behavior trees provide a huge upgrade to Ai as it operates a lot nicer then the previous state machine and utilizes visual scripting with XNode allow designers to easily join in on the fun.
Originally, Implementation spanned two scripts, both totaling over 2000 lines of code, this is a snippet of the state machine.
This is a work in progress of the behavior tree, way easier to read and iterate also is spanned across multiple scripts spreading out the Ai's workload.
At the current moment only two of the Ai's previous states have been moved over to the new behavior tree system, pursue player within sight and search for player.
Purse Player -
Purse player is utilizing our FOV tool that was originally created to track players during QA test, logging locations of the level our player spend the most time in and what environment assets they spend the most time looking at.
The red cone is the player vision cone, this clip shows a Ai mannequin being stopped when it is scene by the player.
I repurposed this tool and attached it to the monster so now the tool passes a bool into the behavior tree of whether the player has been seen or not and if it has, the monster navmesh destination is updated to the players position.
-add gif of monster with fov tool
Search For Player -
Search for player currently works using custom made search nodes that the placed in random locations in the surrounding environment. The monster then moves to the location looking for the player and if not found moves to the next spawn node.
It begins draws a invisible circle around the monster with established values based on the monsters position
then finds random locations with that circle, checks to make sure the location is accessible to the monster via the navmesh, spawns the node at the location and adds the node to a list of spawned nodes
this process is then repeated until the desired amount of nodes are spawned, then it moves towards.
It starts by making sure the monster doesn't already have a path to a node, then it selects a random node in the list and set the monsters destination to that location.
if the monster already has a path to a node then it checks if the monster has reached the location, if they do, the node is destroyed and removed from the list of the tracked nodes. Finally we check if the there are no more nodes remaining only then do we return the task as success. Constantly retuning false for this task allows us to loop the task until we've reached all of the nodes.