A Sparse Grid Representation for Dynamic Three-Dimensional Worlds

A Sparse Grid Representation for Dynamic Three-Dimensional Worlds

Proceedings of the Seventh AAAI Conference on Artificial Intelligence and Interactive Digital Entertainment A Sparse Grid Representation for Dynamic Three-Dimensional Worlds Nathan R. Sturtevant Department of Computer Science University of Denver Denver, CO, 80208 [email protected] Abstract array of blocked/unblocked values. But, because grids uni- formly represent all space, they are not suitable for many Grid representations offer many advantages for path plan- ning. Lookups in grids are fast, due to the uniform memory games, particularly large worlds. This results from a com- layout, and it is easy to modify grids. But, grids often have bination of planning costs, which can be reduced via ab- significant memory requirements, they cannot directly rep- straction, and storage costs, because grid information is allo- resent more complex surfaces, and path planning is slower cated for all cells whether or not they are passable. In addi- due to their high granularity representation of the world. The tion, grids have usually been restricted to two-dimensional speed of path planning on grids has been addressed using ab- terrain. A grid (or voxel) representation of a full three- stract representations, such as has been documented in work dimensional world would be even more expensive to main- on Dragon Age: Origins. The abstract representation used tain. in this game was compact, preventing permanent changes to This paper introduces an alternate sparse grid representa- the grid. In this paper we introduce a sparse grid representa- tion. The hypothesis behind this design was that a grid repre- tion, where grid cells are only stored where necessary. From this sparse representation we incrementally build an abstract sentation could be enhanced to achieve four purposes. First, graph which represents possible movement in the world at to avoid storing areas of the map which are not traversable. a high-level of granularity. This sparse representation also Second, to represent three-dimensional worlds. Third, to allows the representation of three-dimensional worlds. This easily allow points to be added to and removed from the representation allows the world to be incrementally changed world at runtime. Fourth, and finally, to quickly automati- in under a millisecond, reducing the maximum memory re- cally build and update an abstract world representation. The quired to store a map and abstraction from Dragon Age: Ori- representation described here achieves all of these metrics. gins by nearly one megabyte. Fundamentally, the represen- Post-mortem analysis of the maps that shipped with tation allows previously allocated but unused memory to be Dragon Age: Origins suggests that the original efforts fo- used in ways that result in higher-quality planning and more cused on reducing the memory used by the abstraction layer intelligent agents. were misplaced. The underlying grid uses approximately 10 times more memory than the abstraction layer, and thus the Introduction grid should have been the focus of optimization efforts. The choice of a world representation is a fundamental de- The remainder of the paper is as follows. First, back- cision that influences the features that can be put into the ground material on path planning approaches are covered, path planning engine for a game. Most representations offer as well as the tasks that a path planning system would be ex- trade-offs with some tasks being extremely easy, while other pected to handle. Then, the new design is described in detail. tasks are more difficult. It is also important to include within Finally, detailed experimental results show that this system the choice of representation the time required to implement is suitable for being deployed in a commercial system. the representation. While Blizzard had years to build a new path planning system for Starcraft 21, not every company has Background and Problem Definition the time to invest in such a system. On his AiGameDev.com There are a number of general tasks related to path planning 2 web site, Alex Champandard recommends waypoint graphs that any representation must be able to handle. When a plan- “since they’re a simple and effective approach to naviga- ning task arrives, the location of the relevant agent within the tion”, even though navigation meshes offer a richer feature representation is known, but a target location will often be set. in arbitrary coordinates that must then be converted into the Grids have also been a popular representation (eg (Sturte- representation format. This process is called localization. It vant 2007)) because they are easy to build, only requiring an is simple on a grid, as real-valued x and y coordinates must Copyright c 2011, Association for the Advancement of Artificial only be divided by the grid resolution to find the integer grid Intelligence (www.aaai.org). All rights reserved. coordinates. 1Described in detail in a 2011 GDC AI Summit talk Most games feature dynamic worlds, with creatures or 2http://aigamedev.com/open/reviews/alienswarm-node-graph/ other objects modifying the underlying representation. Ide- 73 ally, a path planning representation can be easily changed to graph are not always convex. We will describe this approach block or unblock locations within the world. Again, this is in more detail in the next section, as our approach is based simple on a grid, as grid cells in the representation can be on this previous work. quickly localized and modified. In addition to creatures, the cost of moving in the world Sparse Grid Representation can also be modified by a number of influences. This might We begin by describing previous work done in building an include area effects, such as a spell being cast in a role- abstract representation for Dragon Age: Origins (DAO) and playing game, or lines of fire which should be avoided in then show how it must be extended to introduce the prop- a first-person shooter. Locations with such modifications are erties we desire in our modified representation. There are still passable, but are more expensive to pass than the regu- many variations on the design choices described here which lar terrain. Thus, routes without such effects applied would could be changed to meet specific game constraints. be preferred. If planning occurs over multiple levels of ab- Overall, the world is divided into two levels of granular- straction, such costs should be taken account in all levels of ity. The underlying grid is a fine-grained representation suit- abstraction, otherwise high-level planning will not properly able for local movement planning, and the representation of take into account the costs of crossing low-level terrain. Fi- small obstacles. From this grid, a high-level graph is built nally, any representation must be amenable to fast planning which is suitable for longer range planning. The high-level and re-planning. graph is built from connected regions in the underlying grid. There are three dominant representations used in the in- Even higher levels of abstraction can be used; this paper fo- dustry (Tozour 2002b). These include: cuses on a single level of abstraction, as additional levels of • Grids, which are covered in detail in this paper. Local- abstraction can be built with either the same principles or ization and modifying grids is simple, but some sort of using other techniques (Sturtevant and Geisberger 2010). abstraction mechanism is usually needed to speed path planning in grids. Paths resulting from planning in grids 0 1 0 1 usually need an extra smoothing pass. a a a a • Waypoint graphs, which are a graph representation of the world. Modifying waypoint graphs is relatively straight- forward, but there isn’t a tight coupling between the graph b b b b and each individual point in the world, which can make reasoning about terrain and the relationship to the way- a b c b a b c b point graph more difficult. Agents on waypoint graphs usually stay on the graph and its edges, resulting in lower a a 2 3 2 3 quality movement. • Navigation meshes, or a nav mesh for short, which can be Figure 1: The abstraction used in Dragon Age: Origins. represented by triangles (Demyen and Buro 2006) or by polygons (Tozour 2002a). Meshes implicitly form graphs, but each point in the graph represents a distinct area of terrain in the mesh. Localization on meshes can be made Dividing the World into Sectors and Regions efficient with an underlying grid (Demyen 2006). Meshes The low-level map representation in DAO is a grid, but plan- can be modified at runtime, but the process can be difficult ning full paths on the grid was too expensive, so a high-level to implement. Paths through meshes are smoothed using representation was built by dividing the world up into sec- the funnel algorithm. tors and regions. This is shown in the left portion of Figure 1, Nav meshes and waypoint graphs are high-level terrain which is taken from (Sturtevant 2007). This map is divided representations that greatly reduce planning costs. But, as into four large squares, or sectors, which overlay the map. a result, they may not be able to easily account for small The corner of each sector is labeled with an index. The sec- areas of terrain with higher cost, such as a trap that has been tors are then sub-divided into regions, where all points in discovered and should be avoided. Modifying nav meshes a region are reachable from each other without leaving the can also be difficult as geometric algorithms that process and sector. Dark areas of the map are uncrossable walls, so sec- reason about meshes do not always handle special cases like tor 2 has three regions, while the remaining sectors have two parallel lines or congruent points easily3.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    6 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us