DOC PREVIEW
UCF COT 4810 - AI Pathfinding

This preview shows page 1-2-3-27-28-29 out of 29 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 29 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 29 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 29 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 29 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 29 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 29 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 29 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Slide 1Slide 2Slide 3Slide 4Slide 5Slide 6Slide 7Slide 8Slide 9Slide 10Slide 11Slide 12Slide 13Slide 14Slide 15Slide 16Slide 17Slide 18Slide 19Slide 20Slide 21Slide 22Slide 23Slide 24Slide 25Slide 26Slide 27Slide 28Slide 29AI PathfindingAI PathfindingChristopher ZoncaChristopher Zonca04/10/200804/10/2008OverviewOverviewWhat is AI pathfinding?What is AI pathfinding?Why is it important?Why is it important?Possible solutionsPossible solutionsA* SearchA* SearchApplicationsApplicationsSpeeding it upSpeeding it upConclusionsConclusionsWhat is Pathfinding?What is Pathfinding?Getting from point A to point BGetting from point A to point BWhat is Pathfinding?What is Pathfinding?Must be fast!Must be fast!Must give optimal (or near optimal) Must give optimal (or near optimal) solutionssolutionsWhy is this important?Why is this important?Have you ever played a game with Have you ever played a game with frustrating pathfinding? frustrating pathfinding?Why is this important?Why is this important?Many games need good pathfindingMany games need good pathfindingThis is difficult!This is difficult!Possible SolutionsPossible SolutionsBest-First Search (BFS)Best-First Search (BFS)Greedy algorithmGreedy algorithmUses what's known as a heuristicUses what's known as a heuristicMore on heuristics laterMore on heuristics laterFast, but not optimalFast, but not optimalPossible SolutionsPossible SolutionsDijkstra'sDijkstra'sDynamic programming solutionDynamic programming solutionNot as fast as BFS but finds optimal Not as fast as BFS but finds optimal solutionsolutionUseful when we don’t know where Useful when we don’t know where we’re goingwe’re goingPossible SolutionsPossible SolutionsA* SearchA* SearchCombines the best of BFS and Combines the best of BFS and Dijkstra'sDijkstra'sVery similar to Dijkstra's but uses a Very similar to Dijkstra's but uses a heuristic to guide the searchheuristic to guide the searchVery fast and multi-purpose algorithmVery fast and multi-purpose algorithmMore on heuristicsMore on heuristicsIn this context, it's a guessIn this context, it's a guessReturns the estimated distance Returns the estimated distance between the inputted node and the between the inputted node and the destinationdestinationCommon methods: Common methods: Manhattan Distance Manhattan Distance Euclidean DistanceEuclidean DistanceEuclidean Distance SquaredEuclidean Distance SquaredMore on A*More on A*Generally considered an industry Generally considered an industry standardstandardMany games use A* for pathfindingMany games use A* for pathfindingData Structure of A*Data Structure of A*Create nodes throughout the search spaceCreate nodes throughout the search spaceWe will look at the example of a 2D gridWe will look at the example of a 2D gridCan be adapted to work in 3D environmentsCan be adapted to work in 3D environmentsEach node has three fields:Each node has three fields:A value that we will calculate as we visit the A value that we will calculate as we visit the nodesnodesThe distance to the start nodeThe distance to the start nodeA parent which is used to reconstruct the final A parent which is used to reconstruct the final pathpathCreate a priority queue, initialized to Create a priority queue, initialized to contain the starting nodecontain the starting nodeSorted by the node's f-valueSorted by the node's f-valueAlgorithm of A*Algorithm of A*Remove the first item of the queue Remove the first item of the queue Calculate the f-value for all adjacent nodesCalculate the f-value for all adjacent nodesf(n) = g(n) + h(n)f(n) = g(n) + h(n)g(n) is the shortest distance from that node to g(n) is the shortest distance from that node to the startthe starth(n) is the result of the heuristic explained h(n) is the result of the heuristic explained earlierearlierIf this f-value is less than its current f-value, If this f-value is less than its current f-value, replace it and set its parent to the current nodereplace it and set its parent to the current nodeAdd all unvisited neighboring nodes to the Add all unvisited neighboring nodes to the queuequeueRepeat until the destination node is selectedRepeat until the destination node is selectedDemonstrationDemonstrationQuirks of A*Quirks of A*|h(n) – h*(n)| |h(n) – h*(n)| << log(h*(n)) log(h*(n))If this is true, polynomial time is guaranteedIf this is true, polynomial time is guaranteedIf this is false, exponential time is possibleIf this is false, exponential time is possibleIf h(n) – h*(n) = 0, linear time!If h(n) – h*(n) = 0, linear time!Heuristic is admissible if it is always Heuristic is admissible if it is always smaller than the actual distancesmaller than the actual distanceIf it's too high, A* becomes BFSIf it's too high, A* becomes BFSIf its too low, A* becomes Dijkstra'sIf its too low, A* becomes Dijkstra'sAdapting to game worldAdapting to game worldSome games lend themselves easily Some games lend themselves easily to these kinds of algorithmsto these kinds of algorithmsAdapting to game worldAdapting to game worldMost environments can be adaptedMost environments can be adaptedCreate graph of nodes and apply Create graph of nodes and apply algorithmalgorithmBe sure to account for obstacles if Be sure to account for obstacles if dynamic node creation is useddynamic node creation is used=>SpeedSpeedPathfinding in general is slowPathfinding in general is slowLarge time and space complexitiesLarge time and space complexities=>Possible SolutionsPossible SolutionsMany techniques are usedMany techniques are usedUse a high heuristicUse a high heuristicUseful when we don't need Useful when we don't need exactexactHanswers, just good ones (although Hanswers, just good ones (although this isn't guaranteed)this isn't guaranteed)=>Possible SolutionsPossible SolutionsUse a tie-breaking schemaUse a tie-breaking schemaPrefer points near the destination nodePrefer points near the destination nodeTurns into...Much better!Much better!More SolutionsMore SolutionsAdd a processing queueAdd a processing queueWhen a unit needs a path, use a quick When a unit needs a path, use a quick algorithm (like BFS) to find onealgorithm (like BFS) to find oneAdd it to a low priority processing Add it to a low priority processing queuequeueWhen it's its turn,


View Full Document

UCF COT 4810 - AI Pathfinding

Documents in this Course
Spoofing

Spoofing

25 pages

CAPTCHA

CAPTCHA

18 pages

Load more
Download AI Pathfinding
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view AI Pathfinding and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view AI Pathfinding 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?