Battlefield 2 invades the high-tech frontlines of modern warfare. The game brings the intensity and excitement of Battlefield 1942 into the modern era with enhanced team play and the latest, most technologically advanced vehicles and weapons systems available to man.

Post tutorial Report RSS How to use AdvNavTool

AdvNavTool is a tool is based on DICE Navmesh.exe source code and Recast project for generating Navmesh for BF2 maps. This tutorial would tell you the outstanding advantages and usage of AdvNavTool.

Posted by on - Intermediate Mapping/Technical

Tool Download Link: Moddb.com


You should have a general understanding of the workflow of BF2Editor and BF2 official Navmesh before reading this tutorial because i speak briefly about these parts.

If you cannot open AdvNavTool.exe, i write a AdvNavTool.bat for you to use. Open AdvNavTool.bat and then input map name( must be consistent with the map folder name). Now you would see a lot of bat files in "%BF2_game_root_directory%\Navmesh\work\%map_name%\.", see and modify their content according to the following instructions and run them in turn according to your needs.

  • General introduction:

AdvNavTool consists of three main programs, followed as AdvNavTool.exe, NavmeshBang.exe and RecastNav.exe.

AdvNavTool.exe is just a win32 GUI Window tool. It generate corresponding Bat files and run them in order to skip Python control and make Navmesh process visualization. (Attention! AdvNavTool.exe cannot work on win11 system, i test it on win10.)

NavmeshBang.exe is a win32 command line tool modified by me according to the NavMesh.exe source code left by DICE. The main change is to add two more variables to the Manifold function, namely OptimizeAngleVal (terrain simplification angle parameter) and ExportRealTerrain (whether to export real terrain). The main functions of this exe are to generate a terrain model(manifold.obj) that is closer with the actual terrain than original (Navmesh.exe) and generate the whole map scene model(Scene.obj) for following operation. The usage of NavmeshBang.exe is running by bat file as followed:

//"angle" is Optimize Angle Val, I recommend 4-10, and its default is 5.
//"terrain " is ExportRealTerrain, and its default is false.
NavMeshBang.exe -dir work\dalian\gtsdata -cmd manifold -angle 5 -terrain false
NavMeshBang.exe -dir work\dalian\gtsdata -cmd scene

RecastNav.exe is also a win32 command line tool modified by me according by recastCLI.js project of but0n in github which is based on Recast project of Mikko Mononen. The main function of this exe are to generate Tile Navmesh by Recast for map scene model(Scene.obj). (Attention! You cannot use Tile navmesh generated by Recast for BF2 map directly. You can take it as a reference to polish.) It is worth noting that the size of infantry tile is 256m and the size of vehicle tile is 512m. The usage of RecastNav.exe is running by bat file as followed:

//RecastNav use key value (MaxSlope, Radius, HeadClearance) of config.dat .
//"type" is chose of Partitoining Type, I just use 0 so we all use it.
RecastNav.exe -dir work\dalian\gtsdata -cmd infantry -type 0
RecastNav.exe -dir work\dalian\gtsdata -cmd vehicle -type 0

  • Detailed usage:
  1. Unzip, get the Navmesh folder and put it in the %BF2_game_root_directory%. If you want to use this tool, please make sure that your %BF2_game_root_directory% contains all files of BF2Editor (with single player mode support).

    Unzip
  2. Open the map with an editor, enter the single-player editing mode, and generate the GTSDate file of the map (you will see the GTSDate folder in the map folder).
  3. Create a folder with the same name as the map in the folder of "%BF2_game_root_directory%\Navmesh\work\.", and cut and copy the GTSDate folder into the newly created folder. That is, the current location of the GTSDate folder is in "%BF2_game_root_directory%\Navmesh\work\%map_name%\.".
  4. Run the %BF2_game_root_directory%\Navmesh\AdvNavTool.exe, select the map first, and click "load" to load map date. At this point, you will find that it will automatically load the navmesh parameters of Infantry and Vehicle.

    OriginalNav
  5. Adjust the parameters (OptimizeAngleVal refers to the angle parameter when simplifying the terrain, and it is recommended to be 4-10. The smaller the value, the closer the output terrain is to the real terrain, of course, the larger the model, the more time it takes for following operation maybe; and the larger the value, the greater the error between the output terrain and the real terrain. ExportRealTerrain refers to the option parameter of whether to output the real terrain. If you don't know how to tune it, don't modify.) Click "Start Manifold" to pop up the console and start the operation. (At this time, the AdvNavTool.exe is locked. After the console operation is completed, you can go to the next step.)
  6. Click "Start Stitch" to call up the console and start the operation. (Similarly, the AdvNavTool.exe is locked at this time.)
  7. Adjust the navmesh parameters of Infantry and Vehicle. Here I list the soldiers' height (1.8-1.9 suggested for the original bf2 map), the soldiers' maximum climbing angle (33-43 suggested for the original bf2 map), the radius of vehicles (2.5-4 suggested for the original bf2 map) and the maximum climbing angle of vehicles (27-37 suggested for the original bf2 map). As you adjusting, the parameter in GTSDate\Mesh\config.dat will be automatically rewritten.
  8. Click "Generate" of Infantry or Vehicle in order to generate their own navmesh (similarly, AdvNavTool.exe are locked at this time). Check and repair the obj model in 3d software.

The above is the traditional Navmesh generation process. Followed is the Recast Tile Navmesh process and let me remind you again that you can't use the Tile Navmesh directly. You can use they as a reference for polishing navmesh.

RecastNav

  1. The front is the same. If you have already done them(1,2,3 in picture), just Click "Start Scene" to attach terrain modle and staticmesh modles in order to get the whole map scene modle.
  2. Choose Partitoining Type, I just use default "Watershed" so i recommend you to use default. And then click "Recast Infantry " or "Recast Vehicle" to generate Tile Navmesh.

Last, click "%BF2_game_root_directory%\Navmesh\FixNavmesh.bat". Enter the mod's name and map's name, and the editor will be automatically called to convert the obj model. After it, package the map folder and test the map. If the map and the Bot run perfect, you can delete the folder "%BF2_game_root_directory%\Navmesh\work\%map_name%\.".


  • Output file:

In "%BF2_game_root_directory%\Navmesh\work\%map_name%\." folder, you can see the bat files which are generating by AdvNavTool.exe. In fact, exe calls these bat files .

And in "%BF2_game_root_directory%\Navmesh\work\%map_name%\GTSData\output\." folder, you maybe see followed Obj files:

Output

  1. recast folder stores tiles of Navmesh generated by Recast.
  2. ground.obj is the real terrain modle without optimization which is useful for comparing between the infantry/vehicle meshes and the real terrain.
  3. Infantry.obj is used for final navmesh of Infantry for BF2 map. You should polish it as best as you can.
  4. Infantry_RecastNav.obj is generated by Recast and you cannot use it as a final Infantry navmesh theoretically. You can use it as a reference for polishing final navmesh.
  5. manifold.obj is a terrain modle after optimization.
  6. preopt.obj is a whole map modle with merging all mesh into manifold (the modle is a entirety), which is prepared for generating Infantry/Vehicle navmesh by Navmesh.exe.
  7. Scene.obj is a whole map modle with attaching all mesh into manifold (the modle isn't a entirety), which is prepared for generating Infantry/Vehicle tile navmesh by RecastNav.exe.
  8. Vehicle.obj is used for final navmesh of Vehicle for BF2 map. You should polish it as best as you can.
  9. Vehicle_RecastNav.obj is generated by Recast and you cannot use it as a final Vehicle navmesh theoretically. You can use it as a reference for polishing final navmesh.
  • Ending:

In my eyes, the RecastNav is a failure because it cannot get a whole navmesh for BF2 map directly.

Thank mogul in the QQ group for his help in my programming. Thanks to all the players who play BF2 now.

-YaoBang.2024.01.14

Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: