Navigation Meshes

From Unvanquished
Jump to: navigation, search

The Daemon engine supports automatic navigation mesh generation from bsp map files. This navigation mesh (or "navmesh" for short) is used by the bots to navigate throughout the world.

Generating a Navigation Mesh

The -nav parameter to daemonmap will generate a navigation mesh from a bsp file. Use it like so:

Windows

daemonmap.exe -game unv -nav mapname.bsp

Linux

./daemonmap -game unv -nav mapname.bsp

Optional Parameters

The navigation mesh generation process is conservative by default. This means some areas (particularly, small ledges) that should be walkable may instead create a break in the navmesh which bots interpret as "I am unable to go past there." The following optional parameters give the map maker some control over navmesh generation to help with this.

  • -cellheight

    A lower cellheight will increase mesh generation accuracy at the cost of generation time and mesh size.

    If there are gaps in the navigation mesh even though a player can easily just walk to get through, you can decrease the value to help.

  • -median

    Applies a median filter to the walkable areas of the mesh to help contain any "noise."

    See this article for more information.

  • -optimistic

    Attempts to compensate for cellsize inaccuracy by increasing the stepheight navigation mesh generation parameter based on the current samplesize. It is recommended to be used with a lower than default cellsize to help avoid over optimistic assumptions (i.e., saying some areas are walkable that really aren't). Useful for fixing breaks in the mesh caused by some small ledges.

    This produces bad results depending on how big your cellsize parameter is, but generating the mesh in this way will be faster than simply decreasing the cellheight.

Using a Navigation Mesh

Navigation mesh files go in the maps/ directory either in the folder specified by the fs_game cvar, or in the maps folder inside a map's .pk3 file.

Testing the Mesh

  • You may test your map locally by entering \devmap mapName as you would to test any map at any time. Note, of course, that this will disconnect you from whatever game you may currently be in.
  • To enable drawing the navigation mesh, use navedit enable navmeshname where "navmeshname" is one of:
    • human_naked
    • human_bsuit
    • builder
    • builder-upg
    • level0
    • level1
    • level1upg
    • level2
    • level2upg
    • level3
    • level3upg
    • level4

Where level4 is tyrant, level3 is dragoon, level2 is marauder, level1 is mantis, and level0 is dretch. The two builder navmeshes are not used at this time.

  • Add bots with the bot command and spectate the game.

Editing the Navigation Mesh

Navmesh editing is still a work in progress, but it can be useful for fixing unnavigable ledges.

Unfortunately, automatic navigation mesh generation that fully supports all of the map features and player abilities in Unvanquished is incredibly difficult. Automatic generation will usually produce a very satisfactory base mesh, but some areas may need further tweaking.

To edit the navmesh, you must select the one you wish to edit using the navedit command.

To add connections use the addcon command.

A oneway connection will only allow bots to move from the start of the connection to the end of the connection, but not from the end to the start. A twoway connection will allow bots to move in either direction along the connection. The radius of the connection is how far away the center of the bot has to be from the middle to take the connection.

Modifications to the navmesh are made in real time, so any bots that have spawned will react accordingly.

When you are done editing a specific navmesh, you can use navedit save to save your work.