Hex grid "River" Generation

Today I created a simple algorithm that generates ‘river’ paths on a hex grid (Note the hex grid is also generated algorithmically). It took a few hours to tweak but I finally got it to work properly. Here is a video demonstration:

Each river is completely randomized and can be any length smaller than the hex grid.

10 Likes

how do you make it so your small and fast??

2 Likes

The tiles are just large so I am not really small. As for being fast, I just changed the walkspeed on the humanoid to 300 while play testing.

2 Likes

what type of noise is this? voroni? or is it just perlin but you filtered it massively. or is it even noise at all?

2 Likes

This algorithm doesn’t actually use any noise function.

2 Likes

This looks amazing! You could probably use this for some pretty cool terrain generation… This would also be awesome for some kind of a top-down unique tile-based game

2 Likes

Sorry to bump but how did you do it? I assume some kind of finding the nearest tile in a random direction but I want to know kinda what it looks like behind the scenes.

1 Like

The algorithm process is shown below:

Get starting tile → check available directions → pick random direction based on the result of the previous task → find tile based on chosen direction → update current tile and change color → repeat for x terms/length of river


Checking available directions is to make sure that we don’t pick a tile that is off the map or the previous direction. Each river also has a preferred direction. The function that gets directions also ‘prefers’ certain directions over others. I think this version used recursion but a newer version I made for someone uses loops which made it easier to read for me.

1 Like