Commit Graph
236 Commits
Author SHA1 Message Date
nox7 40ba44aa5d Remove useless methods 2026-09-18 13:54:43 -05:00
nox7 9e932a79f9 Consolidate "get real time" into helper function and use steady_clock instead of high-res clock (for time consistency guarantees)
Format
2026-09-18 13:54:43 -05:00
nox7 880372971a CLANG format 2026-09-18 13:54:43 -05:00
nox7 4e88ec9049 Remove useless method and just group the timers into the original two 2026-09-18 13:54:43 -05:00
nox7 4bdc4396e8 Save/Load real timers as a delta time and restart the timer from that remaining delta on load 2026-09-18 13:54:43 -05:00
nox7 c992c8cb0c Implement new real time timers. Works when the game is paused 2026-09-18 13:54:43 -05:00
S3kshun8 Games 04b1ee951b Merge branch 'lua-perf' into 'master'
Cut Lua frame time on heavy script loads

See merge request OpenMW/openmw!5506
2026-09-16 06:31:36 +00:00
Thomas 512f20501b Keep Lua timers alive during callbacks 2026-09-10 23:50:37 +02:00
Thomas decf020ecd Add test coverage to avoid silent breakage 2026-09-08 13:01:49 +02:00
Thomas Portal dd5d7887d7 Keep the active local scripts in a sorted vector
mActiveLocalScripts is walked four times a frame (prune, stats, timers,
update) and inserted into only when an object becomes active, which is the
access pattern a contiguous container is for. A std::set pays red-black tree
pointer chasing on every one of those walks.

Hold a vector sorted by container address instead. Sorted rather than
unsorted because a duplicate entry would dispatch a container's handlers
twice; the ordering itself was never meaningful, since the set was ordered by
pointer address too.

Measured on the Path of the Incarnate save: Lua p50 3.489 -> 3.366 ms, -3.5%,
with all three treatment runs below all three control runs.

This only fixes the first of the three hops needed to reach a container: the
weak pointer is now sequential, but dereferencing it to the heap slot and
then to the container are still dependent misses. Resolving the list into
dense pointers once per frame is blocked on lifetime, since running timers
and update handlers can deactivate an object mid-walk and re-resolving is
exactly the protection that would be discarded.
2026-09-08 13:01:49 +02:00
Thomas Portal ebbadc87fa Decay Lua script instruction averages lazily
statsNextFrame walked every script in a container every frame purely to
multiply each running average by a decay constant, whether or not the script
had run. With 701 active containers that walk is pure overhead for scripts
that were idle.

The averaging is a geometric decay, so the frames a script sat out fold into
a single power. Record the frame each average was last written and apply the
missing decay when it is next written or read; the per-frame call then only
bumps a counter, and a frame costs the same whether a container holds one
script or a thousand.

Reading the stats deliberately does not write them back, so collectStats
stays const and the decay is applied for real by whoever writes next.
2026-09-08 13:01:49 +02:00
Dave Corley 696de50858 FIX: More defenses against failed storage deserialization 2026-09-03 17:05:46 -05:00
Dave Corley 389a8786d7 FIX: Return stateful nils when binarydata is empty so it doesn't potentially get dereferences and blow up 2026-09-03 17:05:35 -05:00
Thomas 2cc7085015 Dispatch __pairs without allocating a table for every call 2026-08-15 17:22:58 +02:00
Evil Eye eb15948b0e Account for nullptrs 2026-03-19 20:34:32 +01:00
Evil Eye 233fb4e7bd Address feedback 2026-03-09 21:25:59 +01:00
Evil Eye 814e51785f Avoid tracking dangling LocalScripts 2026-03-09 21:15:42 +01:00
Evil Eye 07d61e4ca5 Add global bindings 2026-03-01 20:58:14 +01:00
Evil Eye 58e1ef098d Add onContentFilesLoaded 2026-03-01 20:58:13 +01:00
Evil Eye 7a581f359e Add LOAD scripts and split manager init 2026-03-01 20:58:13 +01:00
Evil Eye e4ffddb641 Replace getters and setters with direct member access 2026-02-08 10:35:22 +01:00
Evil Eye f93aca8166 Clear script index caches when (re)loading config 2026-02-04 16:36:53 +01:00
Evil Eye ee1cee1181 Reassign script id and test script order changes 2026-02-04 16:36:53 +01:00
Evil Eye fdc2e63152 Save Lua script ids instead of paths 2026-02-04 16:36:51 +01:00
Evil Eye fdbcada044 Don't accept table like objects in getFieldOrNil 2025-12-09 11:48:02 +01:00
AnyOldName3 f8553f2e8a Resolve new warning from !4798 2025-11-10 16:03:02 +00:00
AnyOldName3 ef8e7d97cb Resolve merge conflicts from !4971 2025-11-10 16:01:47 +00:00
uramer 3be1010d03 Merge branch 'protectthecall' into 'master'
Ensure LuaUtil::call is invoked from a safe context

Closes #8769

See merge request OpenMW/openmw!4971
2025-11-10 09:50:10 +00:00
Andrei Kortunov 6d3f5cf70c Dehardcode script settings window font and colors 2025-11-08 20:31:24 +04:00
AnyOldName3 0a9f5a3c66 Resolve merge conflicts from !4938 and !4956 2025-11-02 18:05:38 +00:00
elsid e4b28ebdce Fix clang-tidy checks
Placing .clang-tidy into build/ folder hides some checks defined in the
root file. Place them into more specific folders to not check generated
files.
2025-11-02 18:40:02 +01:00
Andrzej GłuszakandAlexei Kotov c4b28a39c3 Lua: Return nil instead of empty strings for optional RefId fields
Implement sol_lua_push for ESM::RefId to automatically convert empty
RefIds to nil in Lua. This fixes cell.region and cell.worldSpaceId
returning empty strings, and applies the same pattern consistently
across all Lua bindings.

Removes LuaUtil::serializeRefId as it's no longer needed.

Fixes #8718
2025-11-02 05:08:25 +03:00
Evil Eye 4f8b418c23 Ensure LuaUtil::call is invoked from a safe context 2025-10-30 22:24:53 +01:00
AnyOldName3 06cb00bb0b Resolve merge conflicts from !4924 and !4928
luamanagerimp still needs float frameDuration, and reordering a bunch of fields in the scene manager conflicted with changing the type of maxanisotropy.
2025-10-04 23:08:20 +01:00
Evil Eye 478df08433 Address more engine conversion warnings 2025-09-22 13:33:27 +02:00
Evil Eye 3ba702690c Require SOL_PROPAGATE_EXCEPTIONS to be off 2025-09-20 16:07:59 +02:00
Evil EyeandPetr Mikheev ff79c2d826 Turn menu.saveGame into a delayed action 2025-09-20 10:39:43 +00:00
Evil Eye cb82d37992 Address remaining conversion warnings in components 2025-09-20 11:39:31 +02:00
Evil Eye f7292680d6 Fix most conversion warnings in components 2025-09-18 22:00:55 +02:00
AnyOldName3 98291f1377 First batch of warning fixes 2025-09-18 00:38:08 +01:00
psi29a 0ab79c4370 Merge branch 'formatcomponents' into 'master'
Remove StringUtils::format from components

See merge request OpenMW/openmw!4880
2025-08-31 17:59:35 +00:00
elsid 0f36b7fc97 Fix and enforce parameter naming 2025-08-27 12:45:09 +02:00
Evil Eye e88e60f475 Check length before dereferencing 2025-08-26 18:08:38 +02:00
Evil Eye 79a1f1c3d2 Address feedback 2025-08-25 16:46:04 +02:00
Evil Eye e97542a487 Fix include 2025-08-24 16:11:34 +02:00
Evil Eye 26e562490f Replace StringUtils::format in components/lua 2025-08-24 14:28:17 +02:00
elsid 3067294f0d Add and fix -Wshadow 2025-08-18 21:09:06 +02:00
elsid d121b606b6 Fix and enforce local variable naming 2025-08-05 21:27:48 +02:00
psi29a b160cee0b7 Merge branch 'sonarview' into 'master'
Address string_view conversions flagged by SonarQube

See merge request OpenMW/openmw!4693
2025-08-01 08:06:36 +00:00
psi29a 2a8dc56619 Merge branch 'pedanticmsvc' into 'master'
Resolve unused code warnings when compiling in Debug mode using MSVC

See merge request OpenMW/openmw!4820
2025-08-01 08:06:11 +00:00