Storing a Hex Grid

Posted by Pedro Caetano on Game Development See other posts from Game Development or by Pedro Caetano
Published on 2012-10-21T11:55:05Z Indexed on 2012/10/21 17:20 UTC
Read the original article Hit count: 235

Filed under:
|
|
|

I've been creating a small hex grid framework for Unity3D and have come to the following dilema. This is my coordinate system (taken from here)

Link because I'm a new user

It all works pretty nicely except for the fact I have no idea how to store it. I originally intended to store this in a 2D array and use images to generate my maps.

One problem was that it had negative values (this was easily fixed by offsetting the coordinates a bit).

However, due to this coordinate system, such an image or bitmap would have to be diamond shaped - and since these structures are square shaped, this would cause a lot of headaches even if I hack something together. Is there anything I'm missing that could fix this? I recall seeing a forum post regarding this in the unity forums but I can no longer find the link.

Is writing a set of coordinate translators the best solution here?

If you guys think it would be helpful, I can post code and images of my problem.

© Game Development or respective owner

Related posts about image

Related posts about grid