Working with Navigation Meshes

Date Modified: February 21 2025

Navigation meshes are a data structure which encode information about a space in a 3D world. Typically, they’re used for helping bots navigate through that world. Essentially, these navigation meshes are graphs, where a navigable region of the map (a “tile” aka the nodes on the graph) is connected to others (the edges on the graph).

In CS2, a navigation mesh comes in the form of a .nav file. In our library, we provide the navigation mesh information for the most popular maps. If a map is missing, feel free to open up a feature request on Github issues. The map data is found in the Awpy data directory ($HOME/.awpy) after running awpy get navs and awpy get maps (needed below for plotting).

Basic Nav Mesh Functionality in Awpy

The Nav class contains two attributes - version and areas. Version states the version of the nav mesh file. Areas is a dictionary where the key is an integer (specifcally NavArea id) and the value is the NavArea object. All of the NavArea objects for a given map together describe the navigable surfaces for that map (i.e., the nav mesh). In most instances, you will use the Nav class to read from a .json file, which you can get using awpy get navs. You can also use the Nav class to parse a .nav file by doing Nav("path-to.nav").

[1]:
import awpy.data
import awpy.nav

path_to_nav_file = awpy.data.NAVS_DIR / "de_dust2.json"
dust_2_nav = awpy.nav.Nav.from_json(path=path_to_nav_file)
dust_2_nav
[1]:
Nav(version=35.1, areas=2248)