Canyon Mapgen Mod

Post Reply
MillersMan
Member
Posts: 13
Joined: Tue Apr 05, 2016 22:03

Canyon Mapgen Mod

by MillersMan » Post

At the moment I'm working on implementing an old idea about maps with rivers that go strictly downhill. I'm doing this in a local fork but I would love to see it added to minetest once it got usable.

Update: The Canyon Mapgen Mod is a C++ based modification/fork of Minetest that brings a mapgen with plausible streams that will flow downhill to join and form bigger rivers. You can check out the code at: https://github.com/MillersMan/minetest_ ... yon-mapgen

Features implemented:
  • A valley-like map with roughly 1000x1000 nodes (Update: spans the whole MT map now)
  • Rivers with a length of more than 1000 nodes
  • A groundwater-heightmap
  • Groundwater is strictly flowing downhill to form rivers
  • Rivers are strictly flowing downhill until they join with other rivers or leave the map
  • Rivers now also affect the biomes close to them
Current limitations:
  • Supporting area for each river is squared (causes straight cliffs)
  • Groundwater might be above ground at the border of the supporting area
  • Rivers might form loops where they almost touch an uphill part of themselves
  • River beds are currently hacked in so they are always sandy and ignore the biomes
Planed features:
  • Paging of generation structure (would allow rivers spanning the whole MT map with decent performance and only a few MB needed for caching, generation without cache also possible but needs a O(log n) duration instead of O(1) for generation of each chunk where n is the size of the whole MT map in one direction) (Update: is implemented now)
  • Random shape for the supporting area of rivers
  • Lakes and Oceans
  • Waterfalls
  • Rivers in caves
  • Changing humidity for biomes: Currently rain is expected to be evenly distributed over the whole map
  • Glaciers as springs for rivers
Image
Image
160406a.png
160406a.png (945.13 KiB) Viewed 1476 times
Last edited by MillersMan on Sun Jun 26, 2016 19:29, edited 4 times in total.

User avatar
Krock
Developer
Posts: 4650
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

Re: Canyon Mapgen Mod

by Krock » Post

The preview of your mapgen looks good but would it be possible for you to adjust the scaling of the map calculation?
Currently the terrain looks a bit too small. Walk 15 nodes and you've got into a river again. For builders, who would like to have a nice landscape, it would be helpful to have larger and flatter areas.
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

User avatar
paramat
Developer
Posts: 3700
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat
IRC: paramat
Location: UK

Re: Canyon Mapgen Mod

by paramat » Post

Interesting, something i have wanted to work on, a big challenge, good luck.

MillersMan
Member
Posts: 13
Joined: Tue Apr 05, 2016 22:03

Re: Canyon Mapgen Mod

by MillersMan » Post

paramat wrote:Interesting, something i have wanted to work on, a big challenge, good luck.
Thanks a lot. I just finished the paging which is necessary to have rivers potentially spanning the whole map without having to calculate the map at once.
Shows how generation structure is split into chunks of 64x64 with stone-borders whereas the first post used one single 1024x1024 chunk
Shows how generation structure is split into chunks of 64x64 with stone-borders whereas the first post used one single 1024x1024 chunk
160411.jpg (176.64 KiB) Viewed 1476 times
Here are some details in case anyone wants to try a similar approach from scratch:

I'm generating the rivers together with the landscape as inserting them to finished landscapes will take to much resources for a real-time-generation. I'm using a fractal like approach where I start off with a very low-resolution map and adding details with each iteration. Therefore I can't use complete noise-generators and instead creating the noise together with the whole map. The most basic map in current implementation would create a single NoiseMap (currently ValueNoise instead of PerlinNoise which would be more balanced) with the following properties:
* lacunarity: 2.0 (fixed)
* octaves: fractal iterations / 2 (=10)
* spread: size of whole map (=65536)
* persist: no limitations
* offset and scale: no limitations, but have different values as they are applied per round

I'm currently using two such maps (ground-water-level and ground-level) and another map which contains the location and direction of rivers. At each iteration I'm adjusting all noise-values so that they fit to all noise-values of grid-neighbours without breaking any of the rules.

MillersMan
Member
Posts: 13
Joined: Tue Apr 05, 2016 22:03

Re: Canyon Mapgen Mod

by MillersMan » Post

Krock wrote:The preview of your mapgen looks good but would it be possible for you to adjust the scaling of the map calculation?
I'm planning to fine-tune it once the basic stuff works reliably. The current density of rives has the advantage that it's easy to spot potential issues without having to travel a lot. Some issues on my list are:
  • Avoiding touching of different rivers or sections of rivers (e.g. there is a small loop in the screen-shot of my first post. Or there are two separate rivers almost touching in my second screenshot).
  • Avoiding that small rivers on mountain-tops touch cliffs, cause waterfalls and then flow on to the other side of the mountain.
  • Reducing the chance that rivers build canyons straight through the biggest mountain in the area
  • Expanding rivers so that they might be bigger than a single node
  • Finally creating real mountains and plains as currently everything is just a single noise-function
Of course there is a lot more on my list but those are the priorities.

User avatar
prof-turbo
Member
Posts: 516
Joined: Mon May 07, 2012 17:02
Location: MinetestForFun or Teeworlds master server list

Re: Canyon Mapgen Mod

by prof-turbo » Post

This looks like a cool and hard thing to make. Good luck !

Will you share your work soon ?

MillersMan
Member
Posts: 13
Joined: Tue Apr 05, 2016 22:03

Re: Canyon Mapgen Mod

by MillersMan » Post

prof-turbo wrote:Will you share your work soon ?
I'm planning to get it more stable, do a clean-up and to adjust it to the MT coding style before release. I hope to get to this state in the next weeks, but it really depends on my time and motivation.

twoelk
Member
Posts: 1482
Joined: Fri Apr 19, 2013 16:19
GitHub: twoelk
IRC: twoelk
In-game: twoelk
Location: northern Germany

Re: Canyon Mapgen Mod

by twoelk » Post

paramat wrote:Interesting, something i have wanted to work on, a big challenge, good luck.
deja vu?

MillersMan
Member
Posts: 13
Joined: Tue Apr 05, 2016 22:03

Re: Canyon Mapgen Mod

by MillersMan » Post

twoelk wrote:
paramat wrote:Interesting, something i have wanted to work on, a big challenge, good luck.
deja vu?
@paramat: Oh, I wasn't aware that there is a mod with similar goal and same name. I hope this doesn't bother you. Maybe I should rename it...

MillersMan
Member
Posts: 13
Joined: Tue Apr 05, 2016 22:03

Re: Canyon Mapgen Mod

by MillersMan » Post

Some updates with biomes/decoration enabled:
Relative close to the source with a waterfall in the background
Relative close to the source with a waterfall in the background
160412.jpg (156.58 KiB) Viewed 1476 times
Somewhere more downstream, the waterfall in the middle is a bug, the right one is a small river from an higher region.
Somewhere more downstream, the waterfall in the middle is a bug, the right one is a small river from an higher region.
160412a.jpg (194.32 KiB) Viewed 1476 times
And another one
And another one
160412b.jpg (147.43 KiB) Viewed 1476 times
Unfortunately rivers are still limited to a width of one node.

User avatar
prof-turbo
Member
Posts: 516
Joined: Mon May 07, 2012 17:02
Location: MinetestForFun or Teeworlds master server list

Re: Canyon Mapgen Mod

by prof-turbo » Post

Ow. That gets really interesting !
Is it a lua mapgen or a C++ one ?

MillersMan
Member
Posts: 13
Joined: Tue Apr 05, 2016 22:03

Re: Canyon Mapgen Mod

by MillersMan » Post

It's a C++ one. It's just easier to code it in the language I use at work every day (Actually it's C++11, but it could be easily ported back to MT style)

MillersMan
Member
Posts: 13
Joined: Tue Apr 05, 2016 22:03

Re: Canyon Mapgen Mod

by MillersMan » Post

I'm currently preparing a first version for code-release. It's still very rudimentary and has a lot of rough edges (or better blocky canyon walls) but here are a few other screens:
bigger-river.png
bigger-river.png (716.76 KiB) Viewed 1476 times
canyon-at-night.png
canyon-at-night.png (445.69 KiB) Viewed 1476 times
What pages are proposed for image-upload? I don't want to spam the forum with my screen-shots and I'm also not able to inline attachments in the posts :(

User avatar
azekill_DIABLO
Member
Posts: 7507
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: Canyon Mapgen Mod

by azekill_DIABLO » Post

i just love this :)

you can also do [img]the%20url[/img]
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!

User avatar
paramat
Developer
Posts: 3700
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat
IRC: paramat
Location: UK

Re: Canyon Mapgen Mod

by paramat » Post

No problem, my mod is called 'canyon' but it's not essential to avoid that exact name.
My mod is very different and very simple, no attempt at realistic rivers that go downhill.
Good work.
I and some others use http://imgur.com/ it has a limit of 100-200 images.

User avatar
ExeterDad
Member
Posts: 1717
Joined: Sun Jun 01, 2014 20:00
In-game: ExeterDad
Location: New Hampshire U.S.A

Re: Canyon Mapgen Mod

by ExeterDad » Post

Hi MillersMan.

Attach you images as you have done already. When it/they are uploaded, right click and copy link location. Then use the "img" tag and paste the copied image url into it. It will look like this:

Code: Select all

[img]https://forum.minetest.net/download/file.php?id=5897[/img]
And it will appear like this when posted:
Image

Repeat as needed up to three attachments per post.

MillersMan
Member
Posts: 13
Joined: Tue Apr 05, 2016 22:03

Re: Canyon Mapgen Mod

by MillersMan » Post

I've forked minetest and pushed my changes:
https://github.com/MillersMan/minetest_ ... yon-mapgen

I'll also update the initial post.

User avatar
paramat
Developer
Posts: 3700
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat
IRC: paramat
Location: UK

Re: Canyon Mapgen Mod

by paramat » Post

You need 2 more files changed, see my watershed branch as an example https://github.com/paramat/minetest/tree/rivergen
If you feel like contributing to the engine we could do with more C++ talent, see the issues/PRs at github and maybe chat to us on IRC dev channel.

MillersMan
Member
Posts: 13
Joined: Tue Apr 05, 2016 22:03

Re: Canyon Mapgen Mod

by MillersMan » Post

Oh, thanks, shouldn't commit and push the changes late at night, reverted the CMakeList.txt to undo the C++11 related changes and forgot that it is also needed for listing the source-code. Should be updated now.

User avatar
Gael de Sailly
Member
Posts: 845
Joined: Sun Jan 26, 2014 17:01
GitHub: gaelysam
IRC: Gael-de-Sailly
In-game: Gael-de-Sailly gaelysam
Location: Voiron, France

Re: Canyon Mapgen Mod

by Gael de Sailly » Post

That looks great. I'm very interested in this project. I've tried to understand the code but I… didn't managed :D
I've been trying for months to find an algorithm for creating rivers this way, that really intersects properly. I've never managed to get this.
Could you describe broadly how it works? I'd love to work on it with you!
Really, congratulations.
Just realize how bored we would be if the world was perfect.

MillersMan
Member
Posts: 13
Joined: Tue Apr 05, 2016 22:03

Re: Canyon Mapgen Mod

by MillersMan » Post

I've pushed a new version.

This version slightly improved river-routing and grew the mountains. Rivers now also affect the biomes. They have a more average temperature and a higher humidity.

MillersMan
Member
Posts: 13
Joined: Tue Apr 05, 2016 22:03

Re: Canyon Mapgen Mod

by MillersMan » Post

Image

Nice location while testing some changes: Two rivers and a small stream join to form a bigger river. The only strange thing is that the rivers come from the mountains while the small stream goes on in valley.

In other news: I'm working on a more generic implementation that might be modable.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests