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.
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
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.
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.