I have an idea for a game map and have researched some into it. What i’m going to do is have a 2D map(s) that a GM can pick from, or they can create their own using predefined images or images of a particular size they can upload.
From what i’ve seen, people are using a 2-Dimensional Array, but this is for tiles.
So what my question would be, is there a better way of doing this, for Hexagon? Not necessarily easier, but better. Something that can be used on a large scale, say 1000×1000 hex (100×100 px, 50 radius)
Edit:
I found this site that explains a way to draw out the hexagons. I think i might follow it, unless someone knows a better way.
2
You can totally use a 2-D array for a hexagonal map. Red Blob Games has a colossal list of hexagonal resources as well as a massively in-depth tutorial including how to map hexagons to a square grid for storage.
Now that you can map hexagons to a 2-D array, I’ll let you in on a secret, it doesn’t technically matter which you use since there’s potentially a better way to store these.
This is a Quad Tree:
Quad Trees are commonly used to index spatial data and being that they are trees, the can be much more compact than arrays. They also are more flexible as they don’t have to be stored sequentially. However, this will only be useful if you are storing maps that are very very large, so you might want to combine the two approaches depending on your allowed map sizes and other implementation related factors.
1