Page 1 of 2

Diamond Square Procedural Map Generation

Posted: Sun Jun 20, 2021 2:42 pm
by darkfrei
Hi all!

I've tried to make Diamond Square Procedural Map Generation

Based on this video: https://www.youtube.com/watch?v=4GuAV1PnurU



Re: Diamond Square Procedural Map Generation

Posted: Sun Jun 20, 2021 9:00 pm
by darkfrei
The colored version:

Press W and S to change the resolution;
Press R to regenerate map on current resolution;
Press F11 for fullscreen;
Press K to make a lua file with current map as array with values [0 .. 255]. See folder %AppData%\LOVE


Re: Diamond Square Procedural Map Generation

Posted: Tue Jun 22, 2021 10:45 am
by Gunroar:Cannon()
Nice, is it possible for me to make this converted to grids for a map where a character can move on(for collisions and things)?

Re: Diamond Square Procedural Map Generation

Posted: Tue Jun 22, 2021 11:32 am
by darkfrei
Gunroar:Cannon() wrote: Tue Jun 22, 2021 10:45 am Nice, is it possible for me to make this converted to grids for a map where a character can move on(for collisions and things)?
Yes, right now here is float from 0 to 1, but if you press "k", it will be saved as as integers 0-255. It can be very easy changed to (for example) 16 levels. See also the link: https://www.youtube.com/watch?v=4GuAV1PnurU

Re: Diamond Square Procedural Map Generation

Posted: Tue Jun 22, 2021 7:32 pm
by Gunroar:Cannon()
So it's like Perlin/Simplex noise. Can it go on forever or only a defined size can be generated when you want it(good either way).

Does it have biomes? Can biomes be added if not.

Re: Diamond Square Procedural Map Generation

Posted: Tue Jun 22, 2021 8:12 pm
by darkfrei
Gunroar:Cannon() wrote: Tue Jun 22, 2021 7:32 pm So it's like Perlin/Simplex noise. Can it go on forever or only a defined size can be generated when you want it(good either way).

Does it have biomes? Can biomes be added if not.
You can add another square near the old one.
Smallest field is 3x3, the next one is 5x5, the next one is 17x17. Yeah, side = 2^N + 1.

But you can make sides just as a = 2^N + 1 and b = 2^M + 1 and it will be nice filled.

Biomes can be calculated as result of two different value (the hight is value too) maps.

Three maps (hight, temperature, humidity) can describe biomes very nice. High temperature and high humidity is tropical area, but high temperature and low humidity is a desert. If it's too high, then it's always cold and dry.

Re: Diamond Square Procedural Map Generation

Posted: Wed Jun 23, 2021 1:30 am
by Gunroar:Cannon()
Any code implementation of biomes?(if you're willing of course.)
And can I zoom out the map, to make it show a larger area in a smaller space (sacrificing resolution)?

Re: Diamond Square Procedural Map Generation

Posted: Wed Jun 23, 2021 1:48 pm
by pgimeno
darkfrei wrote: Tue Jun 22, 2021 8:12 pm Smallest field is 3x3, the next one is 5x5, the next one is 17x17. Yeah, side = 2^N + 1.
Wait, that's 2^2^N + 1, otherwise after 5x5 the next one would be 9x9.

Re: Diamond Square Procedural Map Generation

Posted: Wed Jun 23, 2021 4:34 pm
by darkfrei
pgimeno wrote: Wed Jun 23, 2021 1:48 pm
darkfrei wrote: Tue Jun 22, 2021 8:12 pm Smallest field is 3x3, the next one is 5x5, the next one is 17x17. Yeah, side = 2^N + 1.
Wait, that's 2^2^N + 1, otherwise after 5x5 the next one would be 9x9.
You are right, the field 5x9 is also possible.

Re: Diamond Square Procedural Map Generation

Posted: Thu Jun 24, 2021 10:33 pm
by Gunroar:Cannon()
The map always seems incomplete, even at a high field.
I'm not familiar with this diamond-square, is there a possible way for me to show more of the map in a smaller area?