Commit Graph

132 Commits (b7caf1f36e8638760605401c0feae56f2b79d7fd)

Author SHA1 Message Date
jvoisin e51669c05d Don't assign a variable passed by value 4 years ago
elsid 1e2aae8095
Use stable sort+unique to collect RefIDs for ESMStore records counting
The idea is to avoid std::map lookup for each CellRef. Instead generate a
sequence of added and removed RefNums into a vector then order them by RefNum
using a stable sort that preserves relative order of elements with the same
RefNum. RefIDs are stored in a different vector to avoid std::string move ctor
calls when swapping elements while sorting. Reversed iteration over added and
removed RefNums for each unique RefNum is an equivalent to what map-based
algorithm produces. The main benefit from sorting a vector is a data locality
that means less cache misses for each access. Reduces ESMStore::countRecords
perf cycles by 25%.
4 years ago
psi29a fd89582e0c Merge branch 'navmesh_wait' into 'master'
Wait until navmesh is generated within given distance around player (#5500)

Closes #5500

See merge request OpenMW/openmw!819
4 years ago
elsid 626e032931
Do not store callback inside Misc::Barrier
The only wait method can be provided with it so pass it as a template
parameter there.
4 years ago
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.
4 years ago
Andrei Kortunov f308dde254 Clean up MSVC warnings 4 years ago
fredzio 16b288f53c Re-add dropped struct keyword to fix build.
rtprio is both a struct and a function, so we need to be explicit.

../../../components/misc/thread.cpp:53:9: error: must use 'struct' tag
to refer to type 'rtprio' in this scope
rtprio prio;
^
struct
/usr/include/sys/rtprio.h:91:5: note: struct 'rtprio' is hidden by a
non-type declaration of 'rtprio' here
int     rtprio(int, pid_t, struct rtprio *);
^
1 error generated.
4 years ago
psi29a c686dd05d0 Merge branch 'thread_idle_priority' into 'master'
Set idle priority for navmesh generation thread

See merge request OpenMW/openmw!632
4 years ago
elsid ab8d1c02d4
Set idle priority for navmesh generation thread
Support Linux, Windows, FreeBSD.
4 years ago
glassmancody.info 582f7b52cf Merge remote-tracking branch 'upstream/master' into why_are_the_christmas_lights_still_up 4 years ago
glassmancody.info 9e80091aff clear up force shaders and make it less convoluted 4 years ago
Andrei Kortunov 124a33d8a3 Fix uninitialized variables 4 years ago
Max 2cd96e56d5 create constant and use constant in other parts of the code base 4 years ago
psi29a 415591b7ed Merge branch 'ai_reaction_deviation' into 'master'
Distribute AI reactions and engage combat calls over time

See merge request OpenMW/openmw!674
4 years ago
wareya 63f01d8c5f Prevent physics death spiral by falling back to true delta time when needed 4 years ago
elsid 675c0ab72f
Apply uniform random deviation to AI reaction timer
This allows to distribute AI reaction calls over time.

Before this change actors appearing at the same frame will react in the same
frame over and over because AI reaction period is constant. It creates a
non-uniform CPU usage over frames. If a single frame has too many AI reactions
it may cause stuttering when there are too many actors on a scene for current
system.

Another concern is a synchronization of actions between creatures and NPC.
They start to go or hit at the same frame that is unnatural.
4 years ago
elsid 8ab5fd9b40
Fix frame rate limit
Measure time at the computation end but before sleep. This allows to adjust
sleep interval for the next frame in case sleep is not precise due to syscall
overhead or too low timer resolution.

Remove old frame limiting mechanism.
4 years ago
Sergey Fukanchik f3271cb66b Add unit test for swapEndiannessInplace(). Part of Bug #5837 4 years ago
Petr Mikheev 31b5150e0d Fix implementation of Misc::swapEndiannessInplace 4 years ago
Petr Mikheev 14dd11372f Utility functions for little-endian <-> big-endian conversion. 4 years ago
fredzio 1357bba0a0 Use some C++17 where it makes the code more readable
Also replace boost::optional
4 years ago
Bret Curtis 82431b752d removed unnessary bits that cmake should be doing for us; replace Misc::gcd with std::gcd 4 years ago
AnyOldName3 df178ed97c Merge branch 'container-regressions' into 'master'
Fix container regressions

See merge request OpenMW/openmw!346

(cherry picked from commit b0aee6f83d4cddb0116284b197913f9687dd9cee)

95e7a22d fix container regressions
4 years ago
fredzio 3c2504b442 Process movement queue in one or several background threads
Before movement calculation, the main thread prepare a
vector of ActorFrameData, which contains all data necessary to perform
the simulation, and feed it to the solver. At the same time it fetches
the result from the previous background simulation, which in turn is
used by the game mechanics.
Other functions of the physics system (weapon hit for instance)
interrupt the background simulation, with some exceptions described
below.

The number of threads is controlled by the numeric setting

[Physics]
async num threads

In case 'async num threads' > 1 and Bullet doesn't support multiple threads,
1 async thread will be used. 0 means synchronous solver.
Additional settings (will be silently switched off if async num threads = 0)

[Physics]
defer aabb update

Update AABBs of actors and objects in the background thread(s). It is not an especially
costly operation, but it needs exclusive access to the collision world, which blocks
other operations. Since AABB needs to be updated for collision detection, one can queue
them to defer update before start of the movement solver. Extensive tests on as much
as one installation (mine) show no drawback having that switched on.

[Physics]
lineofsight keep inactive cache

Control for how long (how many frames) the line of sight (LOS) request will be kept updated.
When a request for LOS is made for the first time, the background threads are stopped to
service it. From now on, the LOS will be refreshed preemptively as part of the background
routine until it is not required for lineofsight keep inactive cache frames. This mean
that subsequent request will not interrupt the background computation.
4 years ago
Assumeru 72549651e0
Rework container resolution (#3006)
* Rework container resolution

* add optional argument to getCount

* remove now-redundant changes

* undo worldimp changes

* move save-fixing code to InventoryState

* replace Rng instances with Seeds
4 years ago
psi29a f90a049702 Merge branch 'movement_refactoring' into 'master'
Refactoring related to "smooth movement"

See merge request OpenMW/openmw!285

(cherry picked from commit 6eaf0a389d5aed3b74ab1a7cf89574612f964bdf)

e847b4c8 Split getSpeed() to getMaxSpeed() and getCurrentSpeed()
a96c46bc Refactor calculation of movement.mSpeedFactor
03ee9090 Use getMaxSpeed instead of getCurrentSpeed where it makes sense.
a178af5c Create helper functions `normalizeAngle` and `rotateVec2f`
4 years ago
elsid 02f9b44f01
Use RAII for object ptr from pool 5 years ago
elsid 6ca29c6107
Use common type for pool of sounds and streams 5 years ago
Andrei Kortunov d1a3cc98ff Get rid of ECLD and dependencies 5 years ago
elsid c4cd3b2c4f
Add pathgrid to navmesh as off mesh connection 5 years ago
elsid bd1ef4dd6d
Add detournavigator test for multiple worker threads 5 years ago
Frederic Chardon 513ac8986d Add link to opencs documentation on readthedocs, available through
context menu.
The documentation opens in default browser.

There are 3 contexts:
- global: opens the OpenMW CS User Manual main page
- when a record is selected: opens the "Tables" page
- when the filter field is selected: opens the "Record Filters" page

There is also a link to the OpenCS tutorial in the help menu.
5 years ago
Andrei Kortunov a250a405b4 An attempt to fix the MSVC2017 build 5 years ago
Andrei Kortunov 1cdd33b434 Implement additional stringops to avoid Boost functions 5 years ago
Andrei Kortunov e679190f31 Introduce a custom format() function to get rid of boost::format() and hackish replace() 6 years ago
Andrei Kortunov 861d41f4a4 Native graphics herbalism support (feature #5010) 6 years ago
elsid ccc709a316
Store guarded navmesh cache item in shared_ptr
Remove useless SharedGuarded type.
6 years ago
Andrei Kortunov bf5f68a4d8 Replace boost GCD to the homebrew implementation 6 years ago
Grigory Latyshev 3872d7476b Move makeOsgVec3f() to settingsutils.hpp
Remove all other makeOsgVec3f() implementations
6 years ago
Grigory af7b6a09a8 Simplify Misc::StringUtils::toLower 6 years ago
elsid 33f6fb258d
Option to set specific random seed for random number generator 6 years ago
Capostrophic 8ecd0b82a4 Replace Boost format and replace_all where possible 6 years ago
Andrei Kortunov 3032b177a1 Remove redundant includes 6 years ago
elsid 16675fd254
Return empty path when navmesh is not found for agent 6 years ago
Andrei Kortunov 9e4a339ad3 Daytime node switch support (feature #4836) 6 years ago
elsid 264ea99af6 Use explicit default ctors call
Special change for MSVC2015.
6 years ago
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.
6 years ago
elsid ae7285e960
Use ScopeGuarded instead of raw mutex 6 years ago
elsid cf4066751c
Add classes to encapsulate value guarded by mutex 6 years ago
Andrei Kortunov 43c7438e8e Move WeakCache to components/misc 6 years ago