-
Notifications
You must be signed in to change notification settings - Fork 46
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
Moving by predefined weaypoints #4
Comments
For a tower defense game you might want to consider using Dijkstra's algorithm to compute all single source shortest paths, then have each unit follow along the path tree to get to the root node. If you precalculate this data once, then you can just store it and get the movement for each unit in O(1) time. |
Thank you ! |
And if you don't have different movement costs for edges, you can use Breadth First Search instead of Dijkstra's Algorithm. Demo: http://www.redblobgames.com/pathfinding/tower-defense/ |
Thank you @redblobgames ! bfs looks simple, i'll try implement it. What the better way to visualize it ? |
First of all sorry , my question does not directly related to the path-finder :$
Can you please help me understand, find tools or documentation how to make some movement by predefined maps, how to create them, best practices idk. I'm trying learn through source code of some "towerdefence" games published on github, but.. it looks like they are does not implement it right . I don't know, but it feels like they are trying invent from 0 something like good known and many years available allgorithm. It looks like you know the secret of right algorithm for waypoints (2d of source), can you please help me, or suggest something to read to understand how to do it in right way.
Thank you
The text was updated successfully, but these errors were encountered: