
1 Attachment(s)
AI Path Finding.
So I have an idea for path finding, I just don't know where to start to turn it into code. Say you have point A and point B, all of the tiles in the map would have assigned numbers. The numbers represent the distance from point A to point B. Here is a graphical representation of what I want to complete.
Attachment 5854
As you can see, starting from point A, 7 is the smallest number out of the surrounding tiles, I would move to a tile with the number 7. I would then reevaluate the grid, 6 would become the next smallest number, and so on. As you can see in my picture, the highlighted paths are both the smallest possible paths from point A to point B, assuming I can only move in a linear motion. It does not matter which path I choose because they are equal. So, where would I even start with this implementation? (1 is a barrier and will not be considered in the path finding)

Re: AI Path Finding.
I think you might be better off going to the Java Gaming Forums to do this. They might know some methods to use for path finding.
JavaGaming.org  home of the largest java game developer community

Re: AI Path Finding.
depending on what is your priority you could give following algoritms a look:
breadth first algorithm ==> Breadthfirst search  Wikipedia, the free encyclopedia (this will find a solution if there is a solution, but not necessarily the best (shortest, least pathcost) route)
depth first algorithm ==> Depthfirst search  Wikipedia, the free encyclopedia (this will find a solution if there is a solution, but not necessarily the best (shortest, least pathcost) route)
or the a* algorithm (which i would suggest since this is prob the most efficient) ==> A* search algorithm  Wikipedia, the free encyclopedia
and bassicly, you are gonna make a tree or graph from you grid, and traverse that tree or graph with the chosen algoritm.
hope this helps a bit. ;)
grtz liluma

Re: AI Path Finding.
A simple Dijkstra labeling algorithm can do the job (it'll find an optimal solution).
kind regards,
Jos

Re: AI Path Finding.
I have decided I am going to implement the A* path finding algorithm.

Re: AI Path Finding.
Good choice, IMO. Its a nice challenge for the brain too.