Classic Battlefield Modding Wikia
Advertisement

Many have asked if the Navmesh can be generated from the AIpathfinding files. To try to answer that question, I am going to try to analyze the AIpathfinding files. My research is based on general info on AI development that I found on the internet. I have not found anything from DICE on the AIpathfinding files.

To start off with the Aipathfinding files consist of infantry and vehicle qtr (quadtree) and cls (clusters). In AI game engines there two basic areas used for for bots to be able to get around a map: wayfinding and pathfinding.

First, let's look at what Quadtrees and Clusters mean:

Quadtrees

To reduce the amount of squares to represent a world, a quadtree is used, which is a different data structure to describe the map. Compared to a regular grid a quadtree has no uniform sized cells. It subdivides the whole map into four equally sized regions. If one of these new regions contains an obstacle it is subdivided into four other regions as well. A region is recursively subdivided until a region does not contain any obstacle or reaches a certain minimum size. Quadtrees allow to represent a large clear area with one single cell. Instead of the regular grid it describes a world efficiently but at the cost of quality. Paths generated by quadtrees are suboptimal because they are constrained to use the centers of the cells. Quadtrees represent where the bots can go. These are the pathfinding files.

Quadtree.gif

Clusters

Clusters are groups of nodes or waypoints and how they are interconnected. This how the AI game engine determines the routes the paths between the different areas of the map. This converted to a database where the routes are given different weights to help the game engine determine how to move the bots around the map. Clusters represent the routes. These are the wayfinding files.

Clusters.png


infantry.qti

The infantry.qti appears to be in binary format and can not be easily read. There is a text file version in the GTSdata\output folder that the binary version is based one. I will be looking into the format of the text file version. The content is broken down as follows:

- Header info which looks as follows:

1

-------------------/// QuadTree: 1/0 ---------------

7554 9631

-122.750000/-155.969650

72.502518/63.418903

I am not sure what the "1" represents. 7554 is the number of faces in the navmesh, while 9631 is the number of vertices. The 2d coordinates may represent starting points for each team, but only in a 2d manner?

- Vertice info:

-36.594223/28.364172/-78.468002

-67.183800/21.437128/-75.162895

-14.231739/23.201288/-76.484154

-39.349243/21.437128/-61.092262

-12.769679/23.191299/-64.541351

These coordinates are formatted similar to vertices in the navmesh obj file. However, they are similar but don't match up exactly. They appear to be slightly offset.

- Face info:

5519 44 2886

0 2932 5322

4610 2978 450

2749 2748 3469

These are formatted the same way the face info is in the navmesh obj file. Again, they are similar, but don't match up exactly.

- Material info:

GROUND

WATER

GROUND

GROUND

GROUND

GROUND

GROUND

GROUND

GROUND

GROUND

DEEPWATER

This are the same way the the materials are defined for the faces in the navmesh obj file. The difference is that, while the navmesh obj files group the types together, the different materials are listed separately and multiple times.

- Second list of face info:

7876 6444 -1

8097 5773 1339

-1 2424 3503

1641 7264 9000

5057 3672 4530

the only thing that makes sense is that each face info line corresponds to a material type in the list above.

The info is available to create a navmesh file, but it does appears that it would be slightly different from the original.



infantry.cls

This file lists the number of clusters and each cluster has the number of nodes in each, with each node number listed by a value. We have the code to follow on how these are created, but I have not tried to do that yet. I do not see this file as being useful to try recover a navmesh as there is no coordinate data.

File example:

-=| QuadTree: 0001 |=-

Number of clusters: 287

-=| Cluster: 0000 |=-

[Elements: 54]

{

6637

3891

2976

6539

What is tells us is that the Quadtree contains 287 clusters, with number 0 having 54 elements (which I think are the nodes).

Advertisement