1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 12:59:55 +00:00
Commit graph

59 commits

Author SHA1 Message Date
elsid
50f4471750
Use R-tree for dynamic priority of navmesh async job 2024-04-13 19:51:16 +02:00
elsid
17bd571a65
Do not repost failed jobs
Failures should not happen except for some weird corner cases. Retrying is
unlikely to help in such situation.
2024-04-13 19:51:16 +02:00
elsid
767a14587c
Add more debug logging on navmesh generation 2023-07-22 18:08:36 +02:00
elsid
472a36d92a
Cleanup detournavigator includes 2023-04-22 13:21:59 +02: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
b4ab153418
Use ESM::RefId for worldspace in detournavigator 2022-12-29 23:49:49 +01:00
clang-format-bot
ddb0522bbf
Apply clang-format to code base 2022-09-22 21:35:26 +03: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
c15848932b
Separate reading navigator stats and reporting 2022-08-28 14:52:34 +02:00
elsid
e9be8b5efe
Show stats for writing and reading navmesh db queue jobs 2022-08-28 14:14:43 +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
b1fb42a28c
Cleanup detournavigator includes 2022-08-15 19:46:10 +02:00
elsid
1a5932a669
Move std::ostream& operator<< to .cpp 2022-06-26 22:43:53 +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
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
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
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
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
elsid
c9b8ba7b46
Read navmesh tile data from database
When tile is not found in memory cache try to find it in the database.
2021-12-11 00:22:04 +01:00
elsid
0066c446f8
Remove navmesh tiles outside allowed range first
* Change job change type to remove when tile is outside allowed range.
* Swap try number and change type in job priority. To make sure remove jobs
  always processed before any other.
2021-08-20 20:16:59 +02:00
elsid
431501e23a
Remove redundant job distribution between threads
Instead don't take jobs from queue until job for the same tile is processing.
2021-08-20 20:16:56 +02:00
elsid
09b1a2e3c6
Make unchanging Job fields const 2021-08-12 22:25:25 +02:00
elsid
8bca9eec80
Use single set to store pushed tiles 2021-08-12 22:25:24 +02:00
elsid
a97b2ced27
Use single map to store last updates 2021-08-12 22:25:24 +02:00
elsid
bfcc430822
Use single map to store processing tiles 2021-08-12 22:25:24 +02:00
elsid
902b0f9f84
Store jobs in the same container until they are processed
Push to queue and reorder only iterators.
2021-08-12 22:24:02 +02:00
elsid
8db640289c
Use single set to store pushed jobs for tiles 2021-08-12 22:05:44 +02:00
elsid
a99266a60e
Do not measure total navmesh generation duration
This is not a useful thing anymore.
2021-08-12 21:44:10 +02:00
elsid
59f89d22f8
Apply min distance only for not present tiles
To avoid waiting when navmesh update is triggered by transformed object for
already present tiles.
2021-05-14 22:41:11 +02:00
elsid
d0ea9c482a
Reorder async navmesh updater jobs when player tile changes
When player tile changes distance to player that is part of jobs priority is
invalidated. So jobs are no longer in the right order. This can lead to
processing of farests tiles first.

Sort queue each time player tile is changed.
2021-05-14 22:41:05 +02:00
elsid
7a51d0db18
Wait until navmesh is generated within given distance around player
Add a setting to change this distance.

To prevent situations when there is not enough navmesh generated and actors
can't find path correctly.
2021-05-05 19:44:16 +02:00
elsid
f169f8e6f0
Wait until navmesh is generated for interior cells
Add special loading progress bar.

It should be fast enough to not keep loading screen for noticably long but
will provide better pathfinding for actors inside interior cells.
2021-05-05 19:27:49 +02:00
Bret Curtis
f6bead88a9 purge boost/optional.hpp headers 2020-10-25 00:58:44 +02:00
Bret Curtis
62b0781f7d use std::optional instead of boost::optional 2020-10-25 00:33:41 +02:00
fredzio
460e69e92a Get rid of warning: dynamic exception specifications are deprecated 2020-10-10 12:12:55 +02:00
elsid
b150d681a9
Update same navmesh tile with limited frequency 2020-05-01 18:05:58 +02:00
elsid
bd1ef4dd6d
Add detournavigator test for multiple worker threads 2020-04-26 22:00:55 +02:00
elsid
7502db1570
Add number of thread jobs to update jobs stats 2020-04-25 17:51:50 +02:00
elsid
c683dc8565
Lock navmesh tile by thread while processing
To avoid duplicated work on a same tile by different threads.
If tile is locked by another thread, then post job into this thread queue.
2019-04-10 22:01:50 +02:00
elsid
4624f31788
Report navigator stats 2019-03-17 22:15:18 +03:00
elsid
f6a1d3cecf
Store weak pointers to navmesh in jobs queue
To avoid useless processing for removed navmeshes.
2019-03-10 17:06:19 +03:00
elsid
ff47df4f2c
Repost navmesh update jobs when failed because of out of memory
DT_OUT_OF_MEMORY error is returned when limit of tiles is reached.
2019-03-08 17:39:04 +03:00
elsid
b9b8ed177c
Store priority values as named fields 2019-03-08 15:23:36 +03:00
elsid
41319eb2bf
Use new change type for update object
To perform jobs for updated animated objects and doors with lowest
priority.
2018-11-03 16:44:23 +03:00
elsid
ed73d130f9
Cache navmesh tiles
Use LRU modification to hold currently used items. Use RecastMesh binary
data for item key.

Store original pointer of btCollisionShape in user pointer to make available
it as an identifier within all duplicates. Use pointer to heights data array
for btHeightfieldTerrainShape.
2018-10-13 22:22:12 +03:00
elsid
ae7285e960
Use ScopeGuarded instead of raw mutex 2018-10-13 22:16:35 +03:00
elsid
7c80bb9411
Support multiple threads for async nav mesh updater 2018-10-13 22:16:34 +03:00
elsid
346e9e3141
Add off mesh connections for doors without teleport 2018-10-13 22:16:33 +03:00
elsid
c771986c56
Prioritise NavMesh jobs first to remove and last to add
When player move fast enough, tiles update for specific area square
couldn't catch player move. Tiles to be removed are left in the queue
with lower priority then tiles to be added which are nearest to player.
This can lead to overflow for amount of tiles. So we try to do remove
first. But we detect change type approximately using mixed change type,
because even if we do it precise, change type could change while job
is in queue.
2018-10-13 22:16:31 +03:00