Results 1 to 6 of 6
Thread: AI Path Finding.
 01152014, 03:45 AM #1▼ dafuq did I do?
 Join Date
 Dec 2013
 Posts
 204
 Rep Power
 0
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.
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)
 01152014, 04:12 AM #2Senior Member
 Join Date
 Jan 2013
 Posts
 168
 Rep Power
 4
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
 01152014, 08:34 AM #3
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 lilumaLast edited by liluma; 01152014 at 08:37 AM.
 01152014, 09:38 AM #4
 Join Date
 Sep 2008
 Location
 Voorschoten, the Netherlands
 Posts
 14,271
 Blog Entries
 7
 Rep Power
 24
Re: AI Path Finding.
A simple Dijkstra labeling algorithm can do the job (it'll find an optimal solution).
kind regards,
JosThe only person who got everything done by Friday was Robinson Crusoe.
 01162014, 12:03 AM #5▼ dafuq did I do?
 Join Date
 Dec 2013
 Posts
 204
 Rep Power
 0
Re: AI Path Finding.
I have decided I am going to implement the A* path finding algorithm.
 01162014, 10:17 AM #6Just a guy
 Join Date
 Jun 2013
 Location
 Netherlands
 Posts
 5,104
 Rep Power
 9
Similar Threads

Finding program path
By sathya11491 in forum New To JavaReplies: 3Last Post: 03212012, 01:40 PM 
Regarding the conversion of local machine path to UNC path
By abhish in forum NetworkingReplies: 1Last Post: 11142011, 05:39 PM 
Finding path to my command line tools from Java
By paulanon in forum New To JavaReplies: 1Last Post: 04072011, 02:34 AM 
setting classpath & Library Path in ubantu
By programmer_007 in forum EclipseReplies: 18Last Post: 02222010, 01:31 PM
Bookmarks