AI Behavior Tree
An AI written to survive as long as possible in a zombie apocalypse. I created it using a behavior tree.
It survives by finding food, health, and weapons and storing them in inventory or remembering where he left them.
When needed it will consume the pickups or fire the weapons at zombies. It decides whether to attack on several factors such as ammo remaining in the gun, how many zombies are attacking him and more.
This project allowed me to deepen my knowledge of NPC AI systems such as behavior state and behavior tree systems. It was a great learning experience.
Some code snippets
This section of code display how the AI decides if he would hit his target or miss. The AI is build very defensively so it will only do this check if only 1 enemy is in range.
This is were the AI picks up all items in range and decides what to do with it. To destroy, add to inventory, or remember where it is if the inventory is full.