1
\$\begingroup\$

I'm creating an isometric game which currently uses A* Pathfinding on a basic grid representation of the map.

Having elevations and allowing the Players to traverse up-and-down is an integral part of the game - however I'm stuck on exactly how to implement that, whether it be with A* or something else.

For example,

---------------------------------
| 0 | 0 | 0 | X | 0 | 4 | 4 | 4 |
---------------------------------
| 0 | 0 | 0 | 0 | 0 | 4 | 4 | 4 |
---------------------------------
| 0 | 0 | 1 | 2 | 3 | 4 | 4 | 4 |
---------------------------------

Assuming X is the Player, the numbers are tile elevations, and that the Player can only traverse tiles +/- 1 elevation to the tile they're currently on, is there an accepted/known way of doing this pathfinding?

\$\endgroup\$
1
\$\begingroup\$

Inside your A* algorithm, you have a loop where you iterate over the reachable nodes neighbouring the current node under inspection. If the elevation disparity between the two nodes is greater than your threshold, it is not reachable. You skip over that neighbour, so the algorithm doesn't try traversing the edge between these two nodes.

It might help if you edit your question to elaborate on where specifically you've run into trouble incorporating this elevation check into your particular A* implementation.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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