Mech Mayhem

Watch the gameplay demonstration here on YouTube.

View the GitHub repository for this project here.


Game Overview

Mech Mayhem is a 3D tower defense game that uses Breadth First Search algorithm to find the shortest path. The project was made in Unity while learning an online course. The objective of the game is to survive the enemy attack for as long as possible.


BFS Path Finding

At the start of the game, the Pathfinder script will start from the beginning waypoint and search through all the other waypoints that are connected in a BFS algorithm style. This is not only to see if it's possible to reach the end, but find the quickest path to it. Once the quickest path is found, that will be the route the enemies will take to try and destroy your base.


Towers

A TowerFactory script is used to determine the maximum number of towers that can be placed at once. It will also either instantiate a new tower on the selected waypoint, providing that it's a legal move, or moves the longest existing tower to the new position. Before attacking, the tower will check for the closest enemy and will then start firing a particle emission towards the target.


Learning Experiences

Though I already had a very good understanding of searching algorithms such as path finding from various modules at University, it was good to be able to put it into practise in a Unity project.

Example coding areas involved:

  • BFS Path Finding
  • Lists
  • Ingame object moving
  • Weapons and ammos
  • Automatic weapon targeting
  • Particle systems
  • Grid Positions
  • Edit mode scripts