views:

266

answers:

1

Hey,

I'm trying to create a game similar to this (Note:When you click 'play', there are SFX in the game which you can't seem to turn off, so you may want to check volume). In particular, I'm interested in knowing how the 'infinite' landscape is generated. Are there any tutorials/articles describing this? I came across procedural generation, but I'm not quite sure what topics I should be looking for (or if it's even procedural generation).

(I'm using C#, but I don't mind the language as I assume the theory behind it remains the same)

Thanks for any suggestions

+2  A: 

That one seems like it would be pretty easy to duplicate -- I would imagine an algorithm that calculates the next "step" of the landscape (the part that is off the screen). It would need to know the prior height (and maybe even the previous slope) in order to then (randomly) increment or decrement the step. You could then tweak the algorithm to be more fluid (gently sloping), or extreme (whipsawing back and forth) as time passes/levels are completed.

Before I clicked the link though, I thought you might have been talking about voxel landscapes -- which I haven't thought about for over a dozen years, but amazed me when I first saw them. I did some googling, and thought you might be interested in this:

http://www.gamedev.net/reference/articles/article655.asp

(Not sure if the Mars demo still exists, or if anyone has a DOS machine to play it on, but this is a good example that shows what it used to look like: http://www.codermind.com/articles/Voxel-terrain-engine-building-the-terrain.html )

Jeffrey Berthiaume
Thanks for the reply. I'm hoping to extend slightly on that game by having actual images. Is it really just a case of generating a random number between (e.g. 0-3) then drawing the corresponding texture? Or would that be quite inefficient to do every frame? Would this also mean that each 'step' width would have to be constant?
Skoder
If that's the case, you will need to have a fixed number of slopes pre-made as images, so the ends that touch look like they match up... The widths could be variable, but you'd definitely need to have a buffer (just in case) -- maybe 20 or so steps that are off the screen.
Jeffrey Berthiaume
I'll try messing around with that idea. Thanks for the help!
Skoder