You get a bonus - 1 coin for daily activity. Now you have 1 coin

Navigation Mesh

Lecture



A navigation mesh, or navmesh (navigation mesh), is an abstract data structure used in artificial intelligence programs to help agents find paths through complex spaces. This approach has been known at least since the mid-1980s in robotics, where it was called a "meadow map," and was popularized in game AI in the year 2000.

Description

A navigation mesh is a collection of two-dimensional convex polygons (a polygonal mesh) that define which areas of the environment agents can traverse. In other words, a character in a game can freely walk across these areas without being obstructed by a tree, a bench, or other obstacles that are part of the environment. Adjacent polygons are connected to one another in a graph.

Determining contours within one of these polygons can be done trivially in a straight line, since the polygon is convex and traversable.

Representing traversable areas in a 2D-like form simplifies calculations that would otherwise have to be done in a "true" 3D environment; however, unlike a 2D grid, it allows for traversable areas that overlap above and below at different heights. Polygons of different sizes and shapes in navigation meshes can represent arbitrary environments with greater accuracy than regular grids.

A navigation mesh in a game (often called a navigation mesh or navmesh) is a simplified geometric structure that indicates where characters can move. It looks like a network of polygons (usually triangles or quadrilaterals) stretched across the surface of the levels. Here is how it can be represented:

  • Flat or contoured polygons covering traversable areas;

  • Bright boundaries separating zones where movement is possible from obstacles;

  • Sometimes — arrows or directions of movement, if the navmesh uses flow field data;

  • Gaps or "holes" in places where one cannot walk (for example, water, walls, cliffs).

Visually this resembles a simplified map of the level, ruled into pieces, where each piece is a potential point for NPC movement. In editors or debug modes, it is usually displayed as a semi-transparent mesh overlaid on the scene.

Advantages of a navigation mesh compared to navigation points

Compared to navigation points, navigation meshes have the following advantages:

  • The ability to find the real shortest path (not a graph)
  • Reduced computation time and memory usage in open environments
  • Simpler management of various virtual agent templates
  • Easier handling of dynamic obstacles

Creation

Navigation meshes can be created manually, automatically, or through a certain combination of both. In video games, a level designer can manually define the navmesh polygons in a level editor.

It is generally accepted that the environment represented in a navmesh is static — it does not change over time — and, consequently, a navmesh can be created offline and left unchanged. However, some research has been conducted on online updating of navigation meshes for dynamic environments.

How NavMesh Works

  1. A navigation map is created based on the level geometry (manually or automatically).

  2. Navigation agents (NPCs, enemies, allies) use the NavMesh for pathfinding.

  3. In conjunction with an algorithm (most often A*), the agent calculates the shortest route to the target.

Navigation Mesh

History

In robotics, the use of linked convex polygons in this way was called "meadow mapping," coined in a 1986 technical report by Ronald C. Arkin.

Navigation meshes in video game AI are generally attributed to Greg Snook's 2000 article "Simplified 3D Movement and Pathfinding Using Navigation Meshes" in "Game Programming Gems." The "Area Awareness System" was used for bots in Quake III Arena.

Navigation meshes in practice

Implementing a navigation mesh actually involves three algorithms:

  1. Graph navigation algorithm
  2. String-pulling algorithm
  3. And a steering/path-smoothing algorithm

A* is most often used to find the optimal path

Areas of application

Game genre NavMesh application
3D Action/RPG Enemies search for a path to the player
2D platformers Jumping across platforms and avoiding cliffs
Strategy games Groups of units navigate around buildings and objects
Crowd simulators People avoid colliding with one another

See also

  • [[b13196]]
  • [[b13197]]
  • [[b13198]]
  • [[b4134]]
  • [[b4399]]
  • A* (A-Star) A shortest-path search algorithm on a grid or graph
  • Dijkstra's Algorithm A more universal pathfinding algorithm (slower than A*)
  • Graph Representation of a NavMesh as a set of nodes and links
  • Waypoint Graph A graph of waypoints, an alternative to NavMesh
  • Flood Fill / BFS Simple methods for estimating area accessibility

Comments

To leave a comment

If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Lectures and tutorial on "Algorithms"

Terms: Algorithms