Inconsistent movement / line-of-sight around obstacles on a hexagonal grid

Posted by Darq on Game Development See other posts from Game Development or by Darq
Published on 2014-06-11T12:50:20Z Indexed on 2014/06/11 15:44 UTC
Read the original article Hit count: 364

In a roguelike game I've been working on, one of my core design goals has been to allow the player to "Play the game, not the grid."

In essence, I want the player's positioning to be tactical because of elements in the game world, not simply because some grid tiles are more advantageous than others, in relation to enemies. I am fine with world geometry not being realistic, but it needs to be consistent.

In this process I have ran into most of the common problems (Square tiles? Diagonal movement, LOS, corner cases, etc.) and have moved to a hexagonal tile grid. For the most part this has been great, and I've not had too many inconsistencies.

Recently however I have been stumped by the following: Points A and B are both distance 4 from the player, line-of-sight to both are blocked by walls distance 2 from the player. Due to the hexagonal grid, A can be reached in 4 moves, circumventing the wall, whereas B requires 5 moves, as the wall more effectively blocks the path in this direction.

Points A and B are both distance 4 from the player (red lines). Line-of-sight to both are blocked by walls (black tiles). However, due to the hexagonal grid, A can be reached in 4 moves, whereas B requires 5 moves (blue lines).

On a hex grid, "shortest path" seems divorced from "direct path", there may be multiple shortest paths to any point, but there is only one direct path (or two in some situations). This is fine, geometry need not be realistic.

However this also seems inconsistent, similar obstacles are more effective in some positions than in others. A player running away from an enemy should be able to run in any direction, increasing the distance between the two actors. However when placing obstacles or traps between themselves and enemies, the player is best served by running in one of the six directions that don't have multiple shortest paths.

Is there a way to rationalise this? Am I missing something that makes this behaviour consistent? Or is there a way to make this behaviour consistent? I am most certainly over-thinking this, but as it is one of my goals, I should do it due diligence.

© Game Development or respective owner

Related posts about movement

Related posts about grid