Search code examples
javascriptdomperformancepath-finding

Looking for information about pathfinding on isometric maps


I am working on a game engine called Engine1 (logo is a big steam train). I've been very successful with motion animation, sprite animation and element manipulation. I can create/destory/animate elements very quickly (about ~1000 elements every 1/40 of a second).

I'm now looking to expand my engine to include a library for isometric maps with path finding support. Please don't give me copy and paste code. I'm looking for information and theory about efficient algorithms for isometric path-finding.

I also plan on releasing my engine as open source after I release my own game with it first (proof of concept). If your interested in snagging an early build message me.


Solution

  • The basic grid path-finding algorithm is very simple:

    • Take your starting cell, recursively hit every adjacent possible cell
      • ignore invalid cells, e.g. walls/etc
    • whenever you hit a cell, only continue if you're at the lowest step for that cell. e.g.:
    • Die whenever you're further than the best distance so far

      A B C
      D E F
      G H I
      

    You have several paths from A-I (in random order):

    • A-B(1)-C(2)-F(3)-E(4)-H(5)-I(6)
    • A-D(1)-E(2)-B(3) -- die because B(3) > B(1)
    • A-D(1)-E(2)-F(3)-I(4)
    • A-B(1)-E(2)-D(3) -- die because D(3) > D(1)