<br><br>On Friday, June 2, 2017, Ralph Versteegen <<a href="mailto:teeemcee@gmail.com">teeemcee@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On 3 June 2017 at 08:52,  <span dir="ltr"><<a href="javascript:_e(%7B%7D,'cvml','subversion@hamsterrepublic.com');" target="_blank">subversion@hamsterrepublic.<wbr>com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">james<br>
2017-06-02 13:52:32 -0700 (Fri, 02 Jun 2017)<br>
231<br>
Implement AStarPathfinder.maxdist which limits how far the A* flood-fill is allowed to go before giving up.<br>
Currently set to 30 tiles (manhattan distance)<br>
<br>
I'll definitely want this to be customizable on an NPC-by-NPC basis later.<br>
---<br>
U   wip/game.bas<br>
U   wip/pathfinding.bas<br>
U   wip/util.bas<br>
U   wip/<a href="http://util.bi" rel="noreferrer" target="_blank">util.bi</a><br></blockquote><br>I think it would be better to place a limit on the number of open+closed nodes instead (aka number of tiles explored). That way, if there is a cheap path, it can be found, and the limit is directly proportional to the amount of time spent. Although it might be less intuitive how far "1000 tiles" gets you, it is intuitive that 2000 tried twice as hard as 1000, and setting the limit to 100000 may be a bad thing although maxdist 100 may not sound bad.<br><br></div><div class="gmail_quote">In fact, I found that this maxdist limit actually hugely slows down pathfinding when there is a path. If you are 32 tiles from the NPC, then the pathfinding can't reach you, but explores all other possible tiles in range (which is up to about 1800, which is really slow now, but should be OK once pathing is optimised)</div><br></div></div></blockquote><div><br></div><div>I think you are right. I had picked max manhattan distance from start because being able to get around a 30 block obstacle made sense to me, but your point about an tiles-explored limit being directly proportional is even more important. I'll change it, when I get a chance.</div><div><br></div><div> </div>