How to handle slopes/bridges in a 2d grid turn based strategy game [duplicate]

I was wondering about the following:

In a 2D turn-based strategy game (using some grid(i.e. tiles, isometric hexagons) as movement), what techniques do they use to determine where a character moves next, especially how this works when stuff is happening that as far as I can see cannot be so easily implemented using a two-dimensional grid, such as slopes/different heights of movement and also things like bridges that characters might both walk over or under, depending on how they approach it.

• What is the problem about implementing slopes? If they are purely aesthetic then ignore them in games logic, if they affect logic - just add a property to cell that it has a slope. Commented Jan 15, 2013 at 13:02
• Yes, for simple slopes this would work. But when you have movement that is possible on multiple three-dimensional layers on a two-dimensional plane, such as the space right behnd the archer in this picture: squidi.net/three/set02/img/entry023-road2.png
– Qqwy
Commented Jan 15, 2013 at 13:15
• The link is not working - error 403. Commented Jan 15, 2013 at 13:16
• FORBIDDEN!!!! Commented Jan 15, 2013 at 13:29
• You shouldn't have accepted my answer so quickly. Maybe there are other methods which work even better for your case. But when you accept an answer, most people don't bother to write another one, because they assume you aren't looking anymore. Commented Jan 15, 2013 at 16:56

1 Answer

This issue can be solved by having multiple independent map layers and special tiles which serve as portals between these independent layers. In addition to their x and y coordinate, every object then also has a z-coordinate which carries the information which layer it is currently on - so the z-coordinate tells you if an object is under or on a bridge.

Most routefinding algorithms don't assume a single 2-dimensional grid, but can in fact work on any graph, no matter how many dimensions it has. So they can easily be adopted to deal with nodes which have an additional link which leads to a tile on another 2-dimensional grid.