This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
gamedev:navigation [2011/07/22 01:34] – dragonlord | gamedev:navigation [2012/12/01 17:45] – dragonlord | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | <WRAP youarehere> | ||
+ | [[: | ||
+ | </ | ||
+ | |||
====== Navigation System ====== | ====== Navigation System ====== | ||
<WRAP box 250px right :en>{{ : | <WRAP box 250px right :en>{{ : | ||
Line 13: | Line 17: | ||
The **AI Module** provides support to solve the navigation problems using this system. | The **AI Module** provides support to solve the navigation problems using this system. | ||
- | ===== Navigation Spaces ===== | + | ====== Navigation Spaces |
Navigation problems alway take place in one or more navigation spaces depending on the need of the game. There exist different kinds of navigation spaces that can be used each of them having different properties. These are **navigation grids**, **navigation meshes** and **navigation volumes**. The **Navigation Space** class is an all-round class able to describe all supported navigation spaces in one place. The type of space described with a Navigation Space object is set using the **type** parameter. If the navigation does not work properly make sure each navigation space has the matching **type** parameter set. | Navigation problems alway take place in one or more navigation spaces depending on the need of the game. There exist different kinds of navigation spaces that can be used each of them having different properties. These are **navigation grids**, **navigation meshes** and **navigation volumes**. The **Navigation Space** class is an all-round class able to describe all supported navigation spaces in one place. The type of space described with a Navigation Space object is set using the **type** parameter. If the navigation does not work properly make sure each navigation space has the matching **type** parameter set. | ||
Line 22: | Line 26: | ||
Navigation spaces are considered to be static in respect to their content. It is allowed to change the layout of a navigation space at runtime but the performance could suffer. The position and orientation of a navigation space though is allowed to change. This allows to simulate dynamic navigation spaces like for example a connected set of moving platforms. There the layout of the platforms itself does not alter but the location of the entire group of platforms does. Due to the static nature the elements in a navigation space are defined as continuous arrays. Hence you do not add elements to the navigation space but you set first the total number of elements you want to use and then you set each element in turn. If you have to change the layout of a navigation space you have to call the **Notify Layout Changed** to tell the AI Module that you finished changing the layout of the navigation space. | Navigation spaces are considered to be static in respect to their content. It is allowed to change the layout of a navigation space at runtime but the performance could suffer. The position and orientation of a navigation space though is allowed to change. This allows to simulate dynamic navigation spaces like for example a connected set of moving platforms. There the layout of the platforms itself does not alter but the location of the entire group of platforms does. Due to the static nature the elements in a navigation space are defined as continuous arrays. Hence you do not add elements to the navigation space but you set first the total number of elements you want to use and then you set each element in turn. If you have to change the layout of a navigation space you have to call the **Notify Layout Changed** to tell the AI Module that you finished changing the layout of the navigation space. | ||
- | ==== Navigation Grid ==== | + | ===== Navigation Grid ===== |
- | <WRAP box 250px right :en>{{ : | + | <WRAP box 250px right :en>{{ : |
Navigation grids are useful for navigation problems where an exact and smooth path is not required. This is usually used for coarse grained navigation typically not directly linked to a visible world or checker board type navigation. In this navigation space vertices are the nodes and edges are the connections between nodes. | Navigation grids are useful for navigation problems where an exact and smooth path is not required. This is usually used for coarse grained navigation typically not directly linked to a visible world or checker board type navigation. In this navigation space vertices are the nodes and edges are the connections between nodes. | ||
Line 29: | Line 33: | ||
<WRAP clear></ | <WRAP clear></ | ||
- | ==== Navigation Mesh ==== | + | ===== Navigation Mesh ===== |
- | <WRAP box 250px right :en>{{ : | + | <WRAP box 250px right :en>{{ : |
Navigation meshes are useful for all kinds of navigation problems in detailed scene geometry where a smooth path around the world is desired. This is the typical space used for AI navigation of visible game actors. Most of the time you want to use this type of navigation space. In this navigation space faces are the nodes and edges the connections between them. In contrary to the navigation grid the connection is located at the edges of the face hence you do not travel along them but simply cross them. | Navigation meshes are useful for all kinds of navigation problems in detailed scene geometry where a smooth path around the world is desired. This is the typical space used for AI navigation of visible game actors. Most of the time you want to use this type of navigation space. In this navigation space faces are the nodes and edges the connections between them. In contrary to the navigation grid the connection is located at the edges of the face hence you do not travel along them but simply cross them. | ||
Line 36: | Line 40: | ||
<WRAP clear></ | <WRAP clear></ | ||
- | ==== Navigation Volume ==== | + | ===== Navigation Volume |
Navigation volumes are useful for all navigation problems that navigation meshes can not accurately represent anymore. These are typically situations where the movement of actors is not limited to moving on the ground with jumping or hovering but where they can roam around three dimensions freely. A good example for this is Descent where the AI roams around in 0-gravity inside a large cavern complex. Here navigation volumes provide the same smooth path finding around the game world as does the navigation mesh just in three dimensions. In this navigation space rooms are the nodes and faces are the connections between them. Here too the rooms are directly connected to each other using faces similar to navigation meshes. | Navigation volumes are useful for all navigation problems that navigation meshes can not accurately represent anymore. These are typically situations where the movement of actors is not limited to moving on the ground with jumping or hovering but where they can roam around three dimensions freely. A good example for this is Descent where the AI roams around in 0-gravity inside a large cavern complex. Here navigation volumes provide the same smooth path finding around the game world as does the navigation mesh just in three dimensions. In this navigation space rooms are the nodes and faces are the connections between them. Here too the rooms are directly connected to each other using faces similar to navigation meshes. | ||
For a valid navigation volume **vertices**, | For a valid navigation volume **vertices**, | ||
- | ==== Parameter Summary ==== | + | ===== Parameter Summary |
- | Navigation Space | + | <WRAP column 45%> |
+ | <WRAP boxheader> | ||
+ | <WRAP boxcontent> | ||
^Name^Description^Value^ | ^Name^Description^Value^ | ||
|Layer|Layer this navigation space affects|Integer| | |Layer|Layer this navigation space affects|Integer| | ||
|Type|Space type|Grid, Mesh or Volume| | |Type|Space type|Grid, Mesh or Volume| | ||
+ | </ | ||
- | Vertex | + | <WRAP boxheader> |
+ | <WRAP boxcontent> | ||
^Name^Description^Value^Space Type^ | ^Name^Description^Value^Space Type^ | ||
|Position|Position of the vertex relative to the parent navigation space|3-Component Vector|Grid, | |Position|Position of the vertex relative to the parent navigation space|3-Component Vector|Grid, | ||
+ | </ | ||
- | Edge | + | <WRAP boxheader> |
+ | <WRAP boxcontent> | ||
^Name^Description^Value^Space Type^ | ^Name^Description^Value^Space Type^ | ||
|Vertex 1|Index of the first vertex of this edge|Unsigned Short|Grid| | |Vertex 1|Index of the first vertex of this edge|Unsigned Short|Grid| | ||
Line 57: | Line 67: | ||
|Type Number 1|Type to use to cross the edge from the first to the second vertex|Unsigned Short|Grid| | |Type Number 1|Type to use to cross the edge from the first to the second vertex|Unsigned Short|Grid| | ||
|Type Number 2|Type to use to cross the edge from the second to the first vertex|Unsigned Short|Grid| | |Type Number 2|Type to use to cross the edge from the second to the first vertex|Unsigned Short|Grid| | ||
+ | </ | ||
- | Corner | + | <WRAP boxheader> |
+ | <WRAP boxcontent> | ||
^Name^Description^Value^Space Type^ | ^Name^Description^Value^Space Type^ | ||
|Vertex|Index of the vertex for this corner|Unsigned Short|Mesh, Volume| | |Vertex|Index of the vertex for this corner|Unsigned Short|Mesh, Volume| | ||
|Type Number|Type to use crossing this edge|Unsigned Short|Mesh| | |Type Number|Type to use crossing this edge|Unsigned Short|Mesh| | ||
+ | </ | ||
+ | </ | ||
- | Face | + | <WRAP column 45%> |
+ | <WRAP boxheader> | ||
+ | <WRAP boxcontent> | ||
^Name^Description^Value^Space Type^ | ^Name^Description^Value^Space Type^ | ||
|Corner Count|Number of corners in this face|Unsigned Short|Mesh, Volume| | |Corner Count|Number of corners in this face|Unsigned Short|Mesh, Volume| | ||
|Type Number|Type to use moving through this face|Unsigned Short|Mesh| | |Type Number|Type to use moving through this face|Unsigned Short|Mesh| | ||
+ | </ | ||
- | Wall | + | <WRAP boxheader> |
+ | <WRAP boxcontent> | ||
^Name^Description^Value^Space Type^ | ^Name^Description^Value^Space Type^ | ||
|Face|Index of the face for this wall|Unsigned Short|Volume| | |Face|Index of the face for this wall|Unsigned Short|Volume| | ||
|Type Number|Type to use crossing this face|Unsigned Short|Volume| | |Type Number|Type to use crossing this face|Unsigned Short|Volume| | ||
+ | </ | ||
- | Room | + | <WRAP boxheader> |
+ | <WRAP boxcontent> | ||
^Name^Description^Value^Space Type^ | ^Name^Description^Value^Space Type^ | ||
|Front Wall Count|Number of front facing walls in this room|Unsigned Short|Volume| | |Front Wall Count|Number of front facing walls in this room|Unsigned Short|Volume| | ||
|Back Wall Count|Number of back facing walls in this room|Unsigned Short|Volume| | |Back Wall Count|Number of back facing walls in this room|Unsigned Short|Volume| | ||
|Type Number|Type to use moving through this room|Unsigned Short|Volume| | |Type Number|Type to use moving through this room|Unsigned Short|Volume| | ||
+ | </ | ||
+ | </ | ||
+ | <WRAP clear></ | ||
===== Navigators ===== | ===== Navigators ===== | ||
- | <WRAP box 250px right :en>{{ : | + | <WRAP box 250px right :en>{{ : |
While the navigation spaces define the space in which navigation takes pace it is the navigators that determine which path to choose across such a space. Navigators are also also all-round class and can thus be used on all kinds of navigation spaces. To use a navigator you have to first set the **layer number** and the **space type**. The navigator is going to determine a path only using navigation spaces having the same layer and space type. If navigation does not work properly check first if these two parameters are set correctly. Once this is done you can set a **start position** and a **goal position**. Call then **update path**“ and the AI module calculates a path for you. The path is stored as a list of points (DVector) in world space. If no path is found the list of points is 0. Otherwise the list of points defines the path starting with the first path point to head towards. The list does not start with the **start position** but with the first path point. The last point in the list is the **goal position**. The list stays intact until the next time **update path** is called. | While the navigation spaces define the space in which navigation takes pace it is the navigators that determine which path to choose across such a space. Navigators are also also all-round class and can thus be used on all kinds of navigation spaces. To use a navigator you have to first set the **layer number** and the **space type**. The navigator is going to determine a path only using navigation spaces having the same layer and space type. If navigation does not work properly check first if these two parameters are set correctly. Once this is done you can set a **start position** and a **goal position**. Call then **update path**“ and the AI module calculates a path for you. The path is stored as a list of points (DVector) in world space. If no path is found the list of points is 0. Otherwise the list of points defines the path starting with the first path point to head towards. The list does not start with the **start position** but with the first path point. The last point in the list is the **goal position**. The list stays intact until the next time **update path** is called. | ||
Line 98: | Line 121: | ||
<WRAP clear></ | <WRAP clear></ | ||
- | === Example | + | **Example**\\ |
- | <WRAP box 250px right :en>{{ : | + | <WRAP box 250px right :en>{{ : |
An example for the use of cost functions is given in the images on the right. The first image shows a sample path through the world. In this case the path leads through the office of a coworker. This is indeed the shortest possible path if we assume doors are automatically opening not hampering your progress. Yet in reality this path is not a realistic one as strolling through an office like that is not considered to be polite. We need thus a way to penalize this route without preventing the path to end up in the office should this be our destination. For this costs functions can be used. In the example the "Type Numbers" | An example for the use of cost functions is given in the images on the right. The first image shows a sample path through the world. In this case the path leads through the office of a coworker. This is indeed the shortest possible path if we assume doors are automatically opening not hampering your progress. Yet in reality this path is not a realistic one as strolling through an office like that is not considered to be polite. We need thus a way to penalize this route without preventing the path to end up in the office should this be our destination. For this costs functions can be used. In the example the "Type Numbers" | ||
<WRAP clear></ | <WRAP clear></ | ||
- | <WRAP box 250px right :en>{{ : | + | <WRAP box 250px right :en>{{ : |
The first solution using doors requires us to create a " | The first solution using doors requires us to create a " | ||
Line 112: | Line 135: | ||
==== Parameter Summary ==== | ==== Parameter Summary ==== | ||
- | Navigator | + | <WRAP column 45%> |
+ | **Navigator** | ||
^Name^Description^Value^ | ^Name^Description^Value^ | ||
|Layer|Layer this navigator uses to find a path|Integer| | |Layer|Layer this navigator uses to find a path|Integer| | ||
Line 119: | Line 143: | ||
|Default Cost Per Meter|Cost Per Meter to use if no matching type is found|Float| | |Default Cost Per Meter|Cost Per Meter to use if no matching type is found|Float| | ||
|Blocking Cost|Path with costs larger than this value are considered unwalkable|Float| | |Blocking Cost|Path with costs larger than this value are considered unwalkable|Float| | ||
- | + | </ | |
- | Navigation Type | + | <WRAP column 45%> |
+ | **Navigation Type** | ||
^Name^Description^Value^ | ^Name^Description^Value^ | ||
|Type Number|Type number matching this cost function|Unsigned Short| | |Type Number|Type number matching this cost function|Unsigned Short| | ||
|Fix Cost|Fix cost to use|Float| | |Fix Cost|Fix cost to use|Float| | ||
|Cost Per Meter|Cost Per Meter to use|Float| | |Cost Per Meter|Cost Per Meter to use|Float| | ||
+ | </ | ||
+ | <WRAP clear></ | ||
===== Steering and Collision Avoidance ===== | ===== Steering and Collision Avoidance ===== | ||
The navigation system provides you only with the path to take along the world. After this task navigation typically consists also of the process of **steering** and **collision avoidance**. These tasks though depend heavily on the game in question and are thus not provided by the AI Module. This is though not a problem since the Physics Module provides you already with collision detection to implement your steering and collision avoidance of choice. | The navigation system provides you only with the path to take along the world. After this task navigation typically consists also of the process of **steering** and **collision avoidance**. These tasks though depend heavily on the game in question and are thus not provided by the AI Module. This is though not a problem since the Physics Module provides you already with collision detection to implement your steering and collision avoidance of choice. | ||
- | |||
- | ====== Links ====== | ||
- | * [[gamedev: | ||
- | * [[: |