Programmer
Platform:
Windows PC
Language:
C#
Tools Used:
Unity, Visual Studio
Completion:
September 2017
Team Size:
3 programmers
Colonistadors
A top-down city building / tower defense game built with C# in the Unity engine by a team of programmers over a summer.

This game involves gathering resources and building a settlement during the day, and then defending the settlement from enemies at night. The premise is that a space colony crashes on an unknown planet, and the survivors must repair their ship to escape. The resources are scattered across a randomly generated map, so the placement of buildings must be carefully considered. The game will end in victory when the player has enough materials to repair the main HQ building (ship), or in defeat if the HQ is destroyed.
This game was created over a summer with 2 other programmers, with the goal being to expand our knowledge before the next year of university started. At the time I was unsure of which aspect of programming I wanted to specialize in, and so took this opportunity to explore these aspects. Because of this, I focused on programming the UI, as well as the AI of the game.
Enemy AI
The enemy AI underwent many changes as the the game itself changed throughout development. Originally, the enemies would be separated into small groups or swarms, where every enemy in the swarm would behave the same. The enemies themselves would handle moving to a target and dealing damage, and a separate swarm manager class would determine and provide the optimal target for attack. This method would have potentially been more efficient as the checking of buildings would only have to be done once with the manager class, rather than each enemy individually checking buildings. This would have allowed for a very large amount of enemies and was tested with hundreds of enemies active at a time, and was ultimately deemed unnecessary when we decided to have less enemies.
In the final version, upon receiving a spawn wave event, an Enemy Wave Spawner class will create and place a number of enemies in random locations around the edge of the map. The spawner class contains a list of buildings (updated through events when buildings are built or destroyed) and functions that take an enemies location and return the nearest building to it. In this way only 1 object is searching for and storing building locations, with the other enemy classes using that list. The enemies themselves are fairly basic, only containing variables representing statistics like movement speed and functions for moving to their current target by setting the navmesh agent's destination.



UI
During game play the player would receive quests that would guide the player step by step to completing the game. Starting quests that were essentially tutorials would teach the player what different resources and buildings do, for example, and later quests represented larger goals that would lead to repairing the main ship. Some quests follow on from each other, some started when certain conditions met and some started randomly.
A quest first appears as a pop up box that gives a some story background for the quest as well as the objectives and rewards. This box will close if a button is pressed or if the player clicks off it. Once closed the quest is added to a quest bar that displays the quest name and objective, and can be clicked on to reopen the full quest details. The quest bar itself can be scrolled through to allow for an infinite number of quests to be stored. This was done by using a scrollrect component with a scrollbar component to store the quests in, and using a mask component to confine the list to within the space of a panel. A similar setup was used for the building menus that would store buttons to build the various buildings.


Reflections
Overall I feel that the project went quite well, and feel that I achieved my goal of learning about other aspects of programming. However there are many things I would do differently knowing what I do now, for example the enemy setup that was used did not allow for different types of enemies that would have different priorities when targeting buildings. There were also some problems with the navmesh itself as the version of unity used for the project did not all for changing the navmesh at run-time. Buildings placed had to be set as navmesh obstacles which meant enemies would not move around the buildings naturally.
I feel if I were to work on this project again, I would rather restart it using the unreal engine with which I have much more experience working with AI from working on Manny the Manx.