Download

Ideas to improve my "fill holes" algorithm (2D lake / river creator)

Hi!

To create interesting and random lake&river shapes I created a simple pathing code.
I tried some other methods to create interesting shapes like my code I use for creating other resource patches or poison disk sampling for my forest. But none of them could archive those shapes that my pathing code creates and I absolutely love it.

So I thought I might could stick to it and just fill all the little holes it creates.
Like my example here: https://i.gyazo.com/5fc9e38e866e22fce9dd69801df8aea2.mp4

For the filling I get all the 2D coordinates the pathing creates, and then get the lowest X (lowest row), get all Y’s in this row with some rules find a hole and fill it.
The problem is that I currently need to check for every Y I want to fill “if its inside the pathing”. So if it has a X above and below it. Otherwise it would fill a whole lot more due to the weird shape.

It works, but its expensive and slow…

You guys have some ideas for me how I could archive it better&faster? I really only want to fill the holes that are fully surrounded by the pathing to keep as much detail as possible.