Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411599 Posts in 69387 Topics- by 58445 Members - Latest Member: gravitygat

May 08, 2024, 08:45:45 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Procedural generation without floating islands
Pages: [1]
Print
Author Topic: Procedural generation without floating islands  (Read 1209 times)
diegzumillo
Level 10
*****


This avatar is so old I still have a some hair


View Profile WWW
« on: February 15, 2019, 12:39:06 PM »

Hey
I'm playing around with marching cubes here (old code I dig up). And I can get some pretty neat results for my current project, but I want to avoid floating islands somehow. I read some algorithms that remove floating islands after the generation has taken place, but those don't look computationally cheap or simple to implement.

What I'm thinking is a modification to Perlin noise generation, an extra step before that would be cheaper than those algorithms applied after. For example start by generating a connected graph, then use that to generate a scalar field. "But diegzumillo, everything would look like strings you dumbass" well, higher density of vertices would hide that, I hope.

Logged

qMopey
Level 6
*


View Profile WWW
« Reply #1 on: February 15, 2019, 03:17:35 PM »

Personally I would run your noise algorithm on your grid, then zero out all the entries that qualify as islands. I would not intermix this kind of island pruning with your noise algorithm. Plus, your bottleneck will never be in the noise generation, so culling all the way back in the noise generation will never give you a performance boost anyways.
Logged
BorisTheBrave
Level 10
*****


View Profile WWW
« Reply #2 on: February 28, 2019, 01:23:17 PM »

My library DeBroglie can do it. Set up WFC generation, then add a Path constraint to enforce connctivity. Example (using paths rather than land/water, but same principle):

It's not a good algorithm for large maps though.



Quote
I read some algorithms that remove floating islands after the generation has taken place, but those don't look computationally cheap or simple to implement.

On the contrary, it's extremely cheap and easy! The algorithm you want is "flood fill". You can identify an island by starting with a land point, and repeatedly coloring all adjacent points until you run out of land points - everthing you colored is a single island. Do that for every uncolored land point, and you'll identify each island on the map one at a time. Then just pick the largest and erase the others (or draw bridges between them).
Logged
diegzumillo
Level 10
*****


This avatar is so old I still have a some hair


View Profile WWW
« Reply #3 on: February 28, 2019, 01:31:21 PM »

That is great! thanks for doing, sharing, and letting me know it exists.

Logged

Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic