samedi 27 novembre 2021

Need an algorithm to randomly generate groups on a hexagon grid

I created a hexagon grid based on information in this article https://www.redblobgames.com/grids/hexagons/

Here's how it looks so far: Grid of hexagons

I want to divide this grid into groups similar to this: Hex grid with groups

I want to have gaps in the grid but I also need all groups to be connected. Essentially I want to be able to move from any hexagon in a group to any other hexagon in a group.

My first idea is to pick a random tile for each group then add a neighboring tile to each group until a group touches another group, then maybe have a decreasing chance of adding another tile to that group. My main concern with this is that I could end up with 2 groups that touch each other but are not connected to the rest of the groups.

Any ideas are appreciated. Let me know if you need any more information.




Aucun commentaire:

Enregistrer un commentaire