Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

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.

share|improve this question

marked as duplicate by Byte56, Trevor Powell, bummzack, Tetrad Feb 12 '13 at 23:59

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

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. – Kromster Jan 15 '13 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: – Qqwy Jan 15 '13 at 13:15
The link is not working - error 403. – Kromster Jan 15 '13 at 13:16
FORBIDDEN!!!! – bobobobo Jan 15 '13 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. – Philipp Jan 15 '13 at 16:56

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.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.