Navmesh Editing Quick Overview

Navmesh Editing Quick Overview

by mschoeldgen
 Here's my successful way of creating the first navmeshes: (admins : take what you like from it and put it into the official tutorial

I assume you have a valid /working map and want to add bot support. I won't go into the mapping process, there are tutorials out there with much better info about it.

Using the AI tools provided with the new editor from Jan, 4th :

You need to have the python environment installed. This link contains the installer for Python on windows:

http://www.python.org/ftp/python/2.4.2/pyt...ython-2.4.2.msi

Launch the editor and load the SinglePlayerEditor part of it by using the ADD-in manager and checking the 'loaded' box. Load your map.

Make sure you have a valid Combat Area, this is needed else navmeshes will fail. Combat areas are drawn in the level editor (big 'C' icon) by rightclicking in the map , add a 'Controlpoint' and continue counterclockwise until you close the area. Check the 'usedByPathFinding' box in the combat area tweaker window.Save and change to SinglePlayerEditor

Add StrategicAreas at least for your ControlPoints. The tool allows automated generating, use it for now. Select AI rendering from the 'Render' menu and check if the areas looks right. Add some waypoints between the CP's (for infantry and vehicles) and make the strategic areas neighbours . All this is done by rightclicking in the map window.

To change the first argument for waypoints , select the strategic area by clicking on the SA's border.
Save your map. Quit the editor.

Copy the AI folder from an existing map and put it into your map folder.

Change into the /NavMesh folder , its in the BF2.EXE directory.
Edit the 'GenerateNavmeshLocal.py' file for your mod , its a few lines below the start of file.

1. Copy 'ExportGTS.con' and 'saveQuadNoP4.con' from the /NavMesh folder to the BF2.EXE directory.
2. Make sure your map contains an 'overgrowth' folder with the 'OvergrowthCollision.con' file. If you don't use overgrowth, put an empty file there.
3. Run 'CreateNavmesh.bat' from the /navmesh folder and fill in mod- and levelname. Note: If this process crashes, a likely cause is a Spawnpoint with the 'setScatterSpawnPositions' property enabled. Disable this at least while navmeshing.
4. This process will take a while. When finished, import the infantry.obj and vehicle.obj from the /navmesh/work/<MYLEVEL>/GTSData/output folder and import them in 3DS (as WaveFront object)
5. Delete isolated polies and vertices from them and export them as WaveFront (.obj) again into the /work/<MYLEVEL>navmesh/output folder.
6. Run the 'FixNavMesh.bat' , this will place the necessary navmeshes files into your levels AIPathfinding folder. Do a test drive with bots.

If something goes wrong, remember the logfiles are your friend.

The BF2editor writes to /<BF2.EXE DIR>/bf2editor/logs/

As a general rule, the /NavMesh/work/<LEVEL>/GTSData/debug/islands/infantry and /vehicle should contain the number of islands. If there are more than 1 , the navmesh needs editing.

To edit the navmesh, you need to import it into 3DS.
Here are the settings for the Wavefront (.obj) importer for importing navmeshes into 3DS
And a big thanks to clivewil for his restless efforts to find them out

single, Rotate model, Texture coordinates, Normals, Unify, Obj smooth groups

## Set Vertex scale to 1.0
Settings for export from Max:
Group by 'Object' and Select 'Polygons' for faces
Set Vertex scale to 1.0, #Digits: 8

Check these boxes:
## Use materials, Create material library, Rotate model, Texture coordinates, Normals, Smooth groups
Settings for MTL export from Max:
Select 'Scene materials' and #Digits:8