Generate a ring of water by world edge
- texmex
- Member
- Posts: 1753
- Joined: Mon Jul 11, 2016 21:08
- GitHub: tacotexmex
- In-game: tacotexmex
Generate a ring of water by world edge
I’d like a ring of -31k deep water around by the edges of the world, let’s say, a 1000 nodes wide. I’d like for the cut into land nodes to feel natural, probably based on some noise pattern. I’m a mapgen nood, I’ve never used VoxelManip. What are some techniques to achieve this? Can I use biomes with x and y limitations? Others?
- duane
- Member
- Posts: 1715
- Joined: Wed Aug 19, 2015 19:11
- GitHub: duane-r
- Location: Oklahoma City
- Contact:
Re: Generate a ring of water by world edge
You might just try taking the existing terrain and lowering it logarithmically as x and z approach their limits. If you start slowly, I'd imagine it would look pretty natural, and once it gets deeper than a few hundred meters, I doubt anyone will be able to see much.
The hard part would be dealing with biomes and decorations near the (new) coastline, since they wouldn't all be appropriate for the shore. If you use an existing lua mapgen, it would be easy enough to tweak the terrain, but the C mapgens will have planted everything already before your lua mod starts working.
The hard part would be dealing with biomes and decorations near the (new) coastline, since they wouldn't all be appropriate for the shore. If you use an existing lua mapgen, it would be easy enough to tweak the terrain, but the C mapgens will have planted everything already before your lua mod starts working.
Believe in people and you don't need to believe anything else.
- texmex
- Member
- Posts: 1753
- Joined: Mon Jul 11, 2016 21:08
- GitHub: tacotexmex
- In-game: tacotexmex
Re: Generate a ring of water by world edge
Ah yes, I forgot to mention that I want to do it within the context of the C mapgens (I don’t care about v6). Is it possible still to logarithmically modify the map edges?
As a last resort I’d simply like to somehow address the outermost 1000 nodes to turn into water below Y1 and air above it. The land mass doesn’t necessarily have to slope down to beach level, but at least I’d much rather have a rugged edge on the land mass than an infinitely straight one.
I suppose I can crop the values of min_pos and max_pos of all other biomes except a sort of "edge biome" that has node_stone set to water? I'll start with that.
As a last resort I’d simply like to somehow address the outermost 1000 nodes to turn into water below Y1 and air above it. The land mass doesn’t necessarily have to slope down to beach level, but at least I’d much rather have a rugged edge on the land mass than an infinitely straight one.
I suppose I can crop the values of min_pos and max_pos of all other biomes except a sort of "edge biome" that has node_stone set to water? I'll start with that.
- texmex
- Member
- Posts: 1753
- Joined: Mon Jul 11, 2016 21:08
- GitHub: tacotexmex
- In-game: tacotexmex
Re: Generate a ring of water by world edge
It worked creating this x and z limited edge biome, filling all node types with air. Next step is to create a stratum ore type for all air below y 1.
It’s not pretty though and I suspect that you voxelmanip wizards out there will have a thing or two to say about this solution.
It’s not pretty though and I suspect that you voxelmanip wizards out there will have a thing or two to say about this solution.
- texmex
- Member
- Posts: 1753
- Joined: Mon Jul 11, 2016 21:08
- GitHub: tacotexmex
- In-game: tacotexmex
Re: Generate a ring of water by world edge
Ah, turns out no new biome is needed. "default" is the fallback biome.
Well, the stratum ore type solution burns the fan up but that's the best I can do by myself.
Also, just look at that abomination:
Well, the stratum ore type solution burns the fan up but that's the best I can do by myself.
Also, just look at that abomination:
Spoiler
Code: Select all
minetest.register_ore({
ore_type = "stratum",
ore = "air"
wherein = {"group:stone"},
y_min = 1,
y_max = 31000,
clust_scarcity = 1,
biomes = {"default"},
})
minetest.register_ore({
ore_type = "stratum",
ore = "node:water_source",
wherein = {"air", "group:stone"},
y_min = -31000,
y_max = 0,
clust_scarcity = 1,
biomes = {"default"},
})
- Attachments
-
- screenshot_20190909_223436.png (539 KiB) Viewed 571 times
- sirrobzeroone
- Member
- Posts: 593
- Joined: Mon Jul 16, 2018 07:56
- GitHub: sirrobzeroone
- Contact:
Re: Generate a ring of water by world edge
I'm working on a mapgen like this, basically and island that gets deeper towards the edges. Its not much at the moment, no biomes, codes a mess...anyways you get the idea - this is the post, currently stuck working up rivers.
viewtopic.php?f=47&t=15272&start=575#p354325
edit: forgot to say if thats the effect your after I can post my S decay algorithm for generating the ocean.
viewtopic.php?f=47&t=15272&start=575#p354325
edit: forgot to say if thats the effect your after I can post my S decay algorithm for generating the ocean.
- texmex
- Member
- Posts: 1753
- Joined: Mon Jul 11, 2016 21:08
- GitHub: tacotexmex
- In-game: tacotexmex
Re: Generate a ring of water by world edge
Your island looks good! I’d be happy to check the code out.
- sirrobzeroone
- Member
- Posts: 593
- Joined: Mon Jul 16, 2018 07:56
- GitHub: sirrobzeroone
- Contact:
Re: Generate a ring of water by world edge
Give me a few days to clean the "junk" out and I'll leave it as a Lua water edge generation code only. I'd be very interested with how it can be combined with one of the base mapgens myself.
I'll add comments as well....but I'm no coder so it might be um not very code pretty :)
I'll add comments as well....but I'm no coder so it might be um not very code pretty :)
- texmex
- Member
- Posts: 1753
- Joined: Mon Jul 11, 2016 21:08
- GitHub: tacotexmex
- In-game: tacotexmex
Re: Generate a ring of water by world edge
Much obliged, sirrobzeroone!
- sirrobzeroone
- Member
- Posts: 593
- Joined: Mon Jul 16, 2018 07:56
- GitHub: sirrobzeroone
- Contact:
Re: Generate a ring of water by world edge
No worries at all, I think I got all the junk cleaned out of the code. I left the code fairly separated out, i think you could interface with it in a few spots and feel free to rip out what you need. Hopefully I commented it enough if not just ask if it is a bit unclear in points...im no programmer :).
I put some variables in for percent_land, from memory if it gets to high or low it starts to break but 0.2 to 0.8 should be pretty safe.
Put up on git so much safer for downloading. Can launch it on an empty map as the only mod and you'll get the hexagon island and ocean, if enabled. The S curve beach works better on bigger stuff probably optimal around 20K in size. I did test at 300,3000,31000 in map size and it scaled okay. once mushed with some perlin noise any rough bits should smooth out :)
https://github.com/sirrobzeroone/Ocean_Island
Picy shows a .45 or 45% land mass on a size 300 map.
I put some variables in for percent_land, from memory if it gets to high or low it starts to break but 0.2 to 0.8 should be pretty safe.
Put up on git so much safer for downloading. Can launch it on an empty map as the only mod and you'll get the hexagon island and ocean, if enabled. The S curve beach works better on bigger stuff probably optimal around 20K in size. I did test at 300,3000,31000 in map size and it scaled okay. once mushed with some perlin noise any rough bits should smooth out :)
https://github.com/sirrobzeroone/Ocean_Island
Picy shows a .45 or 45% land mass on a size 300 map.
- texmex
- Member
- Posts: 1753
- Joined: Mon Jul 11, 2016 21:08
- GitHub: tacotexmex
- In-game: tacotexmex
Re: Generate a ring of water by world edge
Ah, I see, but this only works in singlenode mapgen then?
- sirrobzeroone
- Member
- Posts: 593
- Joined: Mon Jul 16, 2018 07:56
- GitHub: sirrobzeroone
- Contact:
Re: Generate a ring of water by world edge
I dont know enough about the standard mapgens yet. But given your edit above off the output my guess would be:
For each node generated run it through the nvvals calculation. If the output is isl_hgh then do nothing to the value if its in the island edge bit then - the calculated value from the mapgen value.
Im very curious how you got that trench around the outside edge on a default mapgen. If i could see the code on how thats done i think i could create a function to do the above.
Im very intrested in this myself as i prefer a natural barrier as well not just an invisible wall :).
Edit: just reread your post so your current x,z biome could use the nvals calculation and only fill down to the y value in the calculation with air ignore the isl_hgh outcome this would still result in some exposed rock so at the boundry id guess youd to do something like:
Surface = current calculated pos x,y,z
If y>=3 then y, y-1, y-2 from surface = grass_dirt
Elseif y<3and y > -40 then y, y-1,y-2 from surface = sand
Else y, y-1, y-2 rom surface = stone
That is just some dodgy brain thinking code and assumes were inside tge xz biome boundry, if you dont mind id be happy to look at and tinker with your code if your happy to share :)
For each node generated run it through the nvvals calculation. If the output is isl_hgh then do nothing to the value if its in the island edge bit then - the calculated value from the mapgen value.
Im very curious how you got that trench around the outside edge on a default mapgen. If i could see the code on how thats done i think i could create a function to do the above.
Im very intrested in this myself as i prefer a natural barrier as well not just an invisible wall :).
Edit: just reread your post so your current x,z biome could use the nvals calculation and only fill down to the y value in the calculation with air ignore the isl_hgh outcome this would still result in some exposed rock so at the boundry id guess youd to do something like:
Surface = current calculated pos x,y,z
If y>=3 then y, y-1, y-2 from surface = grass_dirt
Elseif y<3and y > -40 then y, y-1,y-2 from surface = sand
Else y, y-1, y-2 rom surface = stone
That is just some dodgy brain thinking code and assumes were inside tge xz biome boundry, if you dont mind id be happy to look at and tinker with your code if your happy to share :)
- sirrobzeroone
- Member
- Posts: 593
- Joined: Mon Jul 16, 2018 07:56
- GitHub: sirrobzeroone
- Contact:
Re: Generate a ring of water by world edge
I just had a quick look at register.biomes, i think i have an idea how to use it, may not work and it will be messy....
Id still love to see your current reg biome settings as this is all new territory for me :).
Id still love to see your current reg biome settings as this is all new territory for me :).
- texmex
- Member
- Posts: 1753
- Joined: Mon Jul 11, 2016 21:08
- GitHub: tacotexmex
- In-game: tacotexmex
Re: Generate a ring of water by world edge
Your code is definitely new territory to me as well, so it will take time for me to grasp it.
For my solution, all I do is limit min_pos and max_pos of X and Z to -30000 and 30000 for all registered biomes. This will trigger the "default biome" to generate outside those positions. I then use the stratum ore generation already posted for water and air replacement in that biome. That's it.
For my solution, all I do is limit min_pos and max_pos of X and Z to -30000 and 30000 for all registered biomes. This will trigger the "default biome" to generate outside those positions. I then use the stratum ore generation already posted for water and air replacement in that biome. That's it.
Re: Generate a ring of water by world edge
Maybe do it by lowering the land into the water then increase the height as it gets close to the center of the map
But the thing is, because there will still be noise you could have little islands off shore because of mountains which would be pretty cool!
But the thing is, because there will still be noise you could have little islands off shore because of mountains which would be pretty cool!
Creator of jelys_pizzaria and motorbike, and player of persistent kingdoms. RIP
- sirrobzeroone
- Member
- Posts: 593
- Joined: Mon Jul 16, 2018 07:56
- GitHub: sirrobzeroone
- Contact:
Re: Generate a ring of water by world edge
I tried using the biome api but it seems to be quiet general. biomes when specified appear to be able to spread beyond a specific coordinate area if they start inside that coordinate area. Unless I was defining them wrong..... think it's going to be directly manipulating the voxels.
Extex when on singlenode my mapgen basically does that combines 3 noise layers with the hexagonish shape and gives a heap of cool islands off the main island. I just ripped all that code out to show the underlying mask shape, pretty much borrowed that idea from the 2d random map geneators around the place that are shown on the web.....heres one of the websites I read over, it's very intresting :) - https://medium.com/@travall/procedural- ... 976bddeaf9
Extex when on singlenode my mapgen basically does that combines 3 noise layers with the hexagonish shape and gives a heap of cool islands off the main island. I just ripped all that code out to show the underlying mask shape, pretty much borrowed that idea from the 2d random map geneators around the place that are shown on the web.....heres one of the websites I read over, it's very intresting :) - https://medium.com/@travall/procedural- ... 976bddeaf9
Last edited by sirrobzeroone on Sun Sep 15, 2019 01:26, edited 1 time in total.
- sirrobzeroone
- Member
- Posts: 593
- Joined: Mon Jul 16, 2018 07:56
- GitHub: sirrobzeroone
- Contact:
Re: Generate a ring of water by world edge
sry doublepost - forum glitch
-
- Member
- Posts: 324
- Joined: Sun Jun 16, 2019 20:17
- Location: x=123, y=120, z=534
Re: Generate a ring of water by world edge
AiTechEye dealt with the world edge here: viewtopic.php?f=5&t=22457
Currently working on new mods.
Who is online
Users browsing this forum: No registered users and 10 guests