Created in Unreal Engine 5.6, my Fantasy Endless Runner is a procedurally-generated running game. It features a classic endless running mode, similar to popular games like Subway Surfers and Temple Run, but it also includes an adventure mode, where the running is split into sections with the ability to purchase powerups in between.
Procedural Content Generation
Path creation: The path on which the player character travels is created by putting together a series of floor pieces. There are three different sizes, and the program will choose between these pieces and spawn them at the back edge of the previous piece. Since the player's camera cannot be moved, after a while earlier pieces are destroyed in order to preserve processing speed.
Surroundings creation: Generated very similarly to the path itself, the surroundings are the pieces that line the path on either side. These have been created to match the sizes of the path pieces, but there are multiple different styles for each size; every piece is decorated differently by spawning actors via the PCG graph. The difference between the generation of spawning the surrounding pieces to the path pieces is that the surrounding pieces must match up with the size chosen by the path generation; otherwise, the surroundings and the path would become misaligned, and one may appear to stop before the others.
Obstacle Spawning: Obstacles appear on the path to provide challenge to the player. This was donw by creating spawn points on the path mesh, and having the program choose between them to decide where to spawn an obstacle. Most are stationary, but there are moving deer that also act as obstacles.
Coin Spawning: The player can collect coins that will contribute to their score and can also be used in Adventure mode to purchase powerups. These are spawned in a line throughout all three lanes via the PCG graph, and if an obstacle is encountered, they will bend around it. I achieved this by firing a line trace downwards from each spline point and seeing where it hits. If it hits higher than the floor, it means that there is an obstacle in the way, so the coins are offset by a certain amount to create the bend.
River Generation: On some surrounding pieces, rivers can be spawned. The shape and length of the rivers themselves are procedurally generated. I created a function that will choose a number of spline points to create, at which planes with a water material will be spawned. To create the unique bends of the river, I added an offset to where each spline point is created: it finds the previous point, gets its location, and then chooses a point that is within 30 degrees on either side. It then picks a distance ahead from a range and spawns a point. This allows for the unique turns of each river, while still ensuring that it does not overlap itself.
Quest Generation + Shop Discount Generation: In Adventure Mode, the player will go to the Plaza between running sections. In this area they can choose quests to be completed that, upon completion, will grant them a discount in the powerup shop. Quests are generated by using enums and random floats to make up quest text. There is a difficulty scalar that is dependent on how many running sections the player has completed, and the higher the difficulty, the harder the quests become to complete. The difficulty scalar is also used to determine the size of the discount the player will be granted upon completion; harder difficulty means a bigger discount.