Since last post I've been working on the procedural hexagon grid game board generator or 'BattleMapGenerator' is what I named the class..
The goal was to use a random grid cell spawning approach similar to how some procedurally generated dungeon games work (Read more about that in my previous post), so today I want to post the progress made in a GIF:
The only coded rules that the BattleMapGenerator has now is that it spawns one hexagon cell in the center of the board with 'openings' on all six sides. Then that cell spawns new cells on all six sides which have a random number of openings in random directions, with the only rule that each new cell has to connect to the other cells with their openings (in a procedurally generated dungeon the hexagons would be rooms and the openings would be doors to connecting rooms ).
As you can see in the GIF this simple random behaviour leads to the BattleMap growing in all six directions almost completely covering the board, except for some small holes here and there.
I think it is kind of pleasant to watch because it looks like growing fungus! 😀
On a very large grid the cells continue to grow for a very long time before stopping. I tried it with a max of 8000 cells or so but it was still growing and that many cells made the frame rate drop drastically so I haven't tested it any further. I could probably make it a lot more efficient by using Unity's relatively new ECS (Entitiy Component System) but I'm not familiar with that yet and it isn't needed for this game so maybe that is something for the future.
Because I want to generate more sparse maps with more holes in them, the next step is to implement a few more rules and constrictions to the spawning logic so the chance of holes in the map will increase...
And don't forget to leave a free Tip! 🙏
My Other Posts - https://www.publish0x.com/coster-graphics
Blog - https://timcoster.com