[C++ Mapgen] Carpathian (MERGED)

User avatar
demon_boy
Member
 
Posts: 48
Joined: Thu Apr 09, 2015 10:53
Location: Melbourne, Australia
GitHub: vlapsley
In-game: demon_boy

[C++ Mapgen] Carpathian (MERGED)

by demon_boy » Thu Apr 06, 2017 08:32

As of 6 July 2017, the Carpathian Mapgen has been merged into Minetest master.

A new mapgen in C++ featuring a flat base terrain with three types of terrain variation - rolling hills, ridged and step (terraced) mountains.

The aim was to create a mapgen with a flat base, somewhere where you can build a village, even a city. But to differentiate it from the flat mapgen, the flat areas are surrounded by hills and various mountain ranges.

Features:
  • Vast plains, average y-level between 5-10
  • Rolling hills - small hills.
  • Ridged mountains - mountains of a similar height will connect with a ridge.
  • Step (terrace) mountains - mountains, sometimes a stair like effect.
  • Fjords - particularly where the larger mountains meet the sea. Rare.
  • Really big mountains - where two or even three mountain noise meet, spectacular and unpredictable peaks form.

How it works:

Code: Select all
np_base          = NoiseParams(12, 1,  v3f(2557, 2557, 2557), 6538,  4, 0.8,  0.5);
// Creates the base terrain. The high spread and low lacunarity creates a very flat terrain. For where this is no hill/mountain noise, this is the ground you are walking on. I added an offset of 12 to create a base terrain that averages y-level between 5 and 10.


Code: Select all
np_filler_depth = NoiseParams(0, 1,  v3f(128,  128,  128),  261,   3, 0.7, 2.0);
// Copied from MGV7. For biome filler - dirt, sandstone, etc.


Code: Select all
np_height1       = NoiseParams(0,  5, v3f(251,  251,  251),  9613,  5, 0.5,  2.0);
np_height2       = NoiseParams(0,  5, v3f(383,  383,  383),  1949,  5, 0.5,  2.0);
np_height3       = NoiseParams(0,  5, v3f(509,  509,  509),  3211,  5, 0.5,  2.0);
np_height4       = NoiseParams(0,  5, v3f(631,  631,  631),  1583,  5, 0.5,  2.0);
// The four height noises above are the primary noise in calculating hill/mountain height. There is some complex functions that create a weighted average height with the 3D np_mnt_var noise being the weight. Then getting minimum/maximum values from these combinations to create a "hilliness" variable. This essentially determines whether the hills/mountains are small (rolling) or large (mountains). Changing the scale (2nd value) will drastically change the height of mountains, and produce more hills/mountains and less flat terrain.


Code: Select all
np_hills_terrain = NoiseParams(1,  1,  v3f(1301, 1301, 1301), 1692,  5, 0.5,  2.0);
np_ridge_terrain = NoiseParams(1,  1,  v3f(1889, 1889, 1889), 3568,  5, 0.5,  2.0);
np_step_terrain  = NoiseParams(1,  1,  v3f(1889, 1889, 1889), 4157,  5, 0.5,  2.0);
// The magic that creates mountain ranges whilst leaving flat plains in the map. Adding to the offset and scale with create more and larger mountains. Lowering the spread will reduce the distance between mountain ranges and reduce the size of the flat plains.


Code: Select all
np_hills         = NoiseParams(0,  3,  v3f(257,  257,  257),  6604,  6, 0.5,  2.0);
np_ridge_mnt     = NoiseParams(0,  12, v3f(743,  743,  743),  5520,  6, 0.7,  2.0);
np_step_mnt      = NoiseParams(0,  8,  v3f(509,  509,  509),  2590,  6, 0.6,  2.0);
// The spread determines the frequency of mountains. Usually a lower spread creates skinny mountains and a larger spread, wider mountains. But this is not always the case, as the height and terrain noises above play a big factor in the size also. If you want larger mountains of a certain type, add to the scale and increase the spread.


Code: Select all
np_mnt_var       = NoiseParams(0,  1,  v3f(499,  499,  499),  2490,  5, 0.6,  2.0);
// The only 3D noise I've added. Adds a small variation to mountains to create small overhangs, ridges/cliffs, etc. Can have a large influence when 2 or more mountain ranges meet, where the 3D noise will overlap as well, effectively doubled. This is where you can get some floating land, large overhangs or other strange rock formations. Decrease the scale and spread to minimize the influence.


Code: Select all
np_cave1         = NoiseParams(0,  12, v3f(61,   61,   61),   52534, 3, 0.5,  2.0);
np_cave2         = NoiseParams(0,  12, v3f(67,   67,   67),   10325, 3, 0.5,  2.0);
np_cavern        = NoiseParams(0,  1,  v3f(384,  128,  384),  723,   5, 0.63, 2.0);
// Copied from MGV7. 3 x 3D noises for caves/tunnels/caverns.



Screenshots:
+ Mountain tower and stone bridge. This is a result of two mountain noises meeting and the 3D variation being doubled. Weird things can happen.

+ Forested mountains surrounding a lake.

+ Is this a frozen waterfall?

+ Sandy plains and distant mountain range.

+ You can see the mountain ridge effect clearly here.

+ Queen Elsa's mountain where she 'let it go'.

+ Desert and distant mountains.

+ Standing on one mountain peak looking over to two others.

+ The step (terraced) mountain effect.
Last edited by demon_boy on Fri Jul 07, 2017 05:26, edited 12 times in total.
 

User avatar
duane
Member
 
Posts: 1591
Joined: Wed Aug 19, 2015 19:11
Location: Oklahoma City
GitHub: duane-r

Re: [C++ Mapgen] Carpathian (WIP)

by duane » Thu Apr 06, 2017 10:49

This is a great idea, and those screenshots look amazing. You may tempt me away from valleys. Personally, I'm getting sick of rivers. They're always in the way. And there's a lot to be said for flat land.
Believe in people and you don't need to believe anything else.
 

User avatar
burli
Member
 
Posts: 1641
Joined: Fri Apr 10, 2015 13:18

Re: [C++ Mapgen] Carpathian (WIP)

by burli » Thu Apr 06, 2017 11:13

Looks great. But I like rivers, rivers like in Minecraft. Of course they are in the way, but that's ok for me
 

User avatar
Sergey
Member
 
Posts: 784
Joined: Wed Jan 11, 2017 13:28
Location: Russia

Re: [C++ Mapgen] Carpathian (WIP)

by Sergey » Thu Apr 06, 2017 12:55

.
Last edited by Sergey on Thu Apr 06, 2017 13:59, edited 1 time in total.
 

User avatar
Sergey
Member
 
Posts: 784
Joined: Wed Jan 11, 2017 13:28
Location: Russia

Re: [C++ Mapgen] Carpathian (WIP)

by Sergey » Thu Apr 06, 2017 13:58

burli wrote:Looks great. But I like rivers, rivers like in Minecraft. Of course they are in the way, but that's ok for me

+1
I prefer valleys more than other mapgens.
 

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

Re: [C++ Mapgen] Carpathian (WIP)

by paramat » Thu Apr 06, 2017 15:53

Wow i'll test this out, good to see a C++ mapgen.
 

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

User avatar
Fixer
Member
 
Posts: 891
Joined: Sun Jul 31, 2011 11:23
Location: Ukraine
IRC: Fixer
In-game: Fixer
 

User avatar
duane
Member
 
Posts: 1591
Joined: Wed Aug 19, 2015 19:11
Location: Oklahoma City
GitHub: duane-r

Re: [C++ Mapgen] Carpathian (WIP)

by duane » Fri Apr 07, 2017 01:24

burli wrote:Looks great. But I like rivers, rivers like in Minecraft. Of course they are in the way, but that's ok for me


Well, rivers are easy to add to flat areas -- you don't have to try to fit them to the terrain. Or if they're confined to the uplands, they won't be in anyone's way. Maybe it could be an option.
Believe in people and you don't need to believe anything else.
 

User avatar
demon_boy
Member
 
Posts: 48
Joined: Thu Apr 09, 2015 10:53
Location: Melbourne, Australia
GitHub: vlapsley
In-game: demon_boy

Re: [C++ Mapgen] Carpathian (WIP)

by demon_boy » Fri Apr 07, 2017 01:27

duane wrote:
burli wrote:Looks great. But I like rivers, rivers like in Minecraft. Of course they are in the way, but that's ok for me


Well, rivers are easy to add to flat areas -- you don't have to try to fit them to the terrain. Or if they're confined to the uplands, they won't be in anyone's way. Maybe it could be an option.


A mapgen flag for rivers could be used like floatlands, dungeons, caves, etc in v7. Options either way.
 

User avatar
LNJ
Member
 
Posts: 247
Joined: Tue Sep 23, 2014 16:02
Location: Europe/Berlin
GitHub: LNJ2
IRC: LNJ2GO
In-game: LNJ

Re: [C++ Mapgen] Carpathian (WIP)

by LNJ » Fri Apr 07, 2017 16:04

The step mountains don't look so natural but nevertheless I really like them! Awesome! :)
Storage Drawers - The simplest item storage in Minetest
 

User avatar
Sergey
Member
 
Posts: 784
Joined: Wed Jan 11, 2017 13:28
Location: Russia

Re: [C++ Mapgen] Carpathian (WIP)

by Sergey » Fri Apr 07, 2017 18:52

The more mapgens the better.

Many people concerned about how to make MT more popular. This is one of the ways.
 

red-001
Member
 
Posts: 205
Joined: Tue Jan 26, 2016 20:15
GitHub: red-001
IRC: red-001
 

User avatar
duane
Member
 
Posts: 1591
Joined: Wed Aug 19, 2015 19:11
Location: Oklahoma City
GitHub: duane-r

Re: [C++ Mapgen] Carpathian (WIP)

by duane » Sat Apr 08, 2017 00:00

I'd really like to be able to keep the base terrain closer to zero without affecting the mountains. I frequently spawn in the cloud layer at the moment. I've tried monkeying with the code, but anything I change seems to destroy the mountain ranges.
Believe in people and you don't need to believe anything else.
 

red-001
Member
 
Posts: 205
Joined: Tue Jan 26, 2016 20:15
GitHub: red-001
IRC: red-001

Re: [C++ Mapgen] Carpathian (WIP)

by red-001 » Sat Apr 08, 2017 10:15

Could you fix not being able to change the water level? I tried fixing it myself but I ended up with underwater forests in the process.
 

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

Re: [C++ Mapgen] Carpathian (WIP)

by paramat » Sun Apr 09, 2017 05:35

It's better to adjust the terrain height than change water level, as all biomes have fixed y-limits.
This may be my fault as this is based on my C++ watershed Mapgen which may have a fixed water level.
 

User avatar
demon_boy
Member
 
Posts: 48
Joined: Thu Apr 09, 2015 10:53
Location: Melbourne, Australia
GitHub: vlapsley
In-game: demon_boy

Re: [C++ Mapgen] Carpathian (WIP)

by demon_boy » Mon Apr 10, 2017 01:10

LNJ wrote:The step mountains don't look so natural but nevertheless I really like them! Awesome! :)


Well, step or terraced mountains do exist naturally, but they are more eroded. Just think the step mountains in this mapgen are more like the terraced rice fields throughout Asia. Whilst not strictly part of the Carpathians, the step mountains do make this mapgen unique.

duane wrote:I'd really like to be able to keep the base terrain closer to zero without affecting the mountains. I frequently spawn in the cloud layer at the moment. I've tried monkeying with the code, but anything I change seems to destroy the mountain ranges.


I've found sometimes a map seed will create no land at all, just air and water. Exit and recreate with the same seed and it works correctly. *baffled*
Did you by chance recreate the mapgen off V7 mapgen code? I've tried that but all I get is the base terrain and no mountains.

red-001 wrote:Could you fix not being able to change the water level? I tried fixing it myself but I ended up with underwater forests in the process.


Yeah, that would be good. I'm working on it. But as Paramat said, it's probably related to the fact I used his Watershed mapgen as a base.
 

User avatar
TumeniNodes
Member
 
Posts: 2827
Joined: Fri Feb 26, 2016 19:49
Location: in the dark recesses of the mind
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes

Re: [C++ Mapgen] Carpathian (WIP)

by TumeniNodes » Mon Apr 10, 2017 02:45

side note: underwater forests sounds pretty dang cool. jus sayin
Ich mag keine grünen Eier und Schinken, ich mag sie nicht Sam I Am
 

User avatar
duane
Member
 
Posts: 1591
Joined: Wed Aug 19, 2015 19:11
Location: Oklahoma City
GitHub: duane-r

Re: [C++ Mapgen] Carpathian (WIP)

by duane » Mon Apr 10, 2017 03:16

demon_boy wrote:
duane wrote:I'd really like to be able to keep the base terrain closer to zero without affecting the mountains. I frequently spawn in the cloud layer at the moment. I've tried monkeying with the code, but anything I change seems to destroy the mountain ranges.


I've found sometimes a map seed will create no land at all, just air and water. Exit and recreate with the same seed and it works correctly. *baffled*


That makes me think that it's a problem when the chunks are generated in a particular order (or simultaneously in different threads), although I'm not certain what would cause that. I'm assuming that there are no cases where density would never exceed zero in any column -- this would be a problem.

Did you by chance recreate the mapgen off V7 mapgen code? I've tried that but all I get is the base terrain and no mountains.


I don't understand what you're asking here. Most of what I changed when I was testing were noise functions.
Believe in people and you don't need to believe anything else.
 

User avatar
demon_boy
Member
 
Posts: 48
Joined: Thu Apr 09, 2015 10:53
Location: Melbourne, Australia
GitHub: vlapsley
In-game: demon_boy

Re: [C++ Mapgen] Carpathian (WIP)

by demon_boy » Mon Apr 10, 2017 06:12

duane wrote:
demon_boy wrote:Did you by chance recreate the mapgen off V7 mapgen code? I've tried that but all I get is the base terrain and no mountains.

I don't understand what you're asking here. Most of what I changed when I was testing were noise functions.


Sorry I'll explain myself better. I tried refactoring the mapgen to use MGV7 as a base.

For instance, using this code and associated functions:
Code: Select all
      for (s16 y = node_min.Y - 1; y <= node_max.Y + 1; y++) {
         if (vm->m_data[vi].getContent() == CONTENT_IGNORE) {
            if (y <= surface_y) {
               vm->m_data[vi] = n_stone;  // Base terrain
            } else if ((spflags & MGV7_MOUNTAINS) &&
                  getMountainTerrainFromMap(index3d, index2d, y)) {
               vm->m_data[vi] = n_stone;  // Mountain terrain
               if (y > stone_surface_max_y)
                  stone_surface_max_y = y;
            } else if ((spflags & MGV7_FLOATLANDS) &&
                  ((y >= float_base_min && y <= float_base_max) ||
                  getFloatlandMountainFromMap(index3d, index2d, y))) {
               vm->m_data[vi] = n_stone;  // Floatland terrain
               stone_surface_max_y = node_max.Y;
            } else if (y <= water_level) {
               vm->m_data[vi] = n_water;  // Ground level water
            } else if ((spflags & MGV7_FLOATLANDS) &&
                  (y >= float_base_max && y <= floatland_level)) {
               vm->m_data[vi] = n_water;  // Floatland water
            } else {
               vm->m_data[vi] = n_air;
            }
         }
         vm->m_area.add_y(em, vi, 1);
         index3d += ystride;
      }


It generated the terrain base noise, but I couldn't get it to generate any mountains at all.

I'll follow up with a post on how the noises work.
 

User avatar
demon_boy
Member
 
Posts: 48
Joined: Thu Apr 09, 2015 10:53
Location: Melbourne, Australia
GitHub: vlapsley
In-game: demon_boy

Re: [C++ Mapgen] Carpathian (WIP)

by demon_boy » Mon Apr 10, 2017 06:37

I previously documented noises here, but mapgen refactoring made these obsolete.
Last edited by demon_boy on Tue May 16, 2017 06:38, edited 2 times in total.
 

User avatar
demon_boy
Member
 
Posts: 48
Joined: Thu Apr 09, 2015 10:53
Location: Melbourne, Australia
GitHub: vlapsley
In-game: demon_boy

Re: [C++ Mapgen] Carpathian (WIP)

by demon_boy » Mon Apr 10, 2017 11:46

I've also uploaded the original Lua mapgen I worked on before the C++ version.
Carpathian Mapgen (Lua) on GitHub

It can be easier to see what the noises do here. It's certainly faster to make changes without having to compile.
But note, the Lua and C++ mapgen output are not the same.
 

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

User avatar
demon_boy
Member
 
Posts: 48
Joined: Thu Apr 09, 2015 10:53
Location: Melbourne, Australia
GitHub: vlapsley
In-game: demon_boy

Re: [C++ Mapgen] Carpathian (WIP)

by demon_boy » Thu Apr 13, 2017 05:37

UPDATE

I've refactored the mapgen based on mgv7. Changes:
  • It's now stable. So the mapgen doesn't spawn you in thin air, or stuff up the heightmap.
  • I've changed the terrain scale from 128 to 96. This results in less extreme mountains.
  • Added two new noises - sea and sea_depth - these control slope of base terrain/beach and sea bed depth respectively.
  • Unfortunately, the base terrain no longer has an influence on mountains, so you can get a downward slope on base terrain and then a large mountain jutting out of the ground. You've probably seen this in mgv7. A feature I'm not happy with. The ground should on most occasions slope up when approaching a mountain. Expect changes.
  • I've changed the algorithm for eased mountains. They now look more like flat, rounded hills, as I first intended.

Whilst I'm happy that the mapgen is stable on all seeds I tested, it doesn't look as visually appealing. Test away, let me know what you think.

I think I've made it harder to add rivers, I did have a really good idea in my head with the previous version. But this refactored version basically creates a base terrain and then plops mountains on top. So having a river start in the mountains and flow through a valley on base terrain is currently impossible. So as I said above, expect changes.
 

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

Next

Return to WIP Mods



Who is online

Users browsing this forum: luk3yx and 5 guests