[Mod][Merged] Valleys Mapgen [valleys_mapgen]

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

The Story It Told, About A River That Flowed...

by duane » Post

Rivers running through my deserts annoy me. I've tried getting the biomes to cooperate and put just a bit of vegetation around them, but it always adds too much complication to the code. So, I went the opposite route -- rivers gradually dry up as you approach desert regions, leaving nothing but desolate channels and endless thirst.

Image

I'm still testing this, but if you'd like to try it, it's on github.
Attachments
c-demo-79.jpg
(293.03 KiB) Not downloaded yet
Believe in people and you don't need to believe anything else.

Ivà
Member
Posts: 115
Joined: Sun Feb 22, 2015 07:11
GitHub: melzua
IRC: melzua
In-game: melzua
Location: Catalonia

Re: [Mod][WIP] Valleys Mapgen [valleys_mapgen]

by Ivà » Post

+1 @duane. Good idea.

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

Re: [Mod][WIP] Valleys Mapgen [valleys_mapgen]

by Gael de Sailly » Post

Is that normal to find a dry river in the jungle?

Image
screenshot_20160212_121623.png
(1012 KiB) Not downloaded yet
(imgur won't upload this image, maybe because that's my 101th one?)
Just realize how bored we would be if the world was perfect.

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

Re: [Mod][WIP] Valleys Mapgen [valleys_mapgen]

by duane » Post

Gael de Sailly wrote:Is that normal to find a dry river in the jungle?
That's a case of a high-heat, low-humidity jungle. It's another balancing act between losing water in hot jungles or losing water in dry grasslands. Once I get the basics working, I'll try to adjust it for the extremes.

Needless to say, it'll be a lot easier to add it to the lua.

I also found another bug in the humidity handling, though it doesn't seem to have much obvious effect.
Believe in people and you don't need to believe anything else.

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

Re: [Mod][WIP] Valleys Mapgen [valleys_mapgen]

by duane » Post

Just when I think I've got the riverbeds working, I realize that I've made the jungle tree problem even worse.

Image

Back to the drawing board.
Attachments
c-demo-80.jpg
(291.89 KiB) Not downloaded yet
Believe in people and you don't need to believe anything else.

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

Re: [Mod][WIP] Valleys Mapgen [valleys_mapgen]

by Gael de Sailly » Post

I've made a beautiful screenshot but I can't upload it on imgur and on minetest forums :-/
duane wrote:Just when I think I've got the riverbeds working, I realize that I've made the jungle tree problem even worse.

Back to the drawing board.
:-(

I think I've found the explanation for the incoherent biome repartition around rivers (where there is a dry savanna next to the river and a grassland higher). The current biome system uses Voronoi diagrams to define biomes. I've made a diagram with GeoGebra.
+ Spoiler
That's not due to humidity, but to temperature. The temperature is decreased (leftward move), so it may leave the "savanna" zone and enter the grassland or forest zone, without humidity change. So that's these biomes that are incoherent.
Attachments
Biomes.png
(53.72 KiB) Not downloaded yet
Just realize how bored we would be if the world was perfect.

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

Re: [Mod][WIP] Valleys Mapgen [valleys_mapgen]

by paramat » Post

Thanks for the diagram, i added a background making the best attempt at keeping all biome names readable.
The biome system being a voronoi diagram makes it very difficult to tune and balance, months of work and many problems, for example rainforest can meet coniferous forest at extreme humidity.

Image

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

Re: [Mod][WIP] Valleys Mapgen [valleys_mapgen]

by duane » Post

Gael de Sailly wrote:I think I've found the explanation for the incoherent biome repartition around rivers (where there is a dry savanna next to the river and a grassland higher)...
That's not due to humidity, but to temperature. The temperature is decreased (leftward move), so it may leave the "savanna" zone and enter the grassland or forest zone, without humidity change. So that's these biomes that are incoherent.
You're right, of course. The biomes would probably work better without any extra temperature/humidity changes, using stricter altitude limits.

However, the problem in my screenshot turns out to be the decrease in altitude in the riverbed raising the humidity. So, at least that was easy to fix.

Image
Attachments
c-demo-81.jpg
(271.51 KiB) Not downloaded yet
Believe in people and you don't need to believe anything else.

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

Re: [Mod][WIP] Valleys Mapgen [valleys_mapgen]

by Gael de Sailly » Post

duane wrote:
Gael de Sailly wrote:The biomes would probably work better without any extra temperature/humidity changes, using stricter altitude limits.
I don't think so. I think we should modify the biomes. I think the savanna biome is way too high in humidity.

@paramat, if you're interested by the diagram, here is the source file, (geogebra file, rename it to biomes.ggb).
Biomes.zip
(7.64 KiB) Downloaded 23 times
Just realize how bored we would be if the world was perfect.

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

Re: [Mod][WIP] Valleys Mapgen [valleys_mapgen]

by Fixer » Post

duane wrote:So, at least that was easy to fix.
Image
Is it possible to encounter same savannah but more hot one, so river will be without jungles? or it is always jungles in savannah river?

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

Mucking With Biomes

by duane » Post

This is kind of interesting. Now the jungle is surrounding the savanna.

Image

Code: Select all

diff --git a/mods/default/mapgen.lua b/mods/default/mapgen.lua
index c92514c..fe50cbb 100644
--- a/mods/default/mapgen.lua
+++ b/mods/default/mapgen.lua
@@ -672,7 +672,7 @@ function default.register_biomes()
 		y_min = 5,
 		y_max = 31000,
 		heat_point = 85,
-		humidity_point = 20,
+		humidity_point = 10,
 	})
 
 	minetest.register_biome({
@@ -690,7 +690,7 @@ function default.register_biomes()
 		y_min = -112,
 		y_max = 4,
 		heat_point = 85,
-		humidity_point = 20,
+		humidity_point = 10,
 	})
 
 
@@ -708,8 +708,8 @@ function default.register_biomes()
 		--node_river_water = "",
 		y_min = 1,
 		y_max = 31000,
-		heat_point = 85,
-		humidity_point = 50,
+		heat_point = 65,
+		humidity_point = 30,
 	})
 
 	minetest.register_biome({
@@ -726,8 +726,8 @@ function default.register_biomes()
 		--node_river_water = "",
 		y_min = -3,
 		y_max = 0,
-		heat_point = 85,
-		humidity_point = 50,
+		heat_point = 65,
+		humidity_point = 30,
 	})
 
 	minetest.register_biome({
@@ -744,8 +744,8 @@ function default.register_biomes()
 		--node_river_water = "",
 		y_min = -112,
 		y_max = -4,
-		heat_point = 85,
-		humidity_point = 50,
+		heat_point = 65,
+		humidity_point = 30,
 	})
 
 
Attachments
c-demo-82.jpg
(273.89 KiB) Not downloaded yet
Last edited by duane on Tue Feb 16, 2016 16:26, edited 1 time in total.
Believe in people and you don't need to believe anything else.

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

Re: [Mod][WIP] Valleys Mapgen [valleys_mapgen]

by duane » Post

Fixerol wrote:Is it possible to encounter same savannah but more hot one, so river will be without jungles? or it is always jungles in savannah river?
Well, check the diagrams above. If you have hot + humid, it's always going to be jungle. Savannah, desert, and jungle share the same heat range.
Believe in people and you don't need to believe anything else.

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

Re: [Mod][WIP] Valleys Mapgen [valleys_mapgen]

by Gael de Sailly » Post

The same diagram with your changes:
+ Spoiler
It looks strange at first but I think it could be better than the current biomes.
Just realize how bored we would be if the world was perfect.

sofar
Developer
Posts: 2132
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: [Mod][WIP] Valleys Mapgen [valleys_mapgen]

by sofar » Post

paramat wrote:many problems, for example rainforest can meet coniferous forest at extreme humidity.
This is entirely valid, and happens in many locations in real-life. For instance, not more than 80km away from me, there is a coastal rainforest that is directly backed by conifers.

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

Re: [Mod][WIP] Valleys Mapgen [valleys_mapgen]

by Gael de Sailly » Post

sofar wrote:
paramat wrote:many problems, for example rainforest can meet coniferous forest at extreme humidity.
This is entirely valid, and happens in many locations in real-life. For instance, not more than 80km away from me, there is a coastal rainforest that is directly backed by conifers.
The tropical conifer forest exists, but that's not the same conifers than on tempered forests.
Anyway I think that's not a major problem for MT's biomes.
Just realize how bored we would be if the world was perfect.

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

Mucking With Biomes

by duane » Post

I like having a green border around jungles, rather than going straight to savanna. Of course, ethereal had this long ago.

Image

It's getting complicated.

Image
Attachments
biomes_patch.zip
(1 KiB) Downloaded 16 times
biome-chart-02.jpg
(106.62 KiB) Not downloaded yet
c-demo-83.jpg
(326.61 KiB) Not downloaded yet
Believe in people and you don't need to believe anything else.

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

Re: [Mod][WIP] Valleys Mapgen [valleys_mapgen]

by prof-turbo » Post

This looks amazing °.°

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

Re: [Mod][WIP] Valleys Mapgen [valleys_mapgen]

by Gael de Sailly » Post

duane wrote:[…] the altitude chill code decreases temperature logarithmically (whereas, reality decreases it linearly).
The Lua VMG uses only positive values. That's not the case for the C++ VMG. Temperature is from -20 to 120, so the exponential decreasing of the temperature (valleys_mapgen.cpp:621-623) is inverted on very cold places. It should be linear.
Just realize how bored we would be if the world was perfect.

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

Re: [Mod][WIP] Valleys Mapgen [valleys_mapgen]

by duane » Post

Gael de Sailly wrote:
duane wrote:[…] the altitude chill code decreases temperature logarithmically (whereas, reality decreases it linearly).
The Lua VMG uses only positive values. That's not the case for the C++ VMG. Temperature is from -20 to 120, so the exponential decreasing of the temperature (valleys_mapgen.cpp:621-623) is inverted on very cold places. It should be linear.
Well, how about this?

Code: Select all

noise_heat->result[index_2d] -= 20.f * t_alt / altitude_chill;
The drawback is that biome temperature fluctuations are much more prominent, causing the snow line to be more ragged. It doesn't look as pretty to me. On the plus side, it's a bit faster to generate.

Image

I don't think many mods are going to be too particular about what happens below zero temperature, so it probably won't be a major issue.
Attachments
c-demo-88.jpg
(293.33 KiB) Not downloaded yet
Believe in people and you don't need to believe anything else.

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

Re: [Mod][WIP] Valleys Mapgen [valleys_mapgen]

by Gael de Sailly » Post

duane wrote:Image
I've tried to change the altitude chill code with what you have proposed, and I've not seen these strange snow lines, even with the same world seed (from your dry_rivers branch):
Image

But I've found another problem that only occurs with dry_rivers: jungle trees growing in the river where the river meets the sea, at y=0 only.
Image
I've uploaded the images on GitHub by dragging-dropping on a comment field. I don't know whether they will be deleted since they're not used in GitHub.
Attachments
linear_altitude.patch.zip
(622 Bytes) Downloaded 20 times
Just realize how bored we would be if the world was perfect.

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

Re: [Mod][WIP] Valleys Mapgen [valleys_mapgen]

by duane » Post

Gael de Sailly wrote:I've tried to change the altitude chill code with what you have proposed, and I've not seen these strange snow lines, even with the same world seed (from your dry_rivers branch)
Well, I probably made a mistake at some point. It's not a major issue for me. Both methods give similar results within the area most people will be focused on. If you and paramat like this method, I'll try to put it into the dry_rivers patch. This is what I'm testing at the moment, though I haven't had much time to focus on it yet:

Code: Select all

diff --git a/src/mapgen_valleys.cpp b/src/mapgen_valleys.cpp
index 94abed3..77a9785 100644
--- a/src/mapgen_valleys.cpp
+++ b/src/mapgen_valleys.cpp
@@ -597,7 +599,8 @@ int MapgenValleys::generateTerrain()
 			// Derive heat from (base) altitude. This will be most correct
 			// at rivers, since other surface heights may vary below.
 			if (use_altitude_chill && (surface_y > 0 || river_y > 0))
-				t_heat *= pow(0.5f, MYMAX(surface_y, river_y) / altitude_chill);
+				//t_heat *= pow(0.5f, MYMAX(surface_y, river_y) / altitude_chill);
+				t_heat -= 20.f * MYMAX(surface_y, river_y) / altitude_chill;
 
 			// If humidity is low or heat is high, lower the water table.
 			float delta = noise_humidity->result[index_2d] - 50.f;
@@ -661,7 +664,8 @@ int MapgenValleys::generateTerrain()
 			// This is similar to the lua version's seawater adjustment,
 			// but doesn't increase the base humidity.
 			if (t_alt > 0)
-				humid *= pow(0.5f, t_alt / altitude_chill);
+				//humid *= pow(0.5f, t_alt / altitude_chill);
+				humid -= 20.f * t_alt / altitude_chill;
 			noise_humidity->result[index_2d] = humid;
 		}
 
@@ -674,8 +678,8 @@ int MapgenValleys::generateTerrain()
 				// The altitude hasn't changed. Use the first result.
 				noise_heat->result[index_2d] = t_heat;
 			else if (t_alt > 0)
-				noise_heat->result[index_2d] *=
-					pow(0.5f, t_alt / altitude_chill);
+				//noise_heat->result[index_2d] *= pow(0.5f, t_alt / altitude_chill);
+				noise_heat->result[index_2d] -= 20.f * t_alt / altitude_chill;
 		}
 	}
 
I think I'll have to tone down the humidity change, since I'm seeing more cold desert than I'd like, even when it's set down to zero humidity. One good thing I've noticed is that the biome noises are more prominent, causing the trees clump together better, rather than trying to follow rivers.
Believe in people and you don't need to believe anything else.

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

Re: [Mod][Merged] Valleys Mapgen [valleys_mapgen]

by Gael de Sailly » Post

I would like to keep the logarithmic humidity increase near the rivers. The influence of the rivers on humidity is important when you are close to the river, and becomes quickly insignificant when climbing up, contrary to the altitude chill that is linear. But I have not tested your code. If you think that's better, you can commit it.
Just realize how bored we would be if the world was perfect.

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

Re: [Mod][Merged] Valleys Mapgen [valleys_mapgen]

by duane » Post

Gael de Sailly wrote:I would like to keep the logarithmic humidity increase near the rivers. The influence of the rivers on humidity is important when you are close to the river, and becomes quickly insignificant when climbing up, contrary to the altitude chill that is linear. But I have not tested your code. If you think that's better, you can commit it.
I agree. I mean to keep the logarithmic function near rivers. The humidity change there is, of course, for the altitude function that (sort of) takes the place of the sea-level humidity and soil thickness functions in the lua. It's helpful, but a bit too strong as I posted it.
Believe in people and you don't need to believe anything else.

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

Re: The Story It Told, About A River That Flowed...

by duane » Post

In case anyone missed it, the mainline minetest code now features dry riverbeds where the humidity is low. We also managed to correct some technical problems that may have been causing caves and dungeons to spawn in weird places, made swamps look less sandy and more swampy, removed river water from the seas, figured out a more robust way of varying humidity and temperature by altitude, and made the heightmap more accurate for mods.

All of these changes should appear in the upcoming minetest version.

Image
Attachments
c-demo-91.jpg
(244.05 KiB) Not downloaded yet
Believe in people and you don't need to believe anything else.

User avatar
Don
Member
Posts: 1643
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: [Mod][Merged] Valleys Mapgen [valleys_mapgen]

by Don » Post

Nice work!
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here

Post Reply

Who is online

Users browsing this forum: hotcyr, XenoXenno and 4 guests