Indie Game Dev Log: 04/05/2020 (Procedural Hexagon Grid Game Board Creation II)
Procedural Hexagon Grid Battle Map Generation

Indie Game Dev Log: 04/05/2020 (Procedural Hexagon Grid Game Board Creation II)

By Timanious | Coster Graphics | 4 May 2020


Hey all! 

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

Cheers,
And don't forget to leave a free Tip! 🙏    

My Other Posts - https://www.publish0x.com/coster-graphics
Blog - https://timcoster.com
Twitter- https://twitter.com/timcoster
T-Shirts- https://www.teepublic.com/user/timcoster


Timanious
Timanious

I'm an independent artist, teacher and game developer from the Netherlands. I love learning and writing tutorials about game design with Unity3D, programming and shaders. Feel free to visit my graphics blog at: timcoster.com


Coster Graphics
Coster Graphics

Coster-Graphics Game development and design tutorials and graphics

Send a $0.01 microtip in crypto to the author, and earn yourself as you read!

20% to author / 80% to me.
We pay the tips from our rewards pool.