Calm Turtle
Calm Turtle

Reputation: 292

What algorithm does GameplayKit pathfinding use?

Has anyone found reference to what type of algorithm GameplayKit uses for pathfinding? I have reviewed Apple's documentation and was not able to find anything.

Ultimately I am curious to its performance vs. A* implemented without GameplayKit. While I am sure Apple did an amazing job, I don't want to pay performance overhead for features I will not use.

I am also just curious because I enjoy learning about these types of mechanics.

Thanks, E

Upvotes: 4

Views: 269

Answers (1)

rickster
rickster

Reputation: 126177

Only Apple can say for sure. But the presence of methods for both cost and estimated-cost strongly suggests A*, or at least some variant on it with similar enough algorithmic complexity.

If you're really concerned about performance, though, set yourself up with some test cases and profile them. You can start with something like their Pathfinder sample code project... re-run pathfinding with lots of different mazes and see how the time (which is pretty darn short already) changes with maze size.

Upvotes: 5

Related Questions