Connect with me on LinkedIn!
View my portfolio here!
This repo does not include all files to run the program. I do not provide included libraries. The program itself was run by a pre-build executable provided to us to avoid us looking at the zombie, loot and world code.
Once the program gets executed everything starts. The goal is to have the survivor survive for as long as possible while killing zombies. The Survivor does not know anything about the world, only what is in it's vision or nearby. The survivor has an inventory for food, water, weapons and ammo. After surviving for some time, "purge zones" can spawn in the world. The survivor rapidly loses health when in a purge zone.
I use a behavior tree with blackboard for the AI. AI movement is done using simple steering behaviors. It remembers where it has been, houses it has found and items it didn't pick up yet (saving the item for later).
The behavior tree can be found here. The implementation of each condition and action is here.
World (code)
The survivor explores the world by either going to an unexplored position near it or by wandering around. It remembers the path it has walked (including some extra distance around the path). When it can't find a valid position to go to (if the area around the survivor is already explored), it simply wanders around.
Houses (code)
When the survivor sees a house for the first time, it remembers it and goes inside it. It goes to the middle of the house and looks around for loot.
Loot (code)
When it sees loot, it checks if it needs it and either takes it or leaves it for later. If the survivor needs an item that it doesn't have (eg. extra health when hp is low), it goes to this item if it has seen the item before.
Zombies (code)
When the survivor sees and enemy, it checks whether it should attack or run away. If it has enough hp and a gun, it will attack, otherwise it runs away. If the survivor is bitten, it panics and sprints away. Sprinting uses stamina, so it can only sprint for so long.
Purge zone (code)
When the survivor sees a purge zone, it avoids it. If it is in a purge zone it goes out of it (or dies...).
The AI was almost a success, it successfully does everything I want it to do but dies faster than many of the other students' projects (oops). I learned a lot from it and am happy with the result.
For this project I used the Elite Engine framework, authors of this framework are Matthieu Delaere and Thomas Goussaert. Provided during the course.
Connect with me on LinkedIn!