Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411430 Posts in 69363 Topics- by 58416 Members - Latest Member: JamesAGreen

April 19, 2024, 08:31:08 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Generative race tracks - any algorithm?
Pages: [1] 2
Print
Author Topic: Generative race tracks - any algorithm?  (Read 9997 times)
gimymblert
Level 10
*****


The archivest master, leader of all documents


View Profile
« on: February 11, 2011, 07:45:06 AM »

Hello

I've been trying to find some method for generate race tracks but it seems that's not much covered on the internet.

I'm actually doing a racing game for the purpose of learning and wanted to see various method aside from those I could come up with my own.

DO you have a favorite method you know and want to share?

Thanks!
Logged

X3N
Level 6
*


View Profile
« Reply #1 on: February 11, 2011, 08:11:06 AM »

I don't know an algorithm, but you may want to look at / study this game:
http://toucharcade.com/2010/05/25/cubed-rally-racer-review-i-cant-imagine-a-better-homage-to-retro-isometric-racers/
Logged

destiny is truth pre-op
Wolfos
Level 0
*


View Profile
« Reply #2 on: February 11, 2011, 08:39:31 AM »

Generating them in 2D using bezier curves and with that data you can render them in 3D.
Logged
gimymblert
Level 10
*****


The archivest master, leader of all documents


View Profile
« Reply #3 on: February 11, 2011, 09:19:47 AM »

Generating them in 2D using bezier curves and with that data you can render them in 3D.

We already do that, but with catmull for efficiency. We generate a circle and then we modulate the radius at each cntrol point. But it tend to create dull flower style race track ... So I'm investigating more. My method does not allow intricate concave loop, no idea how to do it without the road crossing itself.

Now i'm trying to fill recursively a timeline with gameplay direction for the generator to parse into interesting tracks to remove the random feel.

I just wanted to know what over people had in shop.

There is so many cool documented algo about maze, city, island, galaxy, dungeon, tree, landscape, monster, space ship, story, people ... how it does come out there isn't any single one about race track Huh?

@ X3N
Smiley Yeah I know it, i did find game with racetrack generation, generally they are not loop. THis one is truly amazing (well the video at least).



« Last Edit: February 11, 2011, 09:33:11 AM by GILBERT Timmy » Logged

_Tommo_
Level 8
***


frn frn frn


View Profile WWW
« Reply #4 on: February 11, 2011, 09:40:05 AM »





Now that's really awesome, but the algorithm looks pretty proprietary.

Anyway, you could build the track from start to finish, adding each time a "node".
A node would be a piece of the track that is made of only one spline: each node can be tuned in lenght and sharpness of the curvature, so that hardest settings generate more short and sharp turns.
Then you add props following the whole spline, just like in the video.

But i think that a really challenging and interesting track needs more than individual node generation, it should account of the overall shape of the track... like, how do you model a sharp turn after a speedup, or a series of hairpin turns?
Or even have the start point match the end point.
Logged

moi
Level 10
*****


DILF SANTA


View Profile WWW
« Reply #5 on: February 11, 2011, 11:53:16 AM »

If it's for a real game, then don't generate them with an algorythm the result will always be boring and/or unrealistic.
Just create a set of modular road assets (road pieces) and create the tracks by hand.
Logged

subsystems   subsystems   subsystems
gimymblert
Level 10
*****


The archivest master, leader of all documents


View Profile
« Reply #6 on: February 11, 2011, 12:16:22 PM »

There is no fun at making the game if it's another generic racer. Huh?
It's for a real game. How about coming up with an algo that's NOT boring? Why algo are boring in the first place? How to solve that?
Logged

_Tommo_
Level 8
***


frn frn frn


View Profile WWW
« Reply #7 on: February 11, 2011, 12:19:06 PM »

imo the algorithms are boring because a real designer can stuff much more challenges and subleties into a design that any algorithm can.
In fact when you write a procedural algo you are "writing a designer", or at least a part of him Smiley

So hmm you should decide what "fun" is in a racing track, and try to write something that makes that.
Logged

J. Kyle Pittman
Level 6
*


PostCount++;


View Profile WWW
« Reply #8 on: February 11, 2011, 12:49:16 PM »

you should decide what "fun" is in a racing track, and try to write something that makes that.

Exactly. The results don't necessarily have to be boring, but they will be if the algorithm is too simple or predictable. That's one of the reasons I find procedural generation to be both interesting and challenging.

Prefabs might be a good solution to this problem. If you segment your map into tiles, you could place tile-aligned prefabs that are known to not overlap. Then you could walk the track a tile at a time and construct a smooth spline path along the shape defined by the prefabs. Your controls points would all be regularly spaced, so you could maybe perturb the control points a bit within some safe range to remove some of that regularity and make it look more natural. Of course, the smoothness of the splines would help with that, too.

Never tried anything like this myself, but it sounds like a fun problem to solve. Good luck!
Logged

_Tommo_
Level 8
***


frn frn frn


View Profile WWW
« Reply #9 on: February 11, 2011, 01:01:20 PM »

Well, realistic racing games are very repetitive and predictive anyway, it should be easy enough to try to generate something interesting.

An idea that just popped: you could generate first the best path a car can take in your track - without generating the track first.
So that you generate speed ups, sharp turns, drifts, sharp decelerations, and all that kind of car actions that need to be managed by the player, and this can be done with a simple spline.
This way you design what the player and your AI has to do to win your track in the finest detail.

Then you generate a track that will force the player to take these actions. This way you can have a very natural-looking track adding things that you know to be useless, but that can be used by a player that doesn't know your "perfect path", making the track look more natural.
Logged

Triplefox
Level 9
****



View Profile WWW
« Reply #10 on: February 11, 2011, 01:49:27 PM »

In most racers, you're supposed to learn a small number of tracks really well, but having every one be random runs counter to that theme. That's why people are advocating against procedural for that kind of track generation - it's supposed to be something you go over in great detail.

I do see some potential in making a rally/cross-country game by generating new track pieces at runtime. This is what FUEL did(the map is fixed and enormous, partly procedural techniques, partly design), but it didn't have interesting uses of the terrain in a racing context, just a basic mission structure that could be done on a small track. I think the best models for that type of game are

and to a lesser extent Outrun and sequels.
Logged

J. Kyle Pittman
Level 6
*


PostCount++;


View Profile WWW
« Reply #11 on: February 11, 2011, 01:55:39 PM »

For what it's worth, I loved the randomly generated X Cup tracks on F-Zero X even if they were simple and same-y and you couldn't learn them. Shrug
Logged

gimymblert
Level 10
*****


The archivest master, leader of all documents


View Profile
« Reply #12 on: February 11, 2011, 01:58:33 PM »

And what make a racing game fun, isn't the game just about turning and speeding in straight line? Wink
Logged

gimymblert
Level 10
*****


The archivest master, leader of all documents


View Profile
« Reply #13 on: February 12, 2011, 04:13:19 PM »



Surprisingly, people I asked have no idea of what makes a pure racing game fun. They only point that curves are important, but when they came to deep analysis they are bewild that there is almost "nothing" in term of gameplay.

Since the only way to make a generator good and less random is to emulate a designer mind I had to tackle the problem myself.

From my early analysis racing game is an optimization gameplay. There is element of risk in taking curve, you can "take it safe" or you "push your risk" at the limit, it's about control vs chaos.

The main element is turning radius and it is a function of speed. The faster you go, the larger the turning radius, therefore straight line (speed) + hairpin (low turning radius) is the highest difficulty configuration.

The other element is balance, while in a curve, you must balance speed vs turning radius, depending on the control interface it's entirely a different gameplay (binary keyboards or analog sticks). Keyboard is the most challenging because the use of braking and turning are analogic and you need multiple press to manage speed, it introduce a factor of chaos (maintaining a good aim despite discrete input). Analog input is about sweet spotting the correct angle. Braking play a role as it reduce speed therefore affect turning angle.

The width of the road (with or without offroad element) is also important because it give the the degree of possible driveline (number of risk/safe driving options)


The last element is simply rhythm, it's like music. A key aspect is therefore varying curve (curve combo), road width and speed part.

Prefabs might be a good solution to this problem. If you segment your map into tiles, you could place tile-aligned prefabs that are known to not overlap. Then you could walk the track a tile at a time and construct a smooth spline path along the shape defined by the prefabs. Your controls points would all be regularly spaced, so you could maybe perturb the control points a bit within some safe range to remove some of that regularity and make it look more natural. Of course, the smoothness of the splines would help with that, too.

I'm intrigue by the implication in that.
Of course the difficult part is how to generate random LOOPs that go through a given number of tile.
« Last Edit: February 12, 2011, 04:20:13 PM by GILBERT Timmy » Logged

aDFP
Level 0
***



View Profile
« Reply #14 on: February 15, 2011, 02:34:12 PM »

Just a thought, but what if you approached it from a different direction, and instead of creating the track, created the 'island' in the middle first?

You could start with a simple generated heightmap (kinda lake-style), then use a genetic algorithm to create a single 'blob' in the middle, then pick points around the edge of the blob and convert those to splines.

That way, you could easily control the track length, complexity and how circular the track was, either though altering the genetic algorithm or the heightmap generation. You could even chuck the rest of the heightmap away when you're done and recreate it based on the track, to make it more realistic.

Idea, or brain fail?
Logged
InfiniteStateMachine
Level 10
*****



View Profile
« Reply #15 on: February 15, 2011, 09:05:35 PM »

For what it's worth, I loved the randomly generated X Cup tracks on F-Zero X even if they were simple and same-y and you couldn't learn them. Shrug

 I was going to say trying to do it procedurally isn't worth it but you're right, the F-zero tracks were actually quite fun. Definitely worth looking at for an example.
Logged

X3N
Level 6
*


View Profile
« Reply #16 on: February 16, 2011, 07:07:55 AM »

I like the "Blob" idea. I think that could work well.
With generating specific parts, I would give more leeway than "hairpin curve" or "slight turn". Give a random angle value.. where the higher the "difficulty" setting of the map, the sharper your angles can be. Your algorithim would have to make sure the track didn't turn on itself, so it would straight out / keep going in the same "direction" it was traveling.
Logged

destiny is truth pre-op
gimymblert
Level 10
*****


The archivest master, leader of all documents


View Profile
« Reply #17 on: February 16, 2011, 05:45:49 PM »

Just a thought, but what if you approached it from a different direction, and instead of creating the track, created the 'island' in the middle first?

You could start with a simple generated heightmap (kinda lake-style), then use a genetic algorithm to create a single 'blob' in the middle, then pick points around the edge of the blob and convert those to splines.

That way, you could easily control the track length, complexity and how circular the track was, either though altering the genetic algorithm or the heightmap generation. You could even chuck the rest of the heightmap away when you're done and recreate it based on the track, to make it more realistic.

Idea, or brain fail?

Hey! great idea actually! We only have to pick up one slice of the heigtmap and we still have dozen of variation. We can also break the map into arc sector from the center and apply different complexity parameter. For example, breaking it into quadrant allow to have a first part smooth, a second part with lot of sharp turn then smooth again then transition in sharper curve. We could also use noisy "flow map" to alter the topology by some amount of frequency without altering too much the consistency of the track and break the star like shape. Basically it's an expansion of the circle modulation algorithm.

I was also exploring a variant of the center blob, basically you can grow the blob in any direction and find the edge once it's finished, but I have no idea yet to constrain it with design constrain (certainly using a variant of what I said above). The blob can be any shape, as long all part are connected, it give the most variant for flat tracks that does not cross themselves.

@X3N
Haha! great!
I was reading your answer and it nearly adress the concern I had just above, basically you have premade part you "attach" to the blob to create interesting shape, and that could be constrain to some design guideline!
You are truly awesome!
Logged

aDFP
Level 0
***



View Profile
« Reply #18 on: February 17, 2011, 05:34:13 AM »

Cool, glad you liked the idea.

If the blob has complex edges, then difficulty/complexity could be as easy as picking points which are close or distant, and smoothing them or forcing straight lines between them, which you'd probably want to do for the start/finish straight anyway.

It shouldn't be too hard to allow for tracks that cross, either. Just have a random chance of a secondary blob, and give them some kind of surface attraction so they have a single point which touches, then either leave the height of that point flat when you generate the spline, or force the height of the two road sections apart and drop a bridge mesh in there.

I really would love to see this now. If you don't use the idea, I might have a go.
Logged
gimymblert
Level 10
*****


The archivest master, leader of all documents


View Profile
« Reply #19 on: February 17, 2011, 09:50:30 AM »

The programmer I'm working with is not sold on anything procedural, I will try to implement it when I have some times. Also I'm switching to unity I need to understand some basic first.

But you should try it if you can Smiley
Logged

Pages: [1] 2
Print
Jump to:  

Theme orange-lt created by panic