I’ve heard that A* pathfinding is one of the best ways to implement AI so that it finds and reaches the player, but is there another alternative to this?
If you want to learn about pathfinding and you want a Corona ready solution, use Jumper:
Original:
- Source: https://github.com/Yonaba/Jumper
- Examples: https://github.com/Yonaba/Jumper-Examples/tree/corona
@alexpanc’s branch and mods for Corona: https://github.com/pancinteractive/Jumper
Alex talks about his usage a little here: https://forums.coronalabs.com/topic/70156-startpoint-to-endpoint-pathfinding-in-segreta-2-with-jumper/#entry
PS - There are myriad ‘other’ pathfinding solutions, but something tells me you need to back up a bit and understand what path finding is, what problems it solves, then consider what problems you are trying to solve.
You can run into pathfinding and just skim the surface or dive in deep and learn a lot.
One great place to learn about pathfinding (and many other fun topics) is Amit Patel’s site: https://www.redblobgames.com/
A* is a special case of Dijkstra’s algorithm for finding paths through graphs. (A grid is just a graph where the vertices are on the centers of the squares, each connected to its neighbors.) There are a few alternatives in the “See Also” section on that page, as well as in the “Graph and tree search algorithms” sidebar.
“Finding and reaching the player” might sometimes be more than you need, of course. For instance, you might only want to know if two characters are in the same region, and there are some handy data structures like disjoint sets to assemble this information and query it.
If you want to learn about pathfinding and you want a Corona ready solution, use Jumper:
Original:
- Source: https://github.com/Yonaba/Jumper
- Examples: https://github.com/Yonaba/Jumper-Examples/tree/corona
@alexpanc’s branch and mods for Corona: https://github.com/pancinteractive/Jumper
Alex talks about his usage a little here: https://forums.coronalabs.com/topic/70156-startpoint-to-endpoint-pathfinding-in-segreta-2-with-jumper/#entry
PS - There are myriad ‘other’ pathfinding solutions, but something tells me you need to back up a bit and understand what path finding is, what problems it solves, then consider what problems you are trying to solve.
You can run into pathfinding and just skim the surface or dive in deep and learn a lot.
One great place to learn about pathfinding (and many other fun topics) is Amit Patel’s site: https://www.redblobgames.com/
A* is a special case of Dijkstra’s algorithm for finding paths through graphs. (A grid is just a graph where the vertices are on the centers of the squares, each connected to its neighbors.) There are a few alternatives in the “See Also” section on that page, as well as in the “Graph and tree search algorithms” sidebar.
“Finding and reaching the player” might sometimes be more than you need, of course. For instance, you might only want to know if two characters are in the same region, and there are some handy data structures like disjoint sets to assemble this information and query it.