1 / 23

Pathfinding

Pathfinding. Extensions: Terrain Cost, Influence Mapping. Extending Pathfinding. Standard pathfinding algorithms (A*, Dijkstra, etc.) can be extended to simulate intelligent environments Terrain costing Influence mapping A* pathfinding also have many interesting variants

bernie
Download Presentation

Pathfinding

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Pathfinding Extensions: Terrain Cost, Influence Mapping

  2. Extending Pathfinding • Standard pathfinding algorithms (A*, Dijkstra, etc.) can be extended to simulate intelligent environments • Terrain costing • Influence mapping • A* pathfinding also have many interesting variants • Iterative deepening (IDA*) • Dynamic A* • Jump point search – Rectangular Symmetry Reduction (Harabor, 2011)

  3. Realistic? • Standard A* algorithm determines path cost based on distance travelled • However, for realistic worlds, the shortest possible path is NOT always the fastest path! • Terrain types can contribute to the differences in selection of best path • In our initial examples of A* algorithm, there is terrain cost… but that cost is uniform, because all the terrain are the same!

  4. Terrain Cost • There is no reason why we can’t assign different cost values to different nodes • Remember how to calculate the total cost in the original algorithm? f(n) = g(n) + h(n) • How do we factor in the terrain cost into this formula? Suggestions?

  5. A* Algorithm – Terrain Cost • Using the previous example of the spider and man…but with added terrain tiles.

  6. A* Algorithm – Terrain Cost • A* Algorithm always searches for the path with the lowest total cost, so your design of the formula is crucial! • Now, let’s examine the original path over the new “terrain-ized” map…

  7. A* Algorithm – Terrain Cost • Re-calculating the path using the terrain costs…

  8. A* Algorithm – Terrain Cost • We now get a slightly different lowest-cost path that “looks” longer…

  9. A* Algorithm – Terrain Cost • For the sake of realistic implementation, the speed of the character over higher-cost terrains should be slower (by about the same factor used for the path terrain cost) • This is so that the character does not appear to take an even longer time to traverse the new lowest-cost path!

  10. A* Algorithm – Terrain Cost • Terrain cost is also useful in CE • In TBE, all nodes are equidistant (assuming that every tile is represented by a node), but in CE, nodes can be situated at different distances from one another • Although the varying distances have already different costs, terrain costs can also be incorporated • It is possible to think of cost as other types of resources such as money, fuel, etc.

  11. Dynamic Path Costs? • Terrain cost is usually something programmers hardcode or pre-determine in the game world • However, other kinds of elements can influence path cost • For e.g. Nodes that pass through the line of sight of any enemy might present a higher cost. We cannot build this cost into the game level since the position of the game characters can change! • What other possible scenarios where path cost can dynamically change throughout the game?

  12. Influence Mapping • Influence mapping is a way to vary the cost of the nodes depending on what happens during the game (dynamic)

  13. Influence Mapping • The position and orientation of the tank below influences the “danger cost” of taking a certain path. • Observe how the danger costs are assigned to the nodes near the tank’s line of fire. • Building the best path will result in the character taking a longer, slower and less dangerous path • This influence map changes dynamically when the tank eventually moves or turns.

  14. Influence Mapping • You can use influence mapping in many creative ways to make your characters seem smart. • E.g. Record individual game incidents in an influence map. There might be locations in map that: • The human player repeatedly ambushes or kills NPCs at a certain doorway. That doorway might increase in cost in future rounds, allowing the NPC to build alternative paths if possible. • It appears that the NPCs are learning from their past mistakes!

  15. Influence Mapping • Influence map using number of kills that occur in the map. “Danger spots” are being identified by adding these danger costs to future path calculations.

  16. Influence Mapping in RTS • In RTS, influence maps can be built for base turrets/towers/ defensive structures • We can imagine them as having a “radius” of influence. Realistically, the influence should be taken to drop off with distance

  17. Linear Influence Model • We can use a simple linear drop off to model this I0 is the influence at distance 0 X d

  18. Limited radius of influence • Many units with a million locations in the world map  Huge calculation task! • Limited radius of influence : to constrain the effect of influence to a certain radius. Beyond this max radius, unit cannot exert influence, no matter how weak r

  19. Limited radius of influence • If we use a linear drop off formula for influence, and we have a threshold influence, It then the radius of influence r

  20. Limited radius of influence • Disadvantage: Small influences do not add up over large distances • E.g. The zone in front of the 3 turrets is potentially dangerous, however the location just outside all three have 0 influence! • Actual influence effect of all 3 turrets should be the blue circle instead

  21. Overlapping influences • Overlapping influences (from more than one unit) should be totaled up. Here’s an example influence map

  22. Influence Mapping in RTS • In RTS, influence mapping can also be used for other tactical/strategic purposes • Tactical analysis – dealing with known and unknown base influences (“Fog-of-war”)

  23. Influence Mapping in RTS • Multi-layer tactical information – combining multiple influence maps to make decisions (e.g. using security, visibility and proximity factors to decide where to place new towers)

More Related