WorldRacer
Aap Vare
GitHub repository: https://github.com/Fa1nt/WorldRacer
Latest build: https://drive.google.com/file/d/1-GcTNQFm0e5K09a3Kl6KUjjQmguhEzbF/view?usp=sharing
Video: https://drive.google.com/file/d/1JKJWy9ca3OMMiug8r6iz-k2ziwzHk10O/view?usp=sharing
Introduction
WorldRacer is an open world driving game. It builds upon a previous project I worked on during the last semester called NightRacer. This game incorporates the existing driving mechanics and allows the player to drive around a procedurally generated city. The game is developed using Unity and Blender.
Goals of the project
The goal is to have a time based racing game in a procedurally generated city. The project incorporates a procedural city generator I developed myself for my bachelor's thesis. The objective of the game is to drive from checkpoint to checkpoint in a given time limit. Ideally I hope to add traffic to the city as well. For this project I intend to model the drivable vehicle myself. On top of that, I would also like to make some better looking assets for the city.
Milestone 1 (03.03)
- Have the ability to drive around a procedurally generated map (3h): 4h
- Implement a checkpoint spawning system (4h): 3h
It is possible to generate a map and spawn in afterwards and drive around. I essentially took the city generator code as the base and additionally added the car controller and camera movement scripts from my previous project. I wrote a new script for spawning the car and making the camera follow it. The car is programmed to spawn on the road by using tags. The driving works just like it did in NightRacer at the moment.
I created a script for spawning a checkpoint and destroying the previously spawned one. In order to prevent them from appearing in areas that are hard/impossible to reach, I coded the markers to spawn a certain distance in front of game objects tagged as buildings. The script finds a random building in the scene and moves the transform 10 units in front it before instantiating the checkpoint.
Milestone 2 (17.03)
- Create one new car model (or more) and make it functional in Unity (7h): 6h
- Bonus: Fix the driving physics: 1h
I managed to create one custom car model for the game. Since I am not very well versed in Blender I found a tutorial and followed it very closely. I also found follow-up videos on the same channel that showed how to import and set up the assets in Unity. This process helped refresh my memory and learn new things about Blender.
An anti-roll bar has been added to the car to prevent flipping. This script helps stabilize the car greatly, preventing rolling over when making turns (source: https://drive.google.com/file/d/1l8bupcefVGNaz7OWVkT5Cs_UOGFIp9v1/view).
Milestone 3 (31.03)
- Add engine sound, smoke particle effect to the car (5h): 5h
- Add the ability to drive through checkpoints (2h): 1h
- Bonus: debugging/improving the driving mechanics
To create the engine sound in the game I first obtained a sound file that includes various vehicles noises (source: https://freesound.org/people/willybilly1984/sounds/345335/). I used a short section of the acceleration audio from this file to make the engine sound in the game. I had to redo the cropping of the audio a few times because a pop noise would constantly appear at the cutoff point. In Unity I set this short cropped sound file to play on loop when the car spawns. The pitch of the engine sound changes depending on the RPM of the wheel colliders as well as the gear.
Smoke now appears when the car skids out of control and it comes from all four wheels. I downloaded a texture (source: https://toppng.com/smoke-particle-texture-PNG-free-PNG-Images_70935), applied it to a material, and used Unity's particle system to make the effect appear.
Checkpoints now respawn when the player drives through them.
Milestone 4 (14.04)
- Add radar and pause menu (4h): 5.5h
- Add mouse look camera (3h): 1.5h
I was late with this milestone because of some unforeseen difficulties of creating the minimap for the game. I set up a second camera in the scene so that gives a top-down view of the area surrounding the player. I created another layer that this camera only renders. This layer includes a ground plane, roads, the player marker, and the objective marker. The tricky part for me was making the objective marker appear on the edge of the minimap pointing in the right direction when the player is far away from it. In the end I managed to edit the transform of the checkpoint marker so that it moves to the right place according to the player's location.
The game freezes and a pause menu appears now when the player presses the escape key. With this I removed the mouse cursor and buttons from inside the game and placed them in the pause and start menus.
Milestone 5 (28.04)
- Implement an automatic gearbox for the car (4h): 3h
- Add a sound effect for the car skidding (2h): 2h
- Add a sound effect for going through the checkpoint (1h): 1h
The driving is now more simplified thanks to the addition of an automatic gearbox. The gear shifting keybinds have been removed as well. The car will automatically shift gears up or down depending on the RPM value of the current gear. The time it takes to shift from one gear to another is pretty unrealistic at the moment, so this is something that could some more work. I intend to make the car handling more intuitive by the expo.
There is now a sound effect that plays when the car skids out of control or when the brakes lock up. Getting a decent looping sound for this took a couple of attempts in Audacity. Once again, I cut out small section of a longer audio file. In Unity I set the audio to play according to the same if conditions that I use for the tire smoke. This solution made the audio jittery because of how frequently it made the audio stop and play. Because of this I added a small delay before the script decides to stop the skidding sound. The end result is alright, but since there is no change in skidding audio's pitch or volume, it does not sound very natural. If I find the time for it, I will try to have the script modify the audio according to the slip values of the wheels.
Adding the sound effect for the checkpoint was much more straightforward. I added the audio source to the checkpoint controller object the spawns the checkpoints. The players now receives audio feedback when driving through the checkpoint marker.
Milestone 6 (12.05)
- Checkpoint timer, score (4h)
- Road markings, sidewalks (3h)
- Bonus: Collision detection, auto-adjusting for the rotatable camera