TurboThrill - Unity Game

TurboThrill - Unity Game

Hi! This is an update on the game I have been working on recently. Below are some of the features that my team originally intended to implement.

  • Procedurally generating map
  • A car with realistic physics
  • AI to fight against
  • Finish line
  • A leaderboard to check the time each run takes
  • Upgrade system

While the game might not be finished yet, I am proud of what we accomplished! We implemented procedural generation, an AI, a car with realistic physics, logic for the game, and much more. Here are some of the things I worked on implementing:

  1. Procedural Terrain Generation

  • This was one of the most crucial aspects of our game. It was one of the features that gave our game an aspect of replayability. Procedural generation is a way to generate an almost infinite amount of content using algorithms and pseudo-random noise such as Perlin noise. The first step is generating the noise maps using variables like octaves, lacunarity, persistence, etc. In this step, x and y coordinates are mapped to height values, sent to a script to generate triangles, normals, and uvs, and stored in a MeshData structure. Whenever a terrain chunk needs to be generated, a request to generate it at a certain level of detail is sent, and the variables noise map values and mesh data are generated. Finally, the mesh is generated and displayed on the screen. This entire process is multi-threaded to ensure that it runs efficiently. Moreover, a graph shader is used to transition between different 2D textures like grass and sand smoothly and applied to the terrain mesh.

Article content

2. Shaders

  • This project extensively uses shaders to help make the game more visually appealing. Throughout it, I learned and explored the workings of the GPU, the rendering process, etc. I first used shaders to make water in our game. The water has multiple colors, foam, and a way to create waves using a noise map. It is important to note that this shader was made using Unity's URP graph shader, which allowed me to get used to shaders. I also used the shader graph system to create a shader to render a texture onto the terrain rather than colors. I also used the graph shader system to create the first version of the grass that was displayed in the game. However, this was discarded for a more efficient method later on.

Article content


  • Many games utilize foliage, such as trees, rocks, grass, etc., to give their world a fuller appearance. To accomplish this, I procedurally generated trees and placed grass throughout the terrain. However, I encountered a performance issue where the grass hogged the CPU's resources. After researching games like Ghost of Tsushima, I came across a technique called GPU instancing, where instead of instantiating meshes on the CPU, you send one call to instantiate identical meshes on the same call on the GPU. I ended up interacting with compute, vertex, and fragment shaders and working with matrix math to determine the geometry of the grass blades.

Article content

3. World Saving

  • While rather rudimentary, this world-saving method saves the world's seed and other variables such as lacunarity, octaves, etc. I then used data serialization/deserialization to store the variables in a JSON file so I could use them to recreate the world later.

Article content


4. Other Features

  • I used Unity's particle effect system to create effects such as bullet collisions, tree destruction, car boosting, and more.
  • I used Unity's cinemachine camera for smooth transitions between different cameras.
  • I implemented the car turret and the physics for projectile bullets. I also implemented the health system, which ensures that all game objects with health despawn after they run out of it.
  • I implemented a mini-map that follows the player and has a waypoint for the finish line.
  • I implemented post-processing features such as vignette, color grading, depth of field, etc.

5. Takeaways

  • Throughout the development of this game, I have learned a lot about what it means to be a programmer and a team player. Using the scrum method helped me develop communication, leadership, and programming skills. Through the daily, retrospective, review meetings, etc. I was able to understand the importance of planning concise and SMART goals. I also ended up learning a lot about programming topics such as multi-threading, shaders, the GPU's rendering pipeline, data serialization, GitHub, and much more. I look forward to making more games in the future and improving as a programmer!

Good job vaibhav attre. Appreciate all the hard work gone behind this. Keep learning, working hard and posting more updates.

Like
Reply
Saathvik Somujayabalan

Georgia Institute of…490 followers

1y

So happy to be able to see your game progress since february!

To view or add a comment, sign in

More articles by Vaibhav Attre

  • Multiplayer Card Game in Unity

    While learning about the Operating System, I came across the topic of networking and communicating between multiple…

    1 Comment

Others also viewed

Explore content categories