At the beginning of 2019 I finished programming my first ever game, which I named Car Dash. I programmed using the game engine Unity. The following is the writeup of how I got to the completed game, including screenshots.
Initially I started coming up with some ideas on what type of game I wanted to make, so cue the brainstorming. I wanted a type of game that I could make as easy as possible while still providng a challenge, and one of the only ideas I had was doing an Endless Runner type game, but I wanted to work in 3D, so I thought of building a 3D Endless Runner game. The game became a 3 laned, 3D Endless Runner similar to Minions Rush and Temple Run.
It started off very basic, making gameobjects for the player, floor and obstacles. The player was to be a sphere, there were to be two extra outer lanes containing a pole each, to prevent the player from going off the map, the 3 inner lanes being the gameplay area. The obstacles for the player to avoid were to be simple blocks.
This is how it was looking after placing all gameobjects in the right positions. As you can see its pretty basic, a player that will just keep on moving forward, obstacles if touched by the player will end the game and stop the player in its tracks. Then we have the poles on the outside of the lanes to prevent the player from ever trailing off the 3 lanes. I gave the player gameobject a C# script with just a basic method that would allow the player to constantly be moving forward at all times, gradually getting faster as more time passes, unless the player collides with an obstacle. I also added a method that could allow the player to move to the left and right by using the A and D keys, which were later changed to the arrow keys for simplicity.
So the game at that point was pretty simple, the player moves forward getting faster over time, and if you hit an obstacle you start again from the beginning, but there were several problems:
1. Unless I manually placed all obstacles and floor terrain in the scene view, the player would eventually run out of floor.
2. The scene view would get terribly crowded with all the unused terrain that will be left behind, which would also affect performance.
3. The game itself is pretty repetitive, you just keep on going until you hit an obstacle, rinse repeat with nothing interesting happening.
The first problem was by far the hardest to get working the way I wanted. I started by making several floor terrain prefabs. One with no obstacles on, and all the rest have obstacles in different positions. Also I added pits to the floor terrain prefabs to make it more interesting and difficult.
I made loads of these prefabs, all with the obstacles and pits in different positions, and with that done I needed a way for these prefabs to randomly spawn along the z axis so the player would always have some floor to travel on and obstacles to dodge. I made a method that would randomly spawn the prefabs, and what the method does is it takes one of the prefabs randomly and spawns it a set distance up the z axis, and it will keep on doing this over and over. The only problem with this method is that the person playing the game would be able to see the obstacle prefabs getting loaded into the scene, making it easy for the player to predict with plenty of time on how to avoid the oncoming obstacles, creating a bad design.
To counter this I came up with an idea of having something akin to mist or cloud to act like a smokescreen for the prefabs that are loading into the game. I made a particle system and tweaked with the settings until I got a nice looking smokescreen, which made the appearance a lot better.
The second problem was very easy to sort out, I just needed a method that would delete all the prefabs when they go out of the cameras field of view. I used the Destroy(UL) method which deleted all obstacles.
At this point we had obstacles to dodge, visual effects, a sphere that continues on non-stop, gradually getting faster, but it would be pretty boring just going on forever with no other objective, which is when I decided to add collectable coins. This was pretty straight forward, I made a coin gameobject, made it a prefab, then placed it on the obstacle prefabs, which then made them spawn in with the the obstacles. I also made two types of coins, the regular coin and the mega coin (worth 10 regular coins) with continual rotation and gave the mega coin a particle system to make it more visually appealing, with both coins having a different sound effect for when the player collects them.
Now, I had a game that had aims, the player tries to go as far as he/she can while dodging obstacles and collecting coins, but I also wanted the player to be something different than just a simple sphere. I found an asset pack from the Unity Asset Store that had different styles of a simple car model, I gave the car the right script and did a little more tweaking (making the wheels rotate,etc), to get the car model to mimic the sphere. I hope to be able to create my own models in the future.
Next, I worked on some sound effects and music, because a game with no music isn’t a good game! Firstly, I do not own any of the music in my game, the music is made by those at https://www.purple-planet.com/, they make really good royalty free music. I used one of their tracks for the background music, and for sound effects I used an 8-bit coin collect sound for when the player collects a coin, and also used a different sound effect when the player collects a mega coin, adding a car crash sound effect for when the player collides into an obstacle or pit.
Now to work on menus. I started with the Main Menu, first I made a canvas so I could place text, buttons, background images etc. I added four buttons for the Main Menu, the Play Game button (to start the game), the How To Play button (instructions on how to play the game), the Options button (change different settings) and the Exit Game button (closes the game). I also added a colourful background so it wouldn’t just be a plain old white. To make it even more “presentable” I added two of the car prefabs each side of the buttons and made them constantly spin to make the menus a bit more lively.
The How To Play menu was just a canvas with some text saying how to play and explaining the game a bit more, with a button that if clicked takes you back to the main menu. The Options Menu, has a slider for the volume, a dropdown box for the resolution settings, and a checkbox for fullscreen mode. Any settings changed will stay the same even if the game is restarted.
The Pause Menu was pretty simple, I added a canvas to the main scene, made it invisible, and added some code to make it show when the ESC key is pressed, the Pause Menu just has three buttons, Resume (which resumes the game), Main Menu (which takes you to the Main Menu) and Exit Game (which exits the game).
I also added a Logo Splash Screen. When loading up the game, the Logo Splash Screen shows for about 5-10 seconds, showing my social media links etc, before the Main Menu appears.
I had pretty much a complete game, I just needed to finish up a few more things. I wanted to add some more touch ups to the game.
I added a game over screen that appears when the player dies. The game over screen has three buttons: Play Again, Main Menu and Exit Game. The game over screen also keeps track of your score and records your high score. The score is recorded by the time you’ve spent on your run, and how many coins and mega coins you’ve collected. I also added an UI element onto the main scene, so the score can be seen whilst the player is playing the game.
The completed game far exceeded my expectations and my initial planning. I hope in the future to build on this and create more complicated, challenging games.
I am thinking about making this game available to play, maybe sell it on Steam for £1 or something. Any criticism is welcome, I hope to make more games like this in the future and improve my skills as a Game Developer. Make sure to check out all my social links, Twitch, Twitter, Youtube and Discord.