How would I go around identifying "islands" of a noise generated map?

Godot Version

4.2

Question

i have a noise map that is used to generate tiles based on the color sampled at x,y.


how would i go about identifying the islands that are detached from the “main” road type thing? the player may move around the tiles, but id like to make these islands purely decorative with some scenery meshes attached to them
image
this is how the noisemap looks like

1 Like

While I haven’t played around with this in Godot specifically, the concept should be the same: Use a simple flood-fill algorithm to find and mark all reachable/walkable tiles.

I’m on my phone so I won’t write any elaborate example now, but roguebasin explains the concept rather succintly: Roguelike Dev FAQ - RogueBasin

(Roguebasin is an excellent resource for doing all kinds of procgen with tiles, by the way)

All you need is a way to check if a (x,y) position is a walkable floor and a way to track tiles you’ve filled.

I thought about flood fill too and found Connected-component labeling - Wikipedia which is apparently used to detect connected regions.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.