Gameplay AI

A survival AI made in a custom engine
The individual assignment was to write in C++, the AI behind the main character that was dropped in an environment filled with houses, containing items and crawling with wandering zombies. The teachers of Digital Arts & Entertainment provided an engine. However, the code of the provided custom engine was not available for the student. The goal was to make the AI survive as long as possible using a behavior tree and a blackboard. My AI wanders around looking for houses. Once found one, it goes inside and scans the house for any items, since they only spawn inside. If it finds an item it checks if it needs the item for its vital signs (hunger and health), if not it assigns the item to the predefined slot in its inventory. When encountering a zombie, it searches a gun in its inventory. If so, it shoots the zombie, if not it uses the flee behavior to run for its life.
This project was challenging because I had never created a behavior tree before. However, making the decision-structure of the AI character and the behaviors were exciting and it sparked my interest in AI.


Screenshots from the project.


Logic behind the code.


Code snippets.
Tagged in