How to Increase the number of dungeons generated by mapgen

Post Reply
User avatar
Neuromancer
Member
Posts: 964
Joined: Tue Jun 12, 2012 22:28
GitHub: Neuromancer56

How to Increase the number of dungeons generated by mapgen

by Neuromancer » Post

How can I increase the number of dungeons generated by mapgen? The only reference I found to dungeon in minetest game is in C:\Users\Audoo\Downloads\minetest-0.4.13-win64-msvc\minetest-0.4.13\games\minetest_game\mods\default\mapgen.lua but I couldn't find where I could increase the number of dungeons in the mapgen. Is it part of the engine, or is there a .lua file I can tweak?

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

Re: How to Increase the number of dungeons generated by mapg

by sofar » Post

Modify the mgv7_np_cave1 perlin noise, or the mgv6_np_cave noise for mgv6.

You can edit map_meta.txt in your world and regenerating all the terrain by removing map.sqlite (while your server is shut down), and try and play with it.

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

Re: How to Increase the number of dungeons generated by mapg

by paramat » Post

^ Cave noise won't affect dungeons.

Only up to 1 dungeon is generated per chunk, and each has up to 16 rooms, both these values are hardcoded in C++. There is such a thing as dungeon parameters, currently inaccessible to players, dungeon number per chunk and room number could be added. If i can work out how to make dungeon parameters settable i'll do it.

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

Re: How to Increase the number of dungeons generated by mapg

by duane » Post

paramat wrote:Only up to 1 dungeon is generated per chunk, and each has up to 16 rooms, both these values are hardcoded in C++. There is such a thing as dungeon parameters, currently inaccessible to players, dungeon number per chunk and room number could be added. If i can work out how to make dungeon parameters settable i'll do it.
If you didn't want more than one per chunk (which seems extravagant to me), wouldn't just exposing the dungeon rarity noise be sufficient? Adding more rooms would be nice, but it might end up being a pain.

Code: Select all

diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt
index 2521140..f2b313e 100644
--- a/builtin/settingtypes.txt
+++ b/builtin/settingtypes.txt
@@ -865,6 +865,9 @@ mg_biome_np_heat_blend (Mapgen heat blend noise parameters) noise_params 0, 1.5,
 mg_biome_np_humidity (Mapgen biome humidity noise parameters) noise_params 50, 50, (750, 750, 750), 842, 3, 0.5, 2.0
 mg_biome_np_humidity_blend (Mapgen biome humidity blend noise parameters) noise_params 0, 1.5, (8, 8, 8), 90003, 2, 1.0, 2.0
 
+#    Noise parameters for dungeon generation.
+mg_dungeon_rarity (Mapgen dungeon frequency noise) noise_params 0, 1, (500, 500, 500, 0, 2, 0.8, 2.0
+
 [***Mapgen v5]
 
 mgv5_np_filler_depth (Mapgen v5 filler depth noise parameters) noise_params 0, 1, (150, 150, 150), 261, 4, 0.7, 2.0
diff --git a/minetest.conf.example b/minetest.conf.example
index 4dd6d95..dd79aac 100644
--- a/minetest.conf.example
+++ b/minetest.conf.example
@@ -1071,6 +1071,9 @@
 #    type: noise_params
 # mg_biome_np_humidity_blend = 0, 1.5, (8, 8, 8), 90003, 2, 1.0, 2.0
 
+#    Noise parameters for dungeon generation.
+#mg_dungeon_rarity = 0, 1, (500, 500, 500, 0, 2, 0.8, 2.0
+
 #### Mapgen v5
 
 #    type: noise_params
diff --git a/src/mapgen.cpp b/src/mapgen.cpp
index 36d19bf..e4836a9 100644
--- a/src/mapgen.cpp
+++ b/src/mapgen.cpp
@@ -436,6 +436,7 @@ void MapgenParams::load(const Settings &settings)
 	settings.getNoiseParams("mg_biome_np_heat_blend", np_biome_heat_blend);
 	settings.getNoiseParams("mg_biome_np_humidity", np_biome_humidity);
 	settings.getNoiseParams("mg_biome_np_humidity_blend", np_biome_humidity_blend);
+	settings.getNoiseParams("mg_dungeon_rarity", np_dungeon_rarity);
 
 	delete sparams;
 	MapgenFactory *mgfactory = EmergeManager::getMapgenFactory(mg_name);
diff --git a/src/mapgen.h b/src/mapgen.h
index 9bb7d03..0d093e5 100644
--- a/src/mapgen.h
+++ b/src/mapgen.h
@@ -120,6 +120,8 @@ struct MapgenParams {
 	NoiseParams np_biome_humidity;
 	NoiseParams np_biome_humidity_blend;
 
+	NoiseParams np_dungeon_rarity;
+
 	MapgenSpecificParams *sparams;
 
 	MapgenParams() :
@@ -132,6 +134,7 @@ struct MapgenParams {
 		np_biome_heat_blend(NoiseParams(0, 1.5, v3f(8.0, 8.0, 8.0), 13, 2, 1.0, 2.0)),
 		np_biome_humidity(NoiseParams(50, 50, v3f(750.0, 750.0, 750.0), 842, 3, 0.5, 2.0)),
 		np_biome_humidity_blend(NoiseParams(0, 1.5, v3f(8.0, 8.0, 8.0), 90003, 2, 1.0, 2.0)),
+		np_dungeon_rarity(NoiseParams(0.0, 1.0, v3f(500.0, 500.0, 500.0), 0, 2, 0.8, 2.0)),
 		sparams(NULL)
 	{}
 
diff --git a/src/mapgen_valleys.cpp b/src/mapgen_valleys.cpp
index d64d7e0..7607b8b 100644
--- a/src/mapgen_valleys.cpp
+++ b/src/mapgen_valleys.cpp
@@ -93,6 +93,7 @@ MapgenValleys::MapgenValleys(int mapgenid, MapgenParams *params, EmergeManager *
 
 	this->altitude_chill        = sp->altitude_chill;
 	this->cave_water_max_height = sp->cave_water_max_height;
+	this->dungeon_rarity        = &params->np_dungeon_rarity;
 	this->humidity_adjust       = sp->humidity - 50.f;
 	this->humidity_break_point  = sp->humidity_break_point;
 	this->lava_max_height       = sp->lava_max_height;
@@ -309,7 +310,7 @@ void MapgenValleys::makeChunk(BlockMakeData *data)
 	if ((flags & MG_DUNGEONS) && node_max.Y < 50 && (stone_surface_max_y >= node_min.Y)) {
 		DungeonParams dp;
 
-		dp.np_rarity  = nparams_dungeon_rarity;
+		dp.np_rarity  = *dungeon_rarity;
 		dp.np_density = nparams_dungeon_density;
 		dp.np_wetness = nparams_dungeon_wetness;
 		dp.c_water    = c_water_source;
diff --git a/src/mapgen_valleys.h b/src/mapgen_valleys.h
index 8ac2cf2..b3691d2 100644
--- a/src/mapgen_valleys.h
+++ b/src/mapgen_valleys.h
@@ -65,6 +65,7 @@ struct MapgenValleysParams : public MapgenSpecificParams {
 	NoiseParams np_biome_humidity_blend;
 	NoiseParams np_cliffs;
 	NoiseParams np_corr;
+	NoiseParams np_dungeon_rarity;
 	NoiseParams np_filler_depth;
 	NoiseParams np_inter_valley_fill;
 	NoiseParams np_inter_valley_slope;
@@ -121,6 +122,7 @@ class MapgenValleys : public Mapgen {
 
 	float altitude_chill;
 	float cave_water_max_height;
+	NoiseParams *dungeon_rarity;
 	float humidity_adjust;
 	float humidity_break_point;
 	float lava_max_height;
Believe in people and you don't need to believe anything else.

User avatar
Neuromancer
Member
Posts: 964
Joined: Tue Jun 12, 2012 22:28
GitHub: Neuromancer56

Re: How to Increase the number of dungeons generated by mapg

by Neuromancer » Post

Decorated Dungeon
Decorated Dungeon
dungeon.jpg (241.89 KiB) Viewed 274 times
If you do make any changes, anything you can do to make them more easily decoratable, say by being able to get the coordinates of the room boundaries would be way cool. That way you could figure out a good place to put anvils, cauldrons, book cases, cobwebs, chandeliers, dead torches, chests and the like would be wonderful. Also it would be nice to have rooms with more varied heights. Most of them are either extremely tall, or just 2 blocks tall. It would be good to have some 3 & 4 blocks tall. Although I'm wondering if it just makes more sense to go more the route of the villages modpack, and have a bunch of pre-decorated dungeon rooms that could be appended on to dungeons. It seems like x-decor would be needed to decorate these dungeons, The cobwebs, iron bars, barrels, etc

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

Re: How to Increase the number of dungeons generated by mapg

by paramat » Post

> If you didn't want more than one per chunk (which seems extravagant to me), wouldn't just exposing the dungeon rarity noise be sufficient?

Yes.

Dungeon room height varies but also depends on whether they are stone or sandstone dungeons or desert temples.

Post Reply

Who is online

Users browsing this forum: Gmr_Leon and 4 guests