Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit number of operations #117

Open
Oza94 opened this issue Mar 4, 2016 · 3 comments
Open

Limit number of operations #117

Oza94 opened this issue Mar 4, 2016 · 3 comments

Comments

@Oza94
Copy link

Oza94 commented Mar 4, 2016

Hello,

I wonder if there is a simple way to tell this lib to stop once it has reached a certain number of operations. I have a game where some maps are labyrinths and I don't want to calculate a full path if I reach a certain distance/complexity (the destination is considered "too far" to be reached in one pathfinding pass).

Regarding the actual implementation, this would need to update each finder to include this new parameter. Or maybe I'm missing something?

@brean
Copy link

brean commented Dec 29, 2017

It is possible, the implementation is quite trivial. I did this for the python implementation (see
runs in keep_running that I call every time I iterate over the next node)

@tukkek
Copy link

tukkek commented Apr 9, 2019

It would also be great to allow the limit to be set not by total number of operations/iterations but thrrough maximum distance. For example: a certain unit can only move 6 steps this turn so whenever an ongoing calculation reaches more than 6 steps, drop that path.

It might be possible to achieve that by passing a virtual "reachable this turn" grid instead of the full grid but that's pretty inelegant.

@Bingdom
Copy link

Bingdom commented May 19, 2023

Bumping this old thread- this is something that would benefit me too.

I have units in my game which will attempt to generate a path to the player (but may often be blocked by other units)- so it never finds a path and hence, can become computationally expensive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants