[C++ Mapgen] Carpathian (MERGED)

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

[C++ Mapgen] Carpathian (MERGED)

by demon_boy » Post

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:
Spoiler
Image
Spoiler
Image
Spoiler
Image
Spoiler
Image
Spoiler
Image
Spoiler
Image
Spoiler
Image
Spoiler
Image
Spoiler
Image
Last edited by demon_boy on Fri Jul 07, 2017 05:26, edited 12 times in total.

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

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

by duane » Post

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: 1643
Joined: Fri Apr 10, 2015 13:18

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

by burli » Post

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 » Post

.
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 » Post

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: 3700
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat
IRC: paramat
Location: UK

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

by paramat » Post

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

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

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

by azekill_DIABLO » Post

i like it!
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!

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

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

by Fixer » Post

Very nice!

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

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

by duane » Post

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
GitHub: vlapsley
In-game: demon_boy
Location: Melbourne, Australia

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

by demon_boy » Post

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.

LNJ
Member
Posts: 252
Joined: Tue Sep 23, 2014 16:02
GitHub: lnjX
IRC: LNJ
In-game: LNJ
Location: Europe/Berlin

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

by LNJ » Post

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 » Post

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

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

by red-001 » Post

Wow this generates some awesome terrain.
Image
Image

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

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

by duane » Post

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 » Post

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: 3700
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat
IRC: paramat
Location: UK

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

by paramat » Post

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
GitHub: vlapsley
In-game: demon_boy
Location: Melbourne, Australia

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

by demon_boy » Post

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: 2941
Joined: Fri Feb 26, 2016 19:49
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes
Location: in the dark recesses of the mind
Contact:

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

by TumeniNodes » Post

side note: underwater forests sounds pretty dang cool. jus sayin
A Wonderful World

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

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

by duane » Post

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
GitHub: vlapsley
In-game: demon_boy
Location: Melbourne, Australia

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

by demon_boy » Post

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
GitHub: vlapsley
In-game: demon_boy
Location: Melbourne, Australia

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

by demon_boy » Post

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
GitHub: vlapsley
In-game: demon_boy
Location: Melbourne, Australia

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

by demon_boy » Post

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: 7507
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

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

by azekill_DIABLO » Post

thanks, i'll try it!
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!

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

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

by demon_boy » Post

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: 7507
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

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

by azekill_DIABLO » Post

awesome work, i think this should be somewhat merged with mineest
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 9 guests