Generate a ring of water by world edge

Post Reply
User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Generate a ring of water by world edge

by texmex » Post

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?

User avatar
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

by duane » Post

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.
Believe in people and you don't need to believe anything else.

User avatar
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

by texmex » Post

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.

User avatar
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

by texmex » Post

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.

User avatar
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

by texmex » Post

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:

Image
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
screenshot_20190909_223436.png (539 KiB) Viewed 571 times

User avatar
sirrobzeroone
Member
Posts: 593
Joined: Mon Jul 16, 2018 07:56
GitHub: sirrobzeroone
Contact:

Re: Generate a ring of water by world edge

by sirrobzeroone » Post

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.

User avatar
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

by texmex » Post

Your island looks good! I’d be happy to check the code out.

User avatar
sirrobzeroone
Member
Posts: 593
Joined: Mon Jul 16, 2018 07:56
GitHub: sirrobzeroone
Contact:

Re: Generate a ring of water by world edge

by sirrobzeroone » Post

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 :)

User avatar
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

by texmex » Post

Much obliged, sirrobzeroone!

User avatar
sirrobzeroone
Member
Posts: 593
Joined: Mon Jul 16, 2018 07:56
GitHub: sirrobzeroone
Contact:

Re: Generate a ring of water by world edge

by sirrobzeroone » Post

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

Image
Picy shows a .45 or 45% land mass on a size 300 map.

User avatar
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

by texmex » Post

Ah, I see, but this only works in singlenode mapgen then?

User avatar
sirrobzeroone
Member
Posts: 593
Joined: Mon Jul 16, 2018 07:56
GitHub: sirrobzeroone
Contact:

Re: Generate a ring of water by world edge

by sirrobzeroone » Post

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 :)

User avatar
sirrobzeroone
Member
Posts: 593
Joined: Mon Jul 16, 2018 07:56
GitHub: sirrobzeroone
Contact:

Re: Generate a ring of water by world edge

by sirrobzeroone » Post

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 :).

User avatar
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

by texmex » Post

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.

User avatar
Extex
Member
Posts: 246
Joined: Wed Mar 14, 2018 23:14
GitHub: Extex101
In-game: Extex

Re: Generate a ring of water by world edge

by Extex » Post

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!
Creator of jelys_pizzaria and motorbike, and player of persistent kingdoms. RIP

User avatar
sirrobzeroone
Member
Posts: 593
Joined: Mon Jul 16, 2018 07:56
GitHub: sirrobzeroone
Contact:

Re: Generate a ring of water by world edge

by sirrobzeroone » Post

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
Last edited by sirrobzeroone on Sun Sep 15, 2019 01:26, edited 1 time in total.

User avatar
sirrobzeroone
Member
Posts: 593
Joined: Mon Jul 16, 2018 07:56
GitHub: sirrobzeroone
Contact:

Re: Generate a ring of water by world edge

by sirrobzeroone » Post

sry doublepost - forum glitch

Red_King_Cyclops
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

by Red_King_Cyclops » Post

AiTechEye dealt with the world edge here: viewtopic.php?f=5&t=22457
Currently working on new mods.

Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests