[Mod][Merged] Valleys Mapgen [valleys_mapgen]
- benrob0329
- Member
- Posts: 1341
- Joined: Thu Aug 06, 2015 22:39
- GitHub: Benrob0329
- IRC: benrob0329
- In-game: benrob03
- Location: Michigan
- Contact:
Re: [Mod][WIP] Valleys Mapgen [valleys_mapgen]
Who says Minetest can't look stunning?
- paramat
- Developer
- Posts: 3700
- Joined: Sun Oct 28, 2012 00:05
- GitHub: paramat
- IRC: paramat
- Location: UK
Re: [Mod][WIP] Valleys Mapgen [valleys_mapgen]
Okay let's keep simple caves as an option for now, especially since caves seem to be in development, for now your new PR is good for sorting out the other stuff.
Last edited by paramat on Mon Jan 25, 2016 20:40, edited 2 times in total.
Re: [Mod][WIP] Valleys Mapgen [valleys_mapgen]
minetest-0.4.13-3c6b2ff
sfan5 win32-dev-build
I made a new map with mapgen valleys and following error messages appears!
sfan5 win32-dev-build
I made a new map with mapgen valleys and following error messages appears!
Code: Select all
2016-01-14 19:31:05: ERROR[Main]: get_biome_list: failed to get biome 'stone_grassland'
2016-01-14 19:31:05: ERROR[Main]: get_biome_list: failed to get biome 'sandstone_grassland'
2016-01-14 19:31:05: ERROR[Main]: get_biome_list: failed to get biome 'deciduous_forest'
2016-01-14 19:31:05: ERROR[Main]: get_biome_list: failed to get biome 'coniferous_forest'
2016-01-14 19:31:05: ERROR[Main]: register_decoration: couldn't get all biomes
- paramat
- Developer
- Posts: 3700
- Joined: Sun Oct 28, 2012 00:05
- GitHub: paramat
- IRC: paramat
- Location: UK
Re: [Mod][WIP] Valleys Mapgen [valleys_mapgen]
Which version of valleys mapgen are you using?
- paramat
- Developer
- Posts: 3700
- Joined: Sun Oct 28, 2012 00:05
- GitHub: paramat
- IRC: paramat
- Location: UK
Re: [Mod][WIP] Valleys Mapgen [valleys_mapgen]
Yes exactly, my approximate figure of 20 is from comparing C++ mgwatershed at 100ms per chunk to lua watershed at 2s per chunk. But i forgot that the mgwatershed time doesn't include lighting calculations, and lua watershed has heavier use of 3D noise, so 20 is excessive, probably more like 10.duane wrote:I suspect we're both right, but for devious reasons. Lua runs very fast, and as far as crunching numbers, C/C++ doesn't beat it by much, but every time you make a call to the minetest functions, there's a lot of overhead involved.
Re: [Mod][WIP] Valleys Mapgen [valleys_mapgen]
I use minetest_next as subgame.cHyper wrote:minetest-0.4.13-3c6b2ff
sfan5 win32-dev-build
I made a new map with mapgen valleys and following error messages appears!
Code: Select all
2016-01-14 19:31:05: ERROR[Main]: get_biome_list: failed to get biome 'stone_grassland' 2016-01-14 19:31:05: ERROR[Main]: get_biome_list: failed to get biome 'sandstone_grassland' 2016-01-14 19:31:05: ERROR[Main]: get_biome_list: failed to get biome 'deciduous_forest' 2016-01-14 19:31:05: ERROR[Main]: get_biome_list: failed to get biome 'coniferous_forest' 2016-01-14 19:31:05: ERROR[Main]: register_decoration: couldn't get all biomes
Re: [Mod][WIP] Valleys Mapgen [valleys_mapgen]
Yeah, I was looking at the code and noticed it would not be too terribly difficult to add in but... it looked like I would have to convert the z/y/x loops in Subterrain into the z/x/y of the cave gen code. It was three in the morning and I couldn't wrap my head around it. I will take a look at how you did as soon as I get done playing with this new build.duane wrote:The basics of subterrain aren't hard to put in, anyway. These things are freakishly huge, too. They need their own weather mods. It's still slow -- there's no getting around big features taking a long time, but I disabled large caves in any chunk that has a piece of a massive cave (to avoid lava/water appearing in mid-air), so they're not unbearable.
...
edit: Holy Moly! You were not kidding! I'm not sure the word "massive" accurately describes these caves. The Frankencaves branch is wonderful.
- duane
- Member
- Posts: 1715
- Joined: Wed Aug 19, 2015 19:11
- GitHub: duane-r
- Location: Oklahoma City
- Contact:
Re: [Mod][WIP] Valleys Mapgen [valleys_mapgen]
Minetest_next makes specific provisions for mapgens five, six, and seven, but does nothing when you load valleys mapgen, so it never loads any biomes.cHyper wrote:minetest-0.4.13-3c6b2ff
sfan5 win32-dev-build
I made a new map with mapgen valleys and following error messages appears!
Code: Select all
2016-01-14 19:31:05: ERROR[Main]: get_biome_list: failed to get biome 'stone_grassland' 2016-01-14 19:31:05: ERROR[Main]: get_biome_list: failed to get biome 'sandstone_grassland' 2016-01-14 19:31:05: ERROR[Main]: get_biome_list: failed to get biome 'deciduous_forest' 2016-01-14 19:31:05: ERROR[Main]: get_biome_list: failed to get biome 'coniferous_forest' 2016-01-14 19:31:05: ERROR[Main]: register_decoration: couldn't get all biomes
Code: Select all
if mg_name == "v6" then
dofile(modpath .. "/mapgenv6.lua")
elseif mg_name == "v5" or mg_name == "v7" then
dofile(modpath .. "/mapgenv57.lua")
end
Edit: It seems to work fine with this patch. You might try it or get Blockmen to. I've no idea what to look for, having never used next.
Code: Select all
diff --git a/mods/default/init.lua b/mods/default/init.lua
index c0ebbbe..321ba67 100644
--- a/mods/default/init.lua
+++ b/mods/default/init.lua
@@ -43,7 +43,7 @@ dofile(modpath .. "/crafting.lua")
dofile(modpath .. "/mapgen.lua")
if mg_name == "v6" then
dofile(modpath .. "/mapgenv6.lua")
-elseif mg_name == "v5" or mg_name == "v7" then
+elseif mg_name == "v5" or mg_name == "v7" or mg_name == "valleys" then
dofile(modpath .. "/mapgenv57.lua")
end
dofile(modpath .. "/trees.lua")
diff --git a/mods/default/mapgen.lua b/mods/default/mapgen.lua
index ecf4a8e..e10cacf 100644
--- a/mods/default/mapgen.lua
+++ b/mods/default/mapgen.lua
@@ -8,7 +8,7 @@ minetest.register_alias("mapgen_dirt", "default:dirt")
minetest.register_alias("mapgen_dirt_with_grass", "default:dirt_with_grass")
minetest.register_alias("mapgen_sand", "default:sand")
minetest.register_alias("mapgen_water_source", "default:water_source")
-minetest.register_alias("mapgen_river_water_source", "air")
+minetest.register_alias("mapgen_river_water_source", "default:river_water_source")
minetest.register_alias("mapgen_lava_source", "default:lava_source")
minetest.register_alias("mapgen_gravel", "default:gravel")
minetest.register_alias("mapgen_desert_stone", "default:desert_stone")
Believe in people and you don't need to believe anything else.
Re: [Mod][WIP] Valleys Mapgen [valleys_mapgen]
Code: Select all
for (s16 z = node_min.Z; z <= node_max.Z; z++)
for (s16 x = node_min.X; x <= node_max.X; x++, index_2d++) {
...
for (s16 y = node_max.Y + 1;
y >= node_min.Y - 1;
y--, index_3d -= ystride, vm->m_area.add_y(em, index_data, -1)) {
...
float tcave = massive_cave_threshold;
if (node_max.Y <= massive_cave_depth) {
if (y < yblmin)
tcave += pow(((yblmin - y) / MASSIVE_CAVE_BLEND), 2);
else if (y > yblmax)
tcave += pow(((y - yblmax) / MASSIVE_CAVE_BLEND), 2);
if (noise_massive_caves->result[index_3d] > tcave) {
vm->m_data[index_data] = n_air;
made_a_big_one = true;
}
}
...
}
}
Edit: So, I'm thinking, the best way for this bit of code to run is to make the loop in the order of y/x/z (or y/z/x). That way it is only done every 100 times (per my above example). Would this be best left to a mod or maybe even give it its own dedicated loop of y/x/z? Is it wasting (for the lack of a better word) enough time to worry about. I don't know much about C++ but I have to think doing something 1,000,000 times would be a big noticeable difference when compared to only doing it 100 times.
- duane
- Member
- Posts: 1715
- Joined: Wed Aug 19, 2015 19:11
- GitHub: duane-r
- Location: Oklahoma City
- Contact:
Re: [Mod][WIP] Valleys Mapgen [valleys_mapgen]
Good point!blert2112 wrote:There's the part that had me wondering how to hack in in the best way. In the Subterrain mod the loop goes z/y/x so it only does this part for every z/y. Here, we see these computations are being done every z/x/y. That's a huge increase. If my thinking is correct... Given a sidelen of 100 (just for example), this was being done 100x100 times, or 10,000 times. Here it is being done every 100x100x100 times, or 1,000,000 times. Is my thinking (and math) incorrect?Code: Select all
for (s16 z = node_min.Z; z <= node_max.Z; z++) for (s16 x = node_min.X; x <= node_max.X; x++, index_2d++) { ... for (s16 y = node_max.Y + 1; y >= node_min.Y - 1; y--, index_3d -= ystride, vm->m_area.add_y(em, index_data, -1)) { ... float tcave = massive_cave_threshold; if (node_max.Y <= massive_cave_depth) { if (y < yblmin) tcave += pow(((yblmin - y) / MASSIVE_CAVE_BLEND), 2); else if (y > yblmax) tcave += pow(((y - yblmax) / MASSIVE_CAVE_BLEND), 2); if (noise_massive_caves->result[index_3d] > tcave) { vm->m_data[index_data] = n_air; made_a_big_one = true; } } ... } }
Having profiled the operation, I can tell you that the main slowdown isn't in the loops, it's in creating another noise map. The entirety of the mapgen only consumes about 15% of the time the lighting/liquid handling + noise generation consumes (on my computer). So, you're not likely to see a huge speed gain.
However, why don't we cache the tcave values, since they don't change in the xz plane anyway? That way, we don't have to unwind any loops.
Code: Select all
float tcave_cache[csize.Y + 2];
if (node_max.Y <= massive_cave_depth) {
for (s16 y = node_max.Y + 1; y >= node_min.Y - 1; y--) {
float tcave = massive_cave_threshold;
if (y < yblmin)
tcave += pow(((yblmin - y) / MASSIVE_CAVE_BLEND), 2);
else if (y > yblmax)
tcave += pow(((y - yblmax) / MASSIVE_CAVE_BLEND), 2);
tcave_cache[y - node_min.Y + 1] = tcave;
}
}
...
if (node_max.Y <= massive_cave_depth
&& noise_massive_caves->result[index_3d]
> tcave_cache[y - node_min.Y + 1]) {
vm->m_data[index_data] = n_air;
made_a_big_one = true;
}
Edit: I started prowling around a cave and thought, "What the hell? Where'd this artifact come from? Then I realized...
- Attachments
-
- massive_cave_04.jpg (269.04 KiB) Viewed 546 times
Believe in people and you don't need to believe anything else.
Re: [Mod][WIP] Valleys Mapgen [valleys_mapgen]
Nice. I just went exploring around myself and found that it does seem a bit quicker to me. Mayhaps it's just a placebo effect but it feels much smoother. Previously, I would experience pauses in the game like it was waiting for something, I did not encounter those same pauses today.duane wrote:However, why don't we cache the tcave values, since they don't change in the xz plane anyway? That way, we don't have to unwind any loops.
The scale of these massive caves is incredible, I mapped an entire cave and then stood back a bit... at a view range of over 1000 it still did not all fit! Now, what to do with all this goodness? I can rewrite my custom "Nether" mod and speed it up. Are the massive caves (or can they be) reported to gennotify? If so, I should be able to build structures inside them, possibly even coax mg_villages to place a village down there and populate it.
Re: [Mod][WIP] Valleys Mapgen [valleys_mapgen]
The method for generating these massive caves seems the same but the caves are generated very differently from the Subterrain mod. Here's a SS from the mod...
...it is very feature full and convoluted. The massive caves made by Frankencaves are very plain and tend to look like... well, cup your hands and place them together. So, why is this?
...it is very feature full and convoluted. The massive caves made by Frankencaves are very plain and tend to look like... well, cup your hands and place them together. So, why is this?
- Attachments
-
- screenshot_20160126_141956.png (244.14 KiB) Viewed 546 times
Re: [Mod][WIP] Valleys Mapgen [valleys_mapgen]
Here you go...
https://github.com/blert2112/minetest/c ... 5e525e9060
... That should fix the featurelessness of the caves that I spoke of above. Worked nicely for me.
edit: nope, sorry, I guess I had the wrong save loaded.
https://github.com/blert2112/minetest/c ... 5e525e9060
... That should fix the featurelessness of the caves that I spoke of above. Worked nicely for me.
edit: nope, sorry, I guess I had the wrong save loaded.
- paramat
- Developer
- Posts: 3700
- Joined: Sun Oct 28, 2012 00:05
- GitHub: paramat
- IRC: paramat
- Location: UK
Re: [Mod][WIP] Valleys Mapgen [valleys_mapgen]
The 3D noise has horizontal spread 768 and vertical spread 256 so these are 'squashed' 3D noise as in subterrain mod. with that 'flattened diamonds' look.
Re: [Mod][WIP] Valleys Mapgen [valleys_mapgen]
Wow, this looks so cool, real challenge for real minetester.duane wrote:Another option would be to make the V5 caves more flexible and/or less static.duane wrote:I like the simple caves, even over the 3D noise in mgv7. There are palpable differences to my eye, and I'm fond of the many water/fire falls that random lava/water placement creates (even above ground).paramat wrote:What do you all think about making the new caves option the standard and removing the simple caves option?
If necessary, I'll put the extra lava and water into a mod, but some people might not appreciate having to load another mod for what they see as a mapgen function. That presumes, of course, that I'm the only one who prefers the simple caves' shape over the standard caves'.
As far as complicating the code goes, I can solve that by pasting in the seven lines of code that ask cavegen to create the larger caves, to the end of the simple caves function. Then you get the (my) best of both worlds, and none of the other mapgens are affected. I think this is going to be the go-to option for my personal build.
You have big caves, ragged caves, lava pools, swimming pools, and more fire/water falls than you can shake a stick at. Add some colossal caves and weak rock that falls on you, and you've got a real party... but that'll have to wait.
If anyone wants to try this option, the code is on my frankencaves branch.
- duane
- Member
- Posts: 1715
- Joined: Wed Aug 19, 2015 19:11
- GitHub: duane-r
- Location: Oklahoma City
- Contact:
Re: [Mod][WIP] Valleys Mapgen [valleys_mapgen]
blert2112 wrote:The method for generating these massive caves seems the same but the caves are generated very differently from the Subterrain mod. Here's a SS from the mod...
This is the same world, location and heading you used in your screenshot, but using the C++ version. It looks pretty convoluted to me, though it's hard to tell if they're the same from the screenshots, especially with large chunks of background not yet filled in. They should be, except in cases where another cave has intersected the massive one.
If you're talking about the lava balls that form in mid-air, that's a (presumably) unintentional effect of the original large cave code that has caused complaints on the caverealms forum. People didn't appreciate lava inundating the carefully constructed environments. I removed that by disabling large caves in any chunk that had a massive cave (something you can't do from lua).
Lava can (and does) still fall into massive caves from other caves, and can still form on the floor, but it won't form in mid-air. Of course, the absence of large caves in that chunk will prevent any from intersecting, but noise-based caves will still intersect.
I hesitate to make the massive caves too crazy, because that's a great area for mods to embellish, and I don't want problems like the big lava balls interfering with them. The code that's currently in pull request #3590 has all three types of cave and gives you the option to vary random lava and water spawns from 0-10, which will also affect massive caves.
- Attachments
-
- massive_cave_05.jpg (208.37 KiB) Viewed 546 times
Last edited by duane on Wed Jan 27, 2016 03:16, edited 1 time in total.
Believe in people and you don't need to believe anything else.
- duane
- Member
- Posts: 1715
- Joined: Wed Aug 19, 2015 19:11
- GitHub: duane-r
- Location: Oklahoma City
- Contact:
Re: [Mod][WIP] Valleys Mapgen [valleys_mapgen]
Cool.blert2112 wrote:I just went exploring around myself and found that it does seem a bit quicker to me.
Yes, paramat doesn't do things small. ; )blert2112 wrote:The scale of these massive caves is incredible, I mapped an entire cave and then stood back a
bit... at a view range of over 1000 it still did not all fit!
They are not. I'll look into it. I notice that large caves have a begin and end event. That wouldn't be practical with massive caves, since they span so many chunks, but we could have a "massive cave is present" event, with at least one location in it. I wonder if that's the best way to handle them. It looks as though cavegen.cpp only notifies at the beginning and end of tunnels, but I'm guessing that includes the caves themselves. I've never used gennotify.blert2112 wrote:Now, what to do with all this goodness? I can rewrite my custom "Nether" mod and speed it up. Are the massive caves (or can they be) reported to gennotify? If so, I should be able to build structures inside them, possibly even coax mg_villages to place a village down there and populate it.
What I'd really like is a special biome for the different cave types, but the biome table is two-dimensional.
It might turn out to be easier to copy the (single) massive cave noise from the mapgen parameters and use that to get the coordinates in mods. You'd need several chunks worth of data to get a good idea of where to place large structures, and gennotify only seems to apply to the chunk you're in.
Of course, my valleys_c helper mod just treats any open area underground the same, so I get enormous forests of three-meter mushrooms, but nothing huge. However, since it counts the open air space above a spot, I could easily plant larger schematics, at the risk of their intersecting a wall. I could even do a quick loop through the entire chunk to get an idea of how much air is in it. The loops are trivial compared to the overhead of voxelmanip pulling the data table and the creation of the noise tables I use.
Believe in people and you don't need to believe anything else.
Re: [Mod][WIP] Valleys Mapgen [valleys_mapgen]
Your image link seems borked.
I agree, it is very hard to tell from screenshots. If you have the time and want to see what I am talking about then do this... Find a new massive cave and explore just enough to get a good idea of it's shape. Now quickly exit and then run the world again only this time with the Subterrain mod active (be sure you have adjusted the upper limit, threshold and blend to match what you have valleys set to). Finish exploring the cave. I think you will see right away.
I agree, it is very hard to tell from screenshots. If you have the time and want to see what I am talking about then do this... Find a new massive cave and explore just enough to get a good idea of it's shape. Now quickly exit and then run the world again only this time with the Subterrain mod active (be sure you have adjusted the upper limit, threshold and blend to match what you have valleys set to). Finish exploring the cave. I think you will see right away.
- duane
- Member
- Posts: 1715
- Joined: Wed Aug 19, 2015 19:11
- GitHub: duane-r
- Location: Oklahoma City
- Contact:
Re: [Mod][WIP] Valleys Mapgen [valleys_mapgen]
I think the image is fixed.blert2112 wrote:Your image link seems borked.
I agree, it is very hard to tell from screenshots. If you have the time and want to see what I am talking about then do this... Find a new massive cave and explore just enough to get a good idea of it's shape. Now quickly exit and then run the world again only this time with the Subterrain mod active (be sure you have adjusted the upper limit, threshold and blend to match what you have valleys set to). Finish exploring the cave. I think you will see right away.
I'm going to check that out. I'm assuming you're not running a valleys mapgen world with the massive caves and then running subterrain on top of that. I've no idea what that would do. If the cave generation didn't match exactly (it wouldn't since they don't handle numbers the same) it would produce interference between the two systems.
Edit: By golly, you guys are better at this than I am. One misplaced number wrecked havoc with the generation. However, I also discovered another problem that was causing issues with the cave floor. I'm going to update both the pull request and frankencaves immediately.
Believe in people and you don't need to believe anything else.
Re: [Mod][WIP] Valleys Mapgen [valleys_mapgen]
Yup, just running it right on top of vmg with massive caves, no problems since the lua mod just replaces what the c++ did for ungenerated areas, it is slow though.duane wrote:I think the image is fixed.
I'm going to check that out. I'm assuming you're not running a valleys mapgen world with the massive caves and then running subterrain on top of that. I've no idea what that would do. If the cave generation didn't match exactly (it wouldn't since they don't handle numbers the same) it would produce interference between the two systems.
But, I think I figured it out and am checking now. Being not so smart, I forgot about the octaves. I increased them to 6, as in the mod, and it seems to be a pretty close match.
I have another question for you...
this line added to the tcave cache loop:
Code: Select all
printf("tcave: %f \n", tcave_cache[y - node_min.Y + 1]);
Am I writing that printf() statement wrong?
If I do this...
Code: Select all
float tcave = 0.6f;
edit: yup, with the octaves increased to 6 it is a dead ringer for the Subterrain mod. You, and Paramat, do amazing work.
- duane
- Member
- Posts: 1715
- Joined: Wed Aug 19, 2015 19:11
- GitHub: duane-r
- Location: Oklahoma City
- Contact:
Re: [Mod][WIP] Valleys Mapgen [valleys_mapgen]
Alright. This is a much more interesting giant cave. Maybe too interesting. You're really going to have to think about your random water and lava settings, because they show up a lot in a surface area this large, even without intersecting caves. The default will be zero. This was set to three for each.
I could place dirt on the floor here, but I think I'd rather leave that up to mods. (The dirt you see here is being placed by a mod.)
I could place dirt on the floor here, but I think I'd rather leave that up to mods. (The dirt you see here is being placed by a mod.)
- Attachments
-
- massive_cave_06.jpg (305.06 KiB) Viewed 546 times
Believe in people and you don't need to believe anything else.
- duane
- Member
- Posts: 1715
- Joined: Wed Aug 19, 2015 19:11
- GitHub: duane-r
- Location: Oklahoma City
- Contact:
Re: [Mod][WIP] Valleys Mapgen [valleys_mapgen]
I think that must have been changed by the other fix. It prints 0.6 (massive_cave_threshold) for me every time. That seems a little redundant, but I'm not sure I understand how the blend works, so I'm reluctant to touch it. As long as it's working like the mod, I'll leave it to paramat.blert2112 wrote:this line added to the tcave cache loop:Always returns "1.000".Code: Select all
printf("tcave: %f \n", tcave_cache[y - node_min.Y + 1]);
Edit: Actually, it's printing all sorts of values in another location.
Believe in people and you don't need to believe anything else.
Re: [Mod][WIP] Valleys Mapgen [valleys_mapgen]
The value will change as you approach the top and bottom limits so that the ceilings and floors don't end up being flat cutoff surfaces. It blends them to look more natural. At least, that is how I understand it.
Re: [Mod][WIP] Valleys Mapgen [valleys_mapgen]
Just merged and compiled... The massive caves look great.
I still see the threshold and tcave being 1.0, no options modified in conf
note where I have put the printf() statements (bottom left of pic). Am I doing something wrong? Threshold should be showing 0.6 as I have not edited any options.
If I add...
...into minetest.conf I still get the same result.
I still see the threshold and tcave being 1.0, no options modified in conf
note where I have put the printf() statements (bottom left of pic). Am I doing something wrong? Threshold should be showing 0.6 as I have not edited any options.
If I add...
Code: Select all
mg_valleys_massive_cave_threshold = 7
- Attachments
-
- thresh.png (497.74 KiB) Viewed 546 times
- paramat
- Developer
- Posts: 3700
- Joined: Sun Oct 28, 2012 00:05
- GitHub: paramat
- IRC: paramat
- Location: UK
Re: [Mod][WIP] Valleys Mapgen [valleys_mapgen]
Yes this.blert2112 wrote:The value will change as you approach the top and bottom limits so that the ceilings and floors don't end up being flat cutoff surfaces. It blends them to look more natural. At least, that is how I understand it.
Beyond the y values the cave noise threshold is smoothly increased to taper the caves down to nothing.
So the threshold will be mostly 0.6, but near the top and base limits it will increase.
Who is online
Users browsing this forum: No registered users and 23 guests