Add option to limit max number of navmesh tiles

pull/2225/head
elsid 6 years ago
parent ff47df4f2c
commit f2e47d640d
No known key found for this signature in database
GPG Key ID: B845CB9FEE18AB40

@ -61,6 +61,7 @@ namespace
mSettings.mMaxSmoothPathSize = 1024;
mSettings.mTrianglesPerChunk = 256;
mSettings.mMaxPolys = 4096;
mSettings.mMaxTilesNumber = 512;
mNavigator.reset(new NavigatorImpl(mSettings));
}
};

@ -628,7 +628,7 @@ namespace DetourNavigator
return removeTile();
}
if (!shouldAddTile(changedTile, playerTile, params.maxTiles))
if (!shouldAddTile(changedTile, playerTile, std::min(settings.mMaxTilesNumber, params.maxTiles)))
{
log("ignore add tile: too far from player");
return removeTile();

@ -157,7 +157,7 @@ namespace DetourNavigator
if (changedTiles->second.empty())
mChangedTiles.erase(changedTiles);
}
const auto maxTiles = navMesh.getParams()->maxTiles;
const auto maxTiles = std::min(mSettings.mMaxTilesNumber, navMesh.getParams()->maxTiles);
mRecastMeshManager.forEachTilePosition([&] (const TilePosition& tile)
{
if (tilesToPost.count(tile))

@ -24,6 +24,7 @@ namespace DetourNavigator
navigatorSettings.mMaxEdgeLen = ::Settings::Manager::getInt("max edge len", "Navigator");
navigatorSettings.mMaxNavMeshQueryNodes = ::Settings::Manager::getInt("max nav mesh query nodes", "Navigator");
navigatorSettings.mMaxPolys = ::Settings::Manager::getInt("max polygons per tile", "Navigator");
navigatorSettings.mMaxTilesNumber = ::Settings::Manager::getInt("max tiles number", "Navigator");
navigatorSettings.mMaxVertsPerPoly = ::Settings::Manager::getInt("max verts per poly", "Navigator");
navigatorSettings.mRegionMergeSize = ::Settings::Manager::getInt("region merge size", "Navigator");
navigatorSettings.mRegionMinSize = ::Settings::Manager::getInt("region min size", "Navigator");

@ -26,6 +26,7 @@ namespace DetourNavigator
int mMaxEdgeLen = 0;
int mMaxNavMeshQueryNodes = 0;
int mMaxPolys = 0;
int mMaxTilesNumber = 0;
int mMaxVertsPerPoly = 0;
int mRegionMergeSize = 0;
int mRegionMinSize = 0;

@ -24,6 +24,24 @@ Moving across external world, entering/exiting location produce nav mesh update.
NPC and creatures may not be able to find path before nav mesh is built around them.
Try to disable this if you want to have old fashioned AI which doesn't know where to go when you stand behind that stone and casting a firebolt.
max tiles number
----------------
:Type: integer
:Range: >= 0
:Default: 512
Number of tiles at nav mesh.
Nav mesh covers circle area around player.
This option allows to set an explicit limit for nav mesh size, how many tiles should fit into circle.
If actor is inside this area it able to find path over nav mesh.
Increasing this value may decrease performance.
.. note::
Don't expect infinite nav mesh size increasing.
This condition is always true: ``max tiles number * max polygons per tile <= 4194304``.
It's a limitation of `Recastnavigation <https://github.com/recastnavigation/recastnavigation>`_ library.
Advanced settings
*****************
@ -322,6 +340,12 @@ Maximum number of polygons per nav mesh tile. Maximum number of nav mesh tiles d
this value. 22 bits is a limit to store both tile identifier and polygon identifier (tiles = 2^(22 - log2(polygons))).
See `recastnavigation <https://github.com/recastnavigation/recastnavigation>`_ for more details.
.. Warning::
Lower value may lead to ignored world geometry on nav mesh.
Greater value will reduce number of nav mesh tiles.
This condition is always true: ``max tiles number * max polygons per tile <= 4194304``.
It's a limitation of `Recastnavigation <https://github.com/recastnavigation/recastnavigation>`_ library.
max verts per poly
------------------

@ -670,6 +670,9 @@ enable nav mesh render = false
# Render agents paths (true, false)
enable agents paths render = false
# Max number of navmesh tiles (value >= 0)
max tiles number = 512
[Shadows]
# Enable or disable shadows. Bear in mind that this will force OpenMW to use shaders as if "[Shaders]/force shaders" was set to true.

Loading…
Cancel
Save