Tower Defense project

Jan 2015

I chose to make a Tower defense game for my school project during my video game development courses at CNAM. So the idea was to create a tower defense with a nice story that will fit in 3 months. The team was really small, only 2 students, so we decided to organize small meetings twice a week and some programming sessions on Skype on a regular basis.

The story

The player is the governor of small planet attached to a galactic empire ruled by an evil master. In the first part of the game you are serving your master and try to crush a revolt on your planet.
In the second part you will change side and fight for the rebels and in the last part of the game you try to defeat your old master.



I fisrt started to develop a basic flat map with a spawning point of cubes that followed a path and dissapeared when they reached their target. I used a pre instanciated pool of enemies instead of instantiating them on the fly because it saves a lot of performance. Then I jumped onto the creation of a tower and managed a single cube first then multiple cubes detection and destruction. In this part you have to be careful because another tower can destroy a current target of your tower. The system I wrote is based on events and each time a cube is destroyed an event is sent to the towers which will update their target lists.


There are 6 different towers in the game: the Laser tower, the canon tower, the ion tower, the missile tower, the teszang tower which is kind of a Tesla tower and the flame tower. Each have different behavior, effects, damage per second, firing rate and are more effective against shields or health. The idea here was to create the basis of a tower defense game. By introducing shields and different types of damage the player has to optimize his tower placement and upgrades which improves the user experience.

Tower defense towers


To create different waves composed of different enemies we had to create a generic system of wave management that can work with any number of ennemies. Each time a wave is destroyed we send another wave composed of a new set of enemies. Everything is configurable so we could balance the game easily during the final stage of development.


For the pathfinding we used a basic behavior tree from Rain, a plugin for Unity. Each enemy unit always go to the next waypoint as long as they are alive, if the unit is disabled (if it is dead or it reaches the target point) the waypoint is reset to the first waypoint.

Tower defense behavior tree


The GUI was made with the new GUI system in Unity. I decided to go for an retro game style to stay close to the subject of video game development courses.

Tower defense menu

Game Manager

I wrote a state machine to manage the pause, play, dialogue and menu states. It separates the code of each state that could be very different and optimize the performance because we do not have to go through each possibility during each frame. The game manager is a persistant singleton which means it won't be destroyed as we are changing from a scene to another in Unity. We also have other managers such as the level manager or the gui manager.


For the in-game dialogues, I wrote all the story using Twine and exported it and then parsed it in Unity to create a dialog system. I also used tags to trigger events in the game such as animations like a spaceship take-off, or camera movements over points of interest.

Tower defense dialog system screenshot


In order to balance the game we created indices to represent the power of a tower depending on its cost, range and dps but also we took care of balacing these indexes for each level as the game is getting harder as you reach the end.


Artworks 2D

I draw some artworks for the characters that appear during the dialogues. I tried to make them a little bit scary but the game theme is mostly funny.

Tower defense rebelsTower defense scientist

Level design

The level design experience was great. I decided to create a simple first map but the second and the last one are more complex because of multiple spawning points. The environment is changing from a level to another too and the 3D models used changed accordingly to reflect the new feel and environment.

Tower defense screenshot


Designing particles in Unity is fun and I really enjoyed creating them. I aslo used premade particles from the asset store.

Tower defense screenshot


Animating the spaceships and the destruction of some building was made within Unity. It really helps the storytelling and events such as the destruction of a building when you loose or fires spreading to other buildings as you let ennemies entering the city.

The result

It was my first exprience of dual coding on Unity and I really enjoyed it. I had a pretty good mark (19/20) for this project and I learned a lot by making a game from scratch until the release. I also want to thanks everyone who worked on the free assets we used and on the free songs. I also would like to thanks my teamate who worked with me during those coding nights.

Tower defense screenshot