1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-09 21:42:13 +00:00
Commit Graph

152 Commits

Author SHA1 Message Date
elsid
a7da604332
Update next tile_id when there is a duplicate in navmeshdb
Disable writes on failure to update next tile_id to avoid further errors.
2024-02-07 11:28:34 +01:00
elsid
e6196c782d
Limit navmesh vertices coordinates values
Float values with more than 22 significant fraction bits may cause out of bounds
access in recastnavigation on triangles rasterization. Prevent passing such
values there.
2024-02-03 18:48:42 +01:00
elsid
69cf507db8
Fix navmesh update on player changing tile
In cases when objects are not present on the scene (e.g. generated exterior
cells) navmesh is not updated because area that suppose to be covered with it
was not updated. It was updated only during cell change. This is a regression
from d15e1dca84.

Set TileCachedRecastMeshManager range on NavMeshManager update to make sure it
always covers correct area around player.

Return a union of objects, heightfields and water ranges from
getLimitedObjectsRange intersected with range provided above.
2024-01-09 01:18:45 +01:00
elsid
94b085af9e
Add Navigator and Lua API function to find nearest position on navmesh 2023-11-18 23:54:37 +01:00
elsid
1322f7b75b
Deduplicate height field data definition 2023-11-18 22:38:00 +01:00
elsid
9c526b6639
Add Navigator test for zero distance path 2023-11-18 22:35:10 +01:00
elsid
e00eb50587
Remove stepping from findSmoothPath
This is not used anyway. There are features like smooth movement which remove
all redundant points.

Use single findStraightPath call instead of multiple.
2023-07-22 18:08:40 +02:00
elsid
e6e6b65ab3
Remove redundant manipulators 2023-06-10 13:14:52 +02:00
elsid
04d439485b
Log more info about navmesh shapes and jobs 2023-05-14 18:34:31 +02:00
elsid
28f7a89530
Reuse dtNavMeshQuery
To avoid redundant allocations.
2023-02-17 15:05:25 +01:00
florent.teppe
a4137e941c std::string_view can be used in map and unordered map
This avoids some unecessary dynamic allocations.
Also applies some review advice.
2023-01-21 19:19:26 +01:00
florent.teppe
150e2ba885 Revert "Use ESM::RefId for worldspace in detournavigator"
This reverts commit b4ab153418.

# Conflicts:
#	apps/navmeshtool/worldspacedata.cpp
2023-01-21 18:39:57 +01:00
elsid
cf1d8544e3
Check agent bounds on adding agent to navigator
Do not add agent bounds which are not supported by recastnavigation with given
settings and log such events.

To avoid reaching navmesh tile generation to find out it can't be generated for
such agent bounds.
2023-01-18 12:00:48 +01:00
elsid
1cbe295030
Extend navigator tests for update with big object
Check for the number of generated recast mesh tiles and navmesh tiles.
2023-01-15 17:25:13 +01:00
elsid
44429f0393
Limit NavMeshManager update range by player tile and max tiles
Object AABB may be much larger than area currently covered by navmesh. In this
case all tiles beyond covered range should be ignored. Attempt to iterate over
them will not result in any new tile updates but can take quite a while. At
maximum this can be pow(INT_MAX - INT_MIN, 2) iterations.

Use arbitrary time limit to check for update call to finish in the test.
2023-01-15 04:46:29 +01:00
elsid
b4ab153418
Use ESM::RefId for worldspace in detournavigator 2022-12-29 23:49:49 +01:00
elsid
0b399a9d1a
Fix detournavigator tests
d40c09c18c changed the logic in parallel with
15e8f0b53c making this check invalid.
2022-12-23 19:26:15 +01:00
elsid
15e8f0b53c
Check input and report errors via RecastContext
Recast functions have preconditions for arguments they don't validate. This may
produce garbage data which may lead to crash. Check arguments and log when they
are invalid.

Do not throw exceptions when these function calls fail, capture Recast reported
errors via RecastContext inherited from rcContext and log them.
2022-12-19 19:46:45 +01:00
elsid
843753da14
Remove unused includes 2022-10-09 16:44:18 +02:00
clang-format-bot
ddb0522bbf
Apply clang-format to code base 2022-09-22 21:35:26 +03:00
elsid
5b1d6917ef
Add comments to prevent line splitting on formatting 2022-09-12 21:00:51 +02:00
elsid
22ee592dd3
Lock TileCachedRecastMeshManager once per changing a cell
To save time on locking mutex and prevent AsyncNavMeshUpdater to use RecastMesh
for a tile in the middle of objects loading.
2022-09-08 11:06:35 +02:00
elsid
d15e1dca84
Use R-tree for objects to be used for navmesh generation
Instead of storing a set of objects per tile.
2022-09-07 22:51:56 +02:00
elsid
180d609e0d
Check "wait until min distance to player" only for requiredTilesPresent wait condition
allJobsDone should wait even if "wait until min distance to player" is 0.
2022-09-06 21:51:48 +02:00
elsid
204ab6fea3
Use version instead of generation and revision for recast mesh 2022-09-06 21:51:48 +02:00
elsid
e2d566b89d
Store changed tiles in TileCachedRecastMeshManager 2022-09-05 11:49:39 +02:00
elsid
e1bed86d7e
Do single navigator update per frame
Primarily for crossing cell border case. Each Navigator::update call has a cost.
Doing it multiple times per frame increased frame duration on cell loading.

Call Navigator::wait only when cell has changed but do not use
Scene::hasCellChanged because it doesn't always indicates it.
2022-08-20 19:15:55 +02:00
elsid
bef15edf0b
Remove redundant ostream, istream, iostream and sstream includes
* Replace by std::to_string and operator+ where possible.
* Move the code requiring to include <sstream> from .hpp to .cpp files.
2022-07-05 01:41:28 +02:00
elsid
e074ebde96
Fix C4389 msvc warning
'==': signed/unsigned mismatch
2022-07-01 18:47:47 +02:00
elsid
2eae3227ba
Fix C4305 msvc warning
'argument': truncation from 'double' to 'float'
2022-07-01 18:47:46 +02:00
elsid
8544aa481c
Fix C4459 msvc warning
declaration of 'navMeshVersion' hides global declaration
2022-07-01 18:47:40 +02:00
elsid
1a12c453d6
Support different agent collision shape type for pathfinding
Actors may have different collision shapes. Currently there are axis-aligned
bounding boxes and rotating bounding boxes. With AABB it's required to use
bounding cylinder for navmesh agent to avoid providing paths where actor can't
pass. But for rotating bounding boxes cylinder with diameter equal to the front
face width should be used to not reduce of available paths. For example rats
have rotating bounding box as collision shape because of the difference between
front and side faces width.

* Add agent bounds to navmesh tile db cache key. This is required to distinguish
  tiles for agents with different bounds.
* Increase navmesh version because navmesh tile db cache key and data has changed.
* Move navmesh version to the code to avoid misconfiguration by users.
* Fix all places where wrong half extents were used for pathfinding.
2022-06-21 12:57:32 +02:00
jvoisin
72a6d1f69f Clean up bullet includes 2022-06-04 20:15:10 +02:00
elsid
87073e26f2
Increase precision error for navigator tests 2022-05-23 17:18:00 +02:00
ζeh Matt
18f16eac4c
Refactor DetourNavigator to pass prng along, use world prng for AiWander 2022-05-17 20:37:15 +03:00
elsid
a75c7c49f0
Disable writes to navmeshdb on database is locked error
Simultaneously writing to sqlite3 database is not possible. Process exclusively
locks the database for this. Another process will fail to perform any request
when database is locked. Alternatively it can wait. Handling this situation
properly requires complexity that is not really needed. Users are not expected
to run multiple openmw processes simultaneously using the same navmeshdb.

Before this change running multiple openmw processes using the same navmeshdb
can lead to a crash when first transaction fails to start because there is
exception thrown and not catched.

Remove use of explicit transactions from DbWorker. Handling all possible
transaction states due to different errors brings unnecessary complexity.
Initially they were introduced to increase time between flushes to disk. This
makes sense for navmeshtool because of massive number of writes but for the
engine this is not an issue.
2022-05-09 22:54:46 +02:00
psi29a
1f14f97d17 Merge branch 'navmeshdb_max_file_size' into 'master'
Limit max navmeshdb file size (#6649)

Closes #6649

See merge request OpenMW/openmw!1716
2022-03-27 09:07:56 +00:00
ζeh Matt
769be88d43
Adjust DetourNavigatorNavigatorTest to the new prng values 2022-03-21 17:49:42 +02:00
elsid
5b9dd10cbe
Limit max navmeshdb file size
Use "pragma max_page_count" to define max allowed file size in combination with
"pragma page_size" based on a new setting "max navmeshdb file size".

* Stop navmeshtool on the first db error.
* Disable writes to db in the engine on first "database or disk is full"
  SQLite3 error. There is no special error code for this error.
* Change default "write to navmeshdb" to true.
* Use time intervals for transaction duration instead of number of changes.
2022-03-18 19:08:46 +01:00
elsid
42d6032c8b
Support compilation with c++20 2022-02-24 00:49:40 +01:00
elsid
ab1a6e034e
Add navmeshtool flag to remove unused tiles from navmesh disk cache
* Remove tiles outside processing range. Useful when new content profile map
  has different bounds.
* Remove ignored tiles. For a case when content profile maps have intersection
  but there is no more data for navmesh.
* Remove older tiles at the same worldspace position. If navmesh tile data has
  changed with new content, the old ones unlikely to be used.
* Vacuum the database when there are modifications. SQLite leaves empty pages
  in the file on database modification. Vacuum cleans up unused pages reducing
  the file size.
2022-02-18 21:57:23 +01:00
elsid
05b54cbfb8
Cull navmesh objects by scene bounds
If object is too big iteration over all tiles covering it can take too much
time. Limit bounds to a square around a player position to cover only tiles
that will be present in navmesh based on max tiles number option.

Each object is associated with a set of tiles its present in. Culling can
reduce this set but it has to be update when bounds change position. Do this
in TileCachedRecastMeshManager::setBounds updating the set and adding/removing
objects to the corresponding CachedRecastMeshManagers.
2022-02-03 22:09:37 +01:00
elsid
1b2954f2db
Remove unused z coordinate 2022-02-03 21:43:53 +01:00
elsid
542717394a
Remove objects, water and heightfields when no longer required 2022-02-03 02:43:35 +01:00
elsid
7ea5aa250b
Revert "Cull navmesh objects by scene bounds"
This reverts commit b0ef20c303.
2022-01-30 21:43:23 +01:00
psi29a
6f7a067e0c Merge branch 'esmrename' into 'master'
esm refactor work

See merge request OpenMW/openmw!1575
2022-01-27 17:52:42 +00:00
elsid
ecc654a369 Limit and filter navmesh input (#5858) 2022-01-25 14:06:53 +00:00
Bret Curtis
d1fb854521 move most of the files from esm to esm3, keep common code in esm; this is make space for a future with esm4
esm typo

esm typo
2022-01-23 17:04:48 +01:00
elsid
aaf6c82e33
Do not write shapes to navmeshdb when writing is disabled 2021-12-16 22:57:35 +01:00
elsid
96eb8d7be9
Write generated navmesh to navmeshdb
Perform all request to db in a single thread to avoid blocking navmesh
generator threads due to slow write operations.

Write to db navmesh for all changes except update as it done for memory cache.

Batch multiple db operations into a single transaction to speed up writing by
not executing fsync after each insert/update query. All reads are performed in
the same transaction so they see uncommited data.
2021-12-11 00:22:04 +01:00