2

I have a working implementation of Rectangular Symmetry Reduction (see here and here for more information on RSR).

I'm interested in further improving performance over raw A* by implementing caching of paths. My assumptions are as follows:

  • We're working on a 4-connect square grid
  • The Destination position is more important than the start position.
  • Because RSR is made possible via contiguous rectangular regions, the fastest path between two points in the same region is likely to be the same (but not always)

It's at this point that I get stuck -- I'm unsure how best to use those assumptions and the information generated by a path calculation to better future path calculations.

I've considered storing the path cost from the final waypoint (that is, where the resultant path leaves the first rectangle), but as far as I've been able to consider, that is only useful if I have the path cost from every other potential waypoint on the rectangle's edge -- so good if you've got a lot of rectangular rooms separated by doors (few open edges), less so if you're pathing around wide open fields with a few scattered rocks (many open edges).

Essentially, my intuition is that going that route would potentially necessitate a lot of pathfinding before caching could provide any returns, so I'm looking for someone else's opinion on whether I'm on the right track, or if I'm missing a simpler way of implementing a performance-boosting caching algorithm.

Thoughts? I'm more than happy to discuss more of what I understand of the algorithm or share specific code if requested.

Raven Dreamer
  • 1,867
  • 2
  • 21
  • 38
  • It sounds like you want to combine RSR with HPA*. I don't see any reason you couldn't do that. Treat the entrance/exit of every rectangle as a (single) node, and create edges between all nodes within a rectangle. To prevent the "open field" issue, you could limit the size of the rectangles. Or at that point, just use HPA* itself. – BlueRaja - Danny Pflughoeft Jan 03 '20 at 01:31
  • @BlueRaja-DannyPflughoeft Figures you'd show up, given I'm using some of your code in this project, hey? :) Your suggestion is intriguing, and has given me some ideas. To be clear, though, HPA* has nothing to do with caching, correct? – Raven Dreamer Jan 03 '20 at 01:50
  • I mean, you could call it caching if you want? You're creating a new graph where every "entrance" is a node, and there's a single edge between entrances, so to find the distance between entrances you only need to traverse a single edge. The suggestion here is, instead of breaking the graph into constant sized squares, you break it into variable-sized rectangles using RSR, then apply HPA*. IIRC there's another algorithm based on a similar idea, which called the entrances "portals", but I can't find it... – BlueRaja - Danny Pflughoeft Jan 03 '20 at 02:17
  • 1
    Hm. I think I remember a reference to that as well. Perhaps this one Looks relevant, at least. Though at that point, we're not using much "RSR" other than the "decompose things into rectangles" bit, which is left as an exercise to the reader in the first place. Hm. – Raven Dreamer Jan 03 '20 at 02:34
  • I will add as a comment (because it doesn't seem fair to change the question at this point), that one of the principle benefits of my implementation-at-current is that I've got it so that dynamic updates are possible. (More pathfinding cost than if you re-ran the decomposition, but still better than raw A*) Integrating other techniques which require pre-computation might make things faster, but will lose the possibility for dynamic pathfinding. – Raven Dreamer Jan 03 '20 at 21:58
  • If you're talking about LPA* (the usual algorithm for making A* incremental), there's no reason you can't combine this with HPA*. LPA* changes the way the pathfinding algorithm works, while HPA* changes the graph over which the algorithm is searching. Note that if this is for a game, your time would probably be better spent elsewhere – BlueRaja - Danny Pflughoeft Jan 04 '20 at 01:08
  • @BlueRaja-DannyPflughoeft if you post the link to LPA* as an answer, I will accept it - that's the sort of thing I'm looking for. My problem is being unfamiliar with the problem space (pathfinding), and not knowing the names of things or appropriate terminology has stymied my research efforts. – Raven Dreamer Jan 04 '20 at 04:00

0 Answers0