AIs at Carcajou Games

Technical Designer

Summary

This project is part of my internship at Carcajou Games. I was tasked to create different types of AIs in the span of 2 months and document any ideas of behaviors they could have.

Monsters

I had to create 3 different types of monster behaviors to act as obstacles in the game. Some were more strategic (goblins), others more teamed up (spiders) and finaly some that would be more independant and would be revived after a certain amount of time when killed (skeletons). I also needed some of the monsters in the game to be able to communicate to each other, so I created a system that would centralize any information necessary to be shared in a team of monsters.

Humains

The last type of AI I had to create were humains. They all had the same behavior, but some had more powerful stats and could advance in specific regions. For that, I used NavigationFilters and assigned some regions for the AIs to start with so the stronger ones could start in more difficult areas.

Their behavior was kept simple for now. The goal was for them to loot until their max capacity was reached, then would deposit what they had. If there was ever a monster in their way, they would either run away or fight depending of the situation. If a bigger threat was present, they would hide and go out from time to time to see if it’s safe and start looting again.

Optimization

As I was creating the AIs, I kept the performance of the game in mind. And as soon as I realized that the game would need hundreds of AIs in a level, I had to find a quick solution because this many behavior trees will downgrade the performance of the game.

I used a plugin called NPCOptimizator in the Unreal Marketplace, but I noticed that it doesn’t work in a multiplayer game. I then started looking in the C++ code with the help of Jakob Bouchard. I had the opportunity to learn more about C++ and was able to have all the players included with the plugin.

With the component added to the AIs, instead of having about 15fps with 324 AIs in a room, I was able to get between 35 and 50 fps already.

Post-Mortem

I’ve learn a lot during my internship. I managed to create a system that could shared information between monsters in a team. I’ve had multiple challenges that I was able to overcome and although my AIs couldn’t be perfect, I’m still proud of how much I was able to accomplish in 2 months.