top of page

Random Generation

Screenshot (230).png

     I started by modeling some basic racing platforms. I made a straight, ramp up, ramp down, left turn, right turn, and a double of each. I placed them into the engine and added some overlap boxes to help AI drive along the road (this is being worked on). I also added invisible barriers to ensure the player didn't fall off.

Screenshot (231).png

     Each road tile has a trigger on it. When passed, the game generates another tile and destroys and old one after a delay. This is done to keep unreal running at a stable frame rate by loading and destroying geometry as needed.

Screenshot (237).png

     I create a function that grabs the transform location of the attach point to add more floor tiles later.

Screenshot (235).png

     Because the tiles contained turns, there was an initial issue of the roads turning into themselves and overlapping. This blueprint was originally set up to spawn one tile at a time that was any in the array. To fix overlap, I split the array in two, both contained straight paths but one contained ramps, the other contained turns. I made three spawns this time, on a strict "Straight, Turn, Straight" pattern. This eliminated almost all overlap. In this GameMode BP Function, the actor is spawned randomly from an array, and grabs its spawn transform. It then casts to the original parent tile to get its attach point (an arrow placed at the end of the mesh) and sets it as the next spawn point for the road. This is repeated three times.

Screenshot (236).png
HighresScreenshot00000.png

     At the start of the game in the GameMode BP, 500 tiles are spawned. As you can see, most of the road does not overlap. However, farther down we can see that is not the case.

HighresScreenshot00001.png

     While there is some overlap, the track is still drivable. The issue largely lies in the support beams crossing through other track tiles, and not the actually track. However, this is an important thing to fix. I could remove the beams, but if I ever plan to create terrain with the tracks, it will immediately become a problem.

bottom of page