Procedurally generated Trials track.

#1 Posted by Qc_Chopper (7 posts) -

Gamertag: QcStorckFTW

This is our team account gamertag but I (QcChopper) and my buddy storcken made the map.

This is my idea and project but storcken is responsible for the backgrounds and animations while I am supervising the project, making the procedural generation engine and driving line(s). A colossal thank you to storcken for making this ambitious project remotely possible.

For those who wonder what it means, procedurally generated is often mistaken with randomly generated, because it's actually far from random even if it uses random values, it has to follow some logic, i.e. in Diablo if doors could spawn where you can't reach them it wouldn't work.

So almost everything in this track is picked from a few possibilities, the obstacles, the backgrounds, sky and ambiance, sounds, weather and some events.

-------------------------------------------------------------------------------------------------------------------------------------------------------------

Features:

-The track is different every time you play.

-Working Multiplayer where all players race at the same time on all different tracks.

-20,736 possible driving line setups, all reasonably balanced with decent flow.

-110,592 possible background variations

-9 Different general sky variations with just about every value randomized i.e. sun/moon size, randomized clouds, fog, light intensity and the list goes on extensively.

-Dynamic rain or snow effects with dynamic fog, lightning and thunder effects.

-18 different environmental sound effects are generated dynamically using a complex logic algorithm.

-4 rare events.

-4 different endings*: One for bronze, silver, gold and platinum. The three top endings should reveal why the track is never the same.

* Endings only work in single player races.

-------------------------------------------------------------------------------------------------------------------------------------------------------------

Gameplay Video

http://www.youtube.com/watch?v=86WaQ6Tm-nk

In-editor look

http://www.youtube.com/watch?v=86WaQ6Tm-nk&feature=youtu.be

-------------------------------------------------------------------------------------------------------------------------------------------------------------

Driving line: Each section has 2 or 3 different possibilities, giving a total of 20,736 (yes twenty thousand seven hundred and thirty-six, you read well) different possible driving line setups. All possibilities can be flowed through because the area that connects the different random sections do not change, it's where the checkpoints are too. All sections can not be perfectly balanced but I tried as hard as I could to make it as fair/even as possible and I am very happy with the results no matter what line you get.

Here's the math of how I get the 20,736 line setups. Each number represents the number of available variations per section, some of those are alternative paths altogether so since it's either or, those sections add up the possibilities instead of multiplying them, hence the parentheses.

2 x 3 x 3 x 3 x (( 2 x 2 x 2 ) + ( 2 x 2 x 2 )) x 3 x (( 2 x 2 ) + ( 2 x 2 ))

2 x 3 x 3 x 3 x (16) x 3 x (8)

The first set of parentheses is the cave, you can either go up the cave and get 2 x 2 x 2 variations or inside the cave for a whole different 2 x 2 x 2 variations. So the 8 variations from above add up to the 8 from below to make 16 possible variations for the cave area.

The second set of parentheses is the warehouse, you can either go above the warehouse and get 2 x 2 variations or inside the warehouse for a whole different 2 x 2 variations. So the 4 variations from above add up to the 4 from below to make 8 possible variations for the warehouse area.

Note that although the number is impressive, it takes into consideration that if only one obstacle isn't the same it's a different track, so you will see the same obstacles all the time but you will never have the same track twice, not if we account for everything else besides the driving line that's procedurally generated.

-------------------------------------------------------------------------------------------------------------------------------------------------------------

Backgrounds: storcken made some amazing backgrounds, and once again there is a huge amount of different setups possible and most random backgrounds variations are independent from the driving line variations. If we count only the variations that are independent from the driving line: we get 110,592 possible background setups.

Here's the math on the backgrounds:

Sawmill area: 2

Cabin area: 3

Bridge area: 3

Towers area: 4

Sewage area: 2

Silo area: 2

Truck area: 2

Reservoir area: 3

Floating island area: 2

City area: 2

Cave hole area: 2

Cave lake area: 2

Yard area: 2

Warehouse area: 2

2 x 3 x 3 x 4 x 2 x 2 x 2 x 3 x 2 x 2 x 2 x 2 x 2 x 2 = 110,592 possible background setups, those are are not counting background elements that are shared with line variation so nothing gets counted twice.

-------------------------------------------------------------------------------------------------------------------------------------------------------------

Sky: There are 9 different basic skies (2 morning, 3 mid day, 2 evening and 2 night) and each of them have most of their values randomized; fog, sun/moon size & intensity, clouds... everything I could randomize I did.

-------------------------------------------------------------------------------------------------------------------------------------------------------------

Weather: Fog has a complicated logic: the chances of getting little to no fog are very high, the chances of having medium fog are somewhat rare and chances of getting heavy fog are even rarer. It's much more complicated than to link the value to a random number, heavy fog is much less unlikely than little to no fog in real life (in most areas)

It can also rain or snow, and those happen dynamically; it can start or stop raining/snowing at any time: fog sets in before the precipitations and disperses after they stop, also there is lightning and thunder that can happen whenever it rains or just before, announcing the rain in some cases. The game also knows When you enter/exit a building or cave and the precipitations will start or stop accordingly. The lightning effect is generated from 3 values (overall flash time, single flash time and pause time between next flash) and thunder sounds are picked from 4 variations, and the sounds have a random time delay after the lightning, and the longer it takes for the thunder to be heard after the lightning, the fainter it will be because it is further, just like in real life.

-------------------------------------------------------------------------------------------------------------------------------------------------------------

Sounds: Sounds are all randomized according to a logic, wolves and owls will be heard only at night and only if you are not inside, frogs won't be heard when it snows but they can be heard when it rains, and you can hear them in a cave but not in a warehouse, no animals will be heard when you are inside a building, insects can be heard inside the cave but not inside buildings, you won't hear birds at night except for crows and the list goes on extensively.

One of the nicest aspect of this is to hear nature come back to life right after rain stops, mostly the birds.

-------------------------------------------------------------------------------------------------------------------------------------------------------------

Events: You could see a train passing by, a forest fire, fireworks, a volcanic eruption. Those don't happen too often, flies and fireflies can be seen a bit more frequently.

-------------------------------------------------------------------------------------------------------------------------------------------------------------

Endings: Endings aren't random but we have 4: one for bronze, silver, gold and platinum times.

-------------------------------------------------------------------------------------------------------------------------------------------------------------

Story: There isn't a story per say but the Silver, Gold and Platinum endings might reveal why the track is never the same.

-------------------------------------------------------------------------------------------------------------------------------------------------------------

Thanks to storcken obviously and also Ricky Reb and BlueMageFTW for helping me get started learning to do complex circuitry and thanks to everyone who helped with testing and feedback.