Project: Racing

   Download | Source Code

Project: Racing is an arcade racer developed by myself and one other person in 16 days for a class project. The game is built on top of the concept of a procedurally generated racetrack that is built in front of the lead car. There are two game modes available in Project: Racing. The first is a sprint mode which is simply a race to the finish and the second is a survival mode where each player has three lives and the goal is to outlive their opponents. The players in survival mode are forced to progress by the threat of the tack being deleted from beneath them if they fall too far behind. 

The main focus of this project for me was to experiment more with procedural map generation and apply it to a genre it usually is not applied to. Additionally, this was the first time I was working with another person who developed the game in-engine with me. Before this my partners would usually create assets  outside of the engine and I would implement them. This new paradigm made me think more about how I could develop tools to aid in development and allow new content to be created with minimal code.

The track generator works by picking a track piece randomly based on each piece's assigned weight. It repeats this process until it leads ahead of where it needs to be by a set amount. If it reaches a point where the track piece does not fit in place it tries a new piece. If no pieces fit into the space then it backtracks and tries and new piece in the previous position. This algorithm can be seen in action below where the blue track pieces represent the track pieces currently in use by the game, and the red track pieces represent the pieces that have been laid down by the generator but not put into use yet by the game. 

I am very happy with how this algorithm works. It creates many interesting moments in gameplay. For instance, it creates tracks where straightaways proceed directly through loops. It also creates some interesting dynamic moments where the tracks aligns in such a way that it can create interesting shortcuts that player can find. 

A goal of mine when developing this game was to create a track generation system that could easily be amended to. The only necessary component to adding new track pieces is to create the model for it and implement it into Unity. I created a tool that allows the game to read the model and determine the spaces occupied by the track piece which is used for generation. After that step is complete developer just needs to give the track generator a reference to the new piece and define the new pieces relative rarity. After the model is created in all it takes less than two minutes to import the model into unity and add it into the game. This system allows for a great amount of expandability with minimal effort.