Dark Gaming — Game Maker

Posts categorized “Game Maker”.

January 28th 2011
by Dark

Hexagonal Grid Engine

Having worked a lot on my game “Blue Sun” I learned how to imeplent hexagonal grid boards for games.
I wrote a short tutorial about them on Game Maker Forum.
It only explained some basic theory behind the hexagonal grids so I sometimes had people contacting me asking more about the topic.
I always tried to be helpfull, but eventually I realised that my tutorial is not enough. Even knowing the theory, implementing a hexagonal grid can be a nightmare.
Since I myself knew all the problems and solutions out of my head I decided to write my own hexagonal grid engine for Game Maker. Helping people do it themselves was not enough.

The engine is done, ready and free to use.
I must admit I am really satisfied with how this worked out. I implemented a clean, stable engine with easy to use functions and interface while giving many possibilities and freedom to use it in the desired way.
Basically the engine just marks hexagonal fields with objects. What the user does with these objects is up to him/her.
Another great feature of the engine is that it can support many more hexagonal grids than one. You could, for example use a separate hexagonal grids in your game where one represents ground space, while other represents air. These grids could have their own obstacles and terrain aspects.

The funny thing about this engine is that I was really surprised how fast it worked.
Implementing hexagonal grid in Blue Sun I encountered a few performance problems. I had to work on optimising the movement path searching.
The hexagonal grids in the engine I made worked much much faster. In Blue Sun path finding was getting slow with about 1 second delay for movement above 7 fields of range.
In the grid engine paths are built almost instantly with similar or larger ranges.
I guess I will just need to revise my Blue Sun code sometime.