Lunar Lander: terrain generation



  • This isn't exactly a coding help question, more a general 'what are your thoughts' type deal.

    I'm currently making a lunar lander in Unity and I'm happy with the movement of the ship and collision detection with the land I'm going to be having (yay for polygon colliders), as well as the various things it does with particle emitters for the look of the thrusters.

    And now I turn to making the terrain. So far for testing I've just had flat terrain but I'm curious how to go about making good looking terrain short of modelling it myself.

    Most of the terrain I've seen in such games tends to be either very spiky because the position on the Y axis tends to be mostly or completely random, or it tends to be very smooth. I know last time I tried this, I was using a tile engine with various slope tiles and created a generator that knew what tile types could follow others, but again it created very smooth and dull landscapes.

    So I'm curious, how would you go about generating non-terrible 2D terrain? For reference I have three objects - the landing pad in roughly the middle (semi random) and two lines of terrain coming off it to each edge of the screen.

    Gonna mull it over with a cup of tea, though.



  • Are you looking for fully automated generation from scratch, or pulling from a base / group of bases and generating from that?

    You could also just create a flat base and apply a splatmap to it



  • I'm mostly interested in the result rather than the route to it. Ideally, yes, fully automated, but I don't mind seeding it to some degree by hand if that's the best route - I just want to avoid doing every map by hand ;)

    Flat base with splat map could work, I dunno. This is kind of out of my normal territory.





  • See, I thought about that, but that makes effectively a 3D map (x by y with each point having a z) but I only need what amounts to one line of that map... even simplex noise seems like it's massively overkill.



  • Ah, I didn't realize you were doing a 2D game. You probably want midpoint displacement noise.

    Consequently, that's what Dwarf Fortress uses.



  • Lunar Lander is commonly 3D now? ;)

    Thing about even diamond-square for making a heightmap is that I'm still going to be taking a slice out of it, but it still seems the most sane way to go about it - do a plasma map (which is cheaper than Perlin or even simplex IIRC) and then just grab, say, the middle row out of it. Thanks for the suggestion, I'll play with it tomorrow after I've had some sleep.



  • Midpoint displacement noise as in:

    1. Pick random heights for points x0 and x1.
    2. Pick a random vertical displacement for the midpoint of that line segment.
    3. Pick a random vertical displacement for the midpoints of the two line segments you just made.
    4. Continue until satisfied. Choose displacements with geometrically decreasing ranges each time.


  • Oh, I see. Thanks 😄



  • Another option would be to take slices of real moon topography eg http://wms.lroc.asu.edu/lroc/view_rdr/NAC_DTM_ARISTARCHU2



  • @Arantor said:

    See, I thought about that, but that makes effectively a 3D map (x by y with each point having a z) but I only need what amounts to one line of that map... even simplex noise seems like it's massively overkill.

    There are 1D-versions of Perlin's noise function (e.g. noise1()). FWIW, perlin noise and many procedural methods derived from it have the nice property where z = f(x) -- i.e., you don't need to keep track of any of the other terrain to find the height of a single point (unlike, let's say midpoint displacement).

    I've always liked the "ridged multifractal" terrain described by Ken Musgrave in the procedural texturing and modeling book:

    One of the properties is that it produces smooth valleys, but more jagged peaks. It's based on perlin noise, so you should be able to drop the 2:nd dimension to just get a 1D heightmap.


Log in to reply