Since the last time I wrote I have been really busy with the development of a randomised hexagonal grid based game board generator script for my mobile arcade tank game project.. (See previous posts for more about that)
Right now I would love to show you guys something finished, but as always with game design, it takes a lot longer than expected. So I will just talk about the process and inspiration instead.
For the campaign mode of the game I want to create a boardgame-style gameboard that the player has to move his or her pawn across towards the enemy base and after each turn a battle level will start.
Because i want each new campaign to be a little bit different and unpredictable I also want the layout of the game board to be randomised for each newly created campaign.
A lot of games have a worldmap-like level selection screen on which you can move the player to different locations to play the different levels, the first game I remember playing that has this was Super Mario Bros. 3 on the NES and it is something I always really enjoy in games..
Now that i think of it..there was also this awful Godzilla game on the NES that had a hex grid map screen kinda like what I'm creating now..:
But I'm inspired a lot by the game BattleZone VR for my own game so I'm trying to figure out how the developers did it in that game. Which is a lot harder than i expected it to be!😅:
For now I think I have made a pretty good start.. I coded a script that spawns a grid of hexagonal cell objects and I also implemented a 'cubic' coordinates system, giving each hexagon a three dimensional x y z position in the grid.
This has the advantage over a two-dimensional x y coordinate system in that it makes it possible to easily move pawns and plan routes in all six directions of any hexagon in the grid without having to worry about the even and odd rows or columns of a hexagonal grid.
It took a while to wrap my brain around this cubic coordinate system (did I mention not finishing high school..?) but after reading and thinking about it for a couple of days it all made sense..:
These three websites really helped me with the hexagonal grid logic (I suggest definitely taking a look to the third website, because it is beautiful.):
I also started with creating the code for procedurally generating the randomised hexagonal gameboard on top of the grid and I've had some success, but I'm still experimenting with different methods to generate the random board, to figure out what kind of logic and variables etc. I will need in the end. (Click on the GIF below to play it):
Right now I think I will try an approach similar to how procedurally generated rogue-like games, like the binding of Isaac, generate their randomised dungeons. So by connecting hexagons together that have a randomised number of 'openings' in different randomised directions. For instance a hexagon with an opening at the top can only connect to another random hexagon that at least has one opening at the bottom.
Because this system requires me to have different prefabs of all the possible combinations of hexagons with different openings at different directions I've worked on that today and I think I have all of them, but let me know if i missed a certain combination :p..:
And don't forget to leave a free Tip! 🙏
My Other Posts - https://www.publish0x.com/coster-graphics
Blog - https://timcoster.com