Damage Control (Custom engine C++)

Damage Control is a 3/4 base-defense twin stick shooter. When a deadly alien force wipes out the rest of his crew, a lone engineer must escape on his spaceship back to civilized space.

Reactor meltdown countdown

Download link: http://gameproject.fullsail.com/gpgames/index.php/2015/08/damage-control/

setting: Sci-Firender: Direct Xphysics: None
competition: AIsound: Wwiseinput: Windows

During the development the team had to design an original and playable game from scratch. The timelines were quite tight and the team was on a constant crunch working after hours. However, this is how the “real world” works – game developers work tirelessly to release amazing visual experiences. We developed our own engine from scratch and using C++

I was in charge of the AI pathfinding, enemy director implementation (explained below) and enemy design. We (as a team) decided using A* since it is the most optimal and widely used search algorithm. One of the biggest downside of this algorithm was the overhead and the need to evaluate all nodes. My biggest achievement was making the AI time complexity O(1) and lower the needed memory to store the paths. Long story short, after an extensive research on some of the best games and researching the magic of valve’s ReCast project (open source). Recast generates a navigation mesh on the fly from a level mesh. Fun fact is that there key functions are named as magic. I fell in love with this concept and I tried implementing something similar.

After a week of testing, I found out that I could get the same output and quality as A* if I pre-computed the cost of each node and creating a lookup table. Thankfully, our game had a static levels mesh; meaning that the levels wouldn’t change. Solving the paradigm of calculating the optimal path each frame improved the game runtime and system requirements. The AI agents were able to know where to go to catch the player in a simple way. The trick behind this was making the level’s “NavMesh” triangles as big as possible to make the movement more fluid (also called low poly count mesh). Finally, the movement logic was making the agent reach the goal’s triangle first going to the closest neighbor triangle using the lookup table. Once in the player’s triangle, the agent would face and follow the player.

It was a simple algorithm but it made the enemies smart enough to create a challenging experience.

The other big component that I worked on was the AI Director. Basically was a downscaled AI orchestrator similar from the game Left 4 dead – a masterpiece. Our goal was making a challenging experience adapting the game’s pace and intensity. We gave each action a weight on the heuristic:

Gameplay footage
  • Enemy types were valued between 2 and 8 points
  • Reactor damage had the highest value: 3x (note that the reactor was the only way to get a game over)
  • Engine damage had a 1x weight – only valid in campaign
  • Life support: 1.5x – if this system was down the player would lose health gradually.
  • Player’s health had a 0.75 weight

With these weights the director knew how many enemies could be spawned and the difficulty level. To make things a little more unexpected, we added a random seed for the enemy type. This made our survival mode the star – all players loved it due the challenging behavior.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.