Navmesh Tutorial – Arma Reforger

From Bohemia Interactive Community
Revision as of 11:01, 27 June 2022 by Lou Montana (talk | contribs) (Page creation)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The goal of this document is to help understanding the navmesh modding flow. There are two main areas which will be described.


Navmesh Creation

This section is about creating a navmesh for an editable terrain (modded terrain or sub-scene of an existing terrain).

  1. In the default layer of the terrain, add SCR_AIWorld.et prefab from Resource Browser which contains the NavmeshWorldComponent component
    the SCR_AIWorld.et prefab holds two NavmeshWorldComponent, the second one being disabled.
  2. Let's now create a new navmesh to be set in the NavmeshFilesConfig entry:
    • Open Navmesh Tool in the toolbar armareforger worldeditor-navmeshtool-icon.png and select its Navmesh Tool tab
    • Set Navmesh to Soldiers the same as in the NavmeshWorldComponent's Navmesh Project property
    • Click Connect to open the Connect window and select Soldiers again - click OK to connect to the local navmesh server
    • Click Generate to open the Recast params options window
      • Keep everything to default values and press OK to display then the Generator area options window
      • Keep everything to default again (to cover the whole area) and press OK
    • The navmesh generation process has been started. This operation may take some time, the progress being displayed at the bottom of the Navmesh Tool tab
  3. Click the Save button to save the resulting navmesh to storage (in a .nmn file).

The navmesh file can now be added to the Navmesh Settings/Navmesh File property in SCR_AIWorld's NavmeshWorldComponent

Select Soldiers in Navmesh Project combobox and in Navmesh Tool/Navmesh to display the created navmesh.


Navmesh Modification

This section is about editing an existing navmesh for an editable terrain (modded terrain or sub-scene of an existing terrain).

Place e.g Office_E_01.et - note how the navmesh is not impacted and does not adapt around/with the building.

Multiple solutions are available, described below.

Full Regeneration

A full navmesh regeneration has multiple problems:

  • the generation time can be quite big
  • the file size can grow quickly as well.

For instance, the CTI_Campaign_Eden navmesh that is used on Everon for AI soldiers is over 1GB of size at the time of writing. As such, generating a whole navmesh for a minor modification the mod that changes one navmesh tile of bigger maps is quite long (depending on the system the operation can take over an hour) and expensive in storage.

There is a better option for that.

Partial Regeneration

This option allows to only generate tiles that changed and "patch" the full navmesh.

Current Tile

The Rebuild Tile button regenerates the tile over which the camera is; to use it, move the camera anywhere over the wanted tile, then press the button to regenerate that specific tile.

This is useful when only a small area has been modified (e.g a couple of buildings or an outpost placed).

Be wary that a wide composition (e.g outpost) can cover multiple tiles, therefore be sure to check the resulting output in order to avoid partially generated navmeshes.

Tile Range

The Tile Range regeneration option allows to regenerate a wanted rectangle of tiles, defined by its South-West/"bottom-left" and North-East/"top-right" points.

In order to do so, X and Y tiles indices can be used but these are not easily available - hopefully, their position value can also be used. For that, it is important to keep track of min and max (South-West/"bottom-left" / North-East/"top-right") positions of the area to be regenerated; these values can be obtained using the World Editor camera's position found at the bottom-left of World Editor.

  • Open the Navmesh Tool
  • Select Soldiers navmesh
  • Connect to the local server
  • Click Generate
  • Click OK in the Recast params window
  • Reaching the Generator area options window, click on the Position tab to input the area of generation - enter the min and max values from earlier in the Positions tab (From = min, To = max), then click OK.

The Tool then only generates the defined area and updates the current memory navmesh, and the map widget updates accordingly.

In order to save the updated navmesh, click Save Generated and save where needed - overwriting the old navmesh being an option.

If the generated area generated more tiles than we need, we can mark only tiles that are actually needed to be saved by marking them on the map by leftclick drag, right clicking and clicking mark tiles then we could use SaveMarked and save only those that we marked.


Navmesh Modding

🚧
TODO: this must be updated.