2
\$\begingroup\$

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.

\$\endgroup\$
9
  • \$\begingroup\$ 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. \$\endgroup\$
    – Kromster
    Jan 15, 2013 at 13:02
  • \$\begingroup\$ 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 \$\endgroup\$
    – Qqwy
    Jan 15, 2013 at 13:15
  • \$\begingroup\$ The link is not working - error 403. \$\endgroup\$
    – Kromster
    Jan 15, 2013 at 13:16
  • \$\begingroup\$ FORBIDDEN!!!! \$\endgroup\$
    – bobobobo
    Jan 15, 2013 at 13:29
  • 1
    \$\begingroup\$ 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. \$\endgroup\$
    – Philipp
    Jan 15, 2013 at 16:56

1 Answer 1

2
\$\begingroup\$

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.

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged .