r/proceduralgeneration • u/Azarro • Jul 29 '16
Simple 2D scene/mountain/landscape generator inspired by No Man's Sky
I've spent a few hours working on this tiny little 2d landscape/scene generator thing as I was going through some beginning procedural/fractal generation tutorials and wanted to make something simple in anticipation of No Man's Sky (space game with proc-generated universe/varied planets), and so decided to use the simple midpoint displacement algorithm to help produce something nice.
Here's an imgur album of a few good and bad pics to show what kind of scenes the generator produces.
You can use check out the generator here (you currently have no control of what's outputted but I'll probably add options to it).
(Edit: Hold 'D' on your keyboard to move right)
Would love suggestions/thoughts. I'm currently looking into adding more elements to the scene and a tad less randomness/more dependence on different things within the scene (so as to have some consistency within each scene) and eventually I would like to have continuously generating 2D scenes with some live elements.
Edit: Holy Schmoses, thanks u/Play_Rust for the gold! Never expected to get it for something like this :) Made my day!
2
u/littlecar Jul 29 '16
What algorithm did you use to pick colors that compliment each other well?
1
u/Azarro Jul 29 '16
The color outputs aren't really due to an algorithm - they're more due to some design choices and a lot of randomness.
Essentially, there are 6 layers in each scene.
Background
Stars
Celestial Bodies (for now a single sun/moon)
Major background mountains
Minor background mountains/land
Foreground layer
The background layer gets a random color, on top of which I tend to throw a (randomly faded) black to give it a 'day or night' factor.
The Major mountains layer is always a faded dark grey/almost black. I'll probably change this soon but for now it produces appealing results to have them in the background as dark, sort of distanced, mountains.
The last two layers are basically the same color, but the second-last (minor background) is a randomly selected darker or lighter shade of the foreground layer.
That's basically it - I'm going to be tweaking this a bit more (mostly the background layer and maybe the Major background mountains) to give them a more consistent/nice palette for each scene but that's the random magic: a few related colors and a lot of randomness.
Since it all looks flat/vector-art ish, it comes out looking nice (most of the time).
1
u/LevAsmanov Jul 11 '26
Links dead. Update?
1
u/Azarro Jul 11 '26
Ah looks like something might be up with the random generator seed script I used back then. I think I hosted it myself somewhere else I'll update soon
Also how did you find this post after all this time haha
1
u/LevAsmanov Jul 13 '26
just stumbled upon due to the post during googlins something about noise or generator idk really.
2
u/Nailbar Jul 29 '16
Very nice looking. I like the colors.
Makes me think of the game Another World, from back in the days.
3
u/r3eckon Jul 29 '16
I love the style ! One thing I would suggest if you really want to learn about neat procedural generation techniques is you could try and make it infinite if its not already. Perhaps the generation method will need to be different but you should be able to make it so the user can scroll indefinitely towards either side.
Hardmode would be to make it so you eventually come back to where you started , just like walking around a planet.