# Hexagonal vs square tiles

• 04-26-2007
OnionKnight
Hexagonal vs square tiles
I'm working on designing a game which is supposed to be a spiritual successor to Heroes 3.
I then started pondering whether I should use hexagonal or square tiles for the world map. With square tiles there is an obvious "problem" with diagonal tiles being sqrt(2) times larger than the sides, does hexagonal tiles not have this problem or have I missed something in the math?
• 04-26-2007
Sang-drax
With square tiles you have two "obvious directions" of movement. With hexagonal tiles you have three. When you try to diagonally in a square grid, you run into the problem you described. This is avoided (in some sense) in hexagonal grids because there is no neighbours to go to, other than the tiles which alreay share a side.
• 04-26-2007
quzah
You can represent hex-rows as a 2D array. You just need to offset every other row, and adjust your movement.
Code:

[00][01][02][03][04]
[00][01][02][03][04]
[00][01][02][03][04]
[00][01][02][03][04]
[00][01][02][03][04]

So if you're not sure how to get hexes in memory, just use a 2D array, and consider the above illustration on how to work out your movement and neighboring hexes.

Quzah.