Generate a ring of water by world edge

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

Generate a ring of water by world edge

by texmex » Mon Sep 09, 2019 15:43

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: 1520
Joined: Wed Aug 19, 2015 19:11
Location: Oklahoma City
GitHub: duane-r

Re: Generate a ring of water by world edge

by duane » Mon Sep 09, 2019 16:01

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: 1536
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: texmex

Re: Generate a ring of water by world edge

by texmex » Mon Sep 09, 2019 17:08

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: 1536
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: texmex

Re: Generate a ring of water by world edge

by texmex » Mon Sep 09, 2019 18:02

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: 1536
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: texmex

Re: Generate a ring of water by world edge

by texmex » Mon Sep 09, 2019 20:39

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

+ Shit code
Attachments
screenshot_20190909_223436.png
(539 KiB) Not downloaded yet
 

sirrobzeroone
Member
 
Posts: 104
Joined: Mon Jul 16, 2018 07:56

Re: Generate a ring of water by world edge

by sirrobzeroone » Tue Sep 10, 2019 10:06

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: 1536
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: texmex
 

sirrobzeroone
Member
 
Posts: 104
Joined: Mon Jul 16, 2018 07:56

Re: Generate a ring of water by world edge

by sirrobzeroone » Wed Sep 11, 2019 00:15

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: 1536
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: texmex
 

sirrobzeroone
Member
 
Posts: 104
Joined: Mon Jul 16, 2018 07:56

Re: Generate a ring of water by world edge

by sirrobzeroone » Wed Sep 11, 2019 10:54

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: 1536
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: texmex
 

sirrobzeroone
Member
 
Posts: 104
Joined: Mon Jul 16, 2018 07:56

Re: Generate a ring of water by world edge

by sirrobzeroone » Wed Sep 11, 2019 19:46

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

sirrobzeroone
Member
 
Posts: 104
Joined: Mon Jul 16, 2018 07:56

Re: Generate a ring of water by world edge

by sirrobzeroone » Wed Sep 11, 2019 20:59

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: 1536
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: texmex

Re: Generate a ring of water by world edge

by texmex » Thu Sep 12, 2019 10:58

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.
 

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

Re: Generate a ring of water by world edge

by Extex » Thu Sep 12, 2019 18:06

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!
Player of PK, RIP. Creator of the light_tool mod. Working on another mod which is pretty cool so far
 

sirrobzeroone
Member
 
Posts: 104
Joined: Mon Jul 16, 2018 07:56

Re: Generate a ring of water by world edge

by sirrobzeroone » Sun Sep 15, 2019 01:21

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-2d-island-generation-noise-functions-13976bddeaf9
Last edited by sirrobzeroone on Sun Sep 15, 2019 01:26, edited 1 time in total.
 

sirrobzeroone
Member
 
Posts: 104
Joined: Mon Jul 16, 2018 07:56
 

Red_King_Cyclops
Member
 
Posts: 225
Joined: Sun Jun 16, 2019 20:17
Location: Earth

Re: Generate a ring of water by world edge

by Red_King_Cyclops » Sun Sep 15, 2019 13:42

AiTechEye dealt with the world edge here: viewtopic.php?f=5&t=22457
I'm working on a mod that is essentially Galacticraft for Minetest (with differences).
 


Return to Modding Discussion



Who is online

Users browsing this forum: No registered users and 2 guests