Itch.io
About
This was a Racing Game group assignment during our Advanced Gameplay Programming course where we got divided up to teams of 4-5 programmers, each person got a special role. I took the role of making the Procedural Generated Tracks. Feel free to download the build to test out the game for yourself or look at our Github for my code.
Github , Itch.io
Key Features / Worked On
Road Generation
Railing Generation
CheckPoints
FinishLine
Road Generation
Behind the scenes of the mesh generation is something we got introduced during our Advanced Gameplay Programming lecture by our teacher, Carl Granberg. A Bezier Curve is a parametric curve which uses two ControlPoints to mathematically calculate a curve based on their tangents and positions. I use the Bezier Curve as a base to generate a smooth and easy editable road mesh along it. The values of sizes, positions, tangents, and enable and disable certain features to are all tweakable in the inspector for easy and fast creation of track maps.
Curved Roads
Narrow or Wider Roads
Edges
Altitude or Depth on Roads
Railing Generation
The railings are generated as seperate gameobjects with their own mesh, idea here is for easier access for the AI car's navigation. By using the current Pose of the bezier curve's distance, I can generate railing poles along the edges of the road's curve. The algorithm takes into consideration the smoothness of the road curve, distance between each pole, desired sizes and the bezier curve's tagnents. the last example implies that you can clamp/limit if the railing should not be generated on examples like, steep hills, too sharp or too wide turns on a curve, or it can have no value at all which then the algorithm will generate railing along the whole track.
Low Track Segment Length
(MoreTriangles & Worse Perfomance)
High Track Segment Length
(Less Triangles & Better Perfomance)
CheckPoints
The Checkpoints are constructed at each ControlPoint the bezier curve has, along with it, a boxcollider which other systems like the "Out Of Bounds Retriever" and "Progress Tracking" will use. Each Checkpoint is constructed based on road width and Pose rotation. On the image right of here, you can get a perspective on how the bezier curve looks in editor mode.
(white line = bezier curve's output,
green lines = tangents of ControlPoint,
green dotted lines = tangents of ControlPoint in oppsite direction).
FinishLine
By taking in a desired prefab, it constructs a FinishLine at the start of the track by making each part of the prefab have the right position, rotation and scale. this part also uses UV's based on the tracks width to make it fit nicely along it.
Generalist & Project Owner
Halldór Kári Kristmundsson
Car Physics & Controller
Kiran Gaudian George
Track Generation
Elliot Coffell
Generalist
Max Deurell Kent
Racer AI
Mohammed Diab