870 Commits over 243 Days - 0.15cph!
Update: Exclude unnecesary scenes when PerfFwk is enabled
- We have disabled scenes in the list that UnityTestFramework ignores and tries to build, leading to issues
- It also saves iteration time, since we only build scenes we'll use for perf testing
Tests: same as before
Update: Moving perf tests to PerfFwk plugin
- Added additional references to PerfFwk
Original idea of mixing perf test code into main assembly didn't work out, so for now going the path of contianing them in an isolated assembly
Tests: tested with other changes to run pooling tests in CLIENT+SERVER standalone mode
Undo: auto-reference of PerformanceTesting lib
Trying out a different approach
Tests: none
Merge: from main
Tests: none
Merge: from requesttrees_spike
Removes the "server_requesttrees" lag spike on player connect by spreading out the processing over the next frames. Server owners can disable this via `TreeManager.EnableTreeStreaming 0` and adjust it's performance via `PlayerBudgetMS`, `UpdateBudgetMS` and `CellSize` admin servervars.
Tests: Booted Procgen 6k world - took ~3.5min to stream entire world to a player at 10 server fps, with no visual deterioration.
Update: Log TreeManager's treaming grid dimension on init
- Available as part of Network level 1 logging
Tests: booted in editor with server-only mode
Merge: from main
Tests: editor boot
Update: Use RustLog instead of debug log in TreeManager
- Also fixed a minor bug that would not display full timing accuracy for old method
- Moved logs to level 1 of Network (was 2)
Tests: enabled network logs and tried with tree streaming enabled/disabled
Update: adding doc string to Pool.FreeUnmanaged(ref Stopwatch)
Tests: none, trivial change
Optim: avoid StopWatch allocations via Pooling
Tests: on Craggy flew out until only impostors visible
Clean: updated a comment implying a potential bug - it was wrong
Tests: none, trivial change
Update: TreeManager's grid is defined by cell size
- Exposed via TreeManager.CellSize convar (takes effect at boot only)
- Reorganized code a smidge to reduce how scattered a bunch of info was
Tests: On craggy connected with 2nd player and flew out until only impostors were visible.
Update: Whole tree streaming logic is time budgetted
- Right now has a budget of 1ms, controlled by UpdateBudgetMS convar
- Streaming preference is given to players who have more cells left to stream
This change protects us from having too many players in the streaming queue eating up all the frame budget.
Tests: On craggy confirmed that streaming still completes
Update: consolidate tree manager cell streaming
- Hidden behind the Network level 2 logging
Right now we don't fit the 10micros budget(~60micros), so we end up sending 1 cell per player - going to add a frame budget with player sorting to avoid hogging the server
Tests: On 4.5k procgen map tracked first and second player connecting, was able to observe cost of jit
Clean: Removing a couple TODOs
- Not doing vehicle specific streaming logic as 4.5k world grid gets streamed in less than a second
- removing old TODO since my change implements it
Tests: none, trivial change
Update: Budget every tree-cell send
On Procgen 4.5k map from a save sending one cell can take 0.25ms - this change should smooth out the cost further.
Tests: Booted on craggy, confirmed that player recieved all cells.
Bugfix: Don't send newly spawned trees to player if they land in a batch yet to be sent to them
- Added a profiling scope so we can track if it's taking too much time(it's a TxP complexity algo, but P tends to 0 very quickly, so we should be able to afford this)
Tests: Tested on 4.5k procgen world and connected from a separate client and chopped a bunch of trees saw no duplicates. That said, it's very difficult to proc this (<1s window).
Clean: forgot to save an extra comment
Tests: none, trivial change
Update: replacing cell budget with a time-per-player budget
- Setting this budget to 10micros initially
This budget doesn't evaluate every cell, but rather groupings of cells. I'll re-evaluate this once I get to testing big procedural worlds.
Tests: Confirmed entire Craggy grid gets streamed to the player
Update: added a runtime switch to disable tree batch streaming
- Enabled by default
Tests: booted with it being both turned on and off
Merge: from main
Tests: none
Backout: bring back all the scenes
Without this, editor bootstrap workflow dies.
Tests: none, trivial change
Update: Reducing which scenes we have set for build in Build Settings
Our internal build macros only build 2 scenes, while Test Runner tries to build all (incl disabled) scenes set in the Build Settings. This allows us to run Player-mode tests without extra steps.
Tests: With PerfFwk enabled, ran pool perf tests in Player mode - it ran and gathered results.
Update: Reorganization of the perf test framework
- Unity.PerformanceTesting is marked as auto-referenced (this is another modification of original package)
- Added a "Rust Editor/Performance Framework/Active" menu toggle to enable/disable perf test scripts - controls RUST_PERF_FWK define
- Renamed and moved PerfFwk assembly to Plugins/ (as that's it's design)
- Moved existing perf tests outside to the root assembly (Scipts/PerfTests) so that we can access gameplay code
The goal is to both isolate the perf framework code from the codebase as much as possible(don't ship to players or unity devs to load stuff that's not sueful), while also being able to work with our main game scripts directly.
Tests:
- Switch the toggle on and off - no editor errors.
- Built client&server with framework being enabled - it passed.
-- Found no PerfFwk references in main game assembly for both client and server and no references to test classes
Buildfix: isolating perf test scripts into it's own assembly
- For the time being stores existing perf tests - will reorganize when the structure is more clear in the future.
Tests: Unity booted without errors, confirmed perf tests presence in Test Runner
Merge: from main
Tests: none
Update: enable sound pooling by default
If something goes derp, can be disabled via audio.enablesoundpooling 0
Tests: was explicitly enabled over last 3 days while running all recent changes
Merge: from main
Tests: ran around on craggy with logs
Bugfix: don't leak looping sounds when quick-switching
It's possible that equipped items with sound effects (setup via sound player) can enable-then-disable across 2 frames, before SoundManager picks up the pending play request. If it's a looping sound(like torches burn loop) it would stay alive forever. Now we cleanup the pending requests on disable of sound player.
Tests: mousewheel quickswitched between rock and a torch and observed numbers in audio.printsounds - the burn loop is no longer accumulating.
Update: SoundManager pools internal lists
The pooling effect is minimal, but it achieves 2 small improvements:
- we don't hold lists in memory for sounds that don't reapper for a while - those can be reused in other parts of the code
- audio.printsounds no longer reports 0 active sounds per definintion
Tests: On craggy quickswitched between equipped items. Saw the various sounds appear and disapper in the logs.
Update: microphone drops any sounds it has accumulated on destroy
Tests: tested by playing the flute when exploding the microphone stand connected to a speaker
Update: MiningQuarry drops sound assets when destoyed (though it's invulnerable)
Tests: none, trivial change (same type of changes as previous)
Update: modular car's engine drops all sound resources on disable
Tests: blew up a modular car
Update: AmbianceWaveSounds recycles sounds on disable
Tests: none targetted(same type of change as before), but have been live on my branch for 2d while testing and working on other changes.
Update: Engine blend loop drops it's sound resources on disable
Tests: none, trivial change (same type of change as previous)
Update: Tree now drops it's sound resources on client destruction
- It also drops the Gain mod when fading out sound loop during fall
Tests: cut down a tree, saw relevant audio events in logs
Update: Traveling Vendor drops it's sound resources on client destruction
Tests: none, trivial change (same type of change as previous)
Update: Parachute and Sled drop their sound resources on destroy
Tests: none, trivial changes (same type of change as previous)
Update: CCTV and SpinnerWheel drop their sound resources on disable/destroy
Tests: none, trivial change (same type of change as previous)
Update: Sub, Snowmobile, Tugboar and Train drop their sound resources on disable/kill
- In Snowmobile's case Ski audio was previously (accidentally?) retained when sim stopped
- Train engine used to retain damage and engine reflection sounds (assume an accident/bug)
Tests: none, trivial changes (same type of changes as previously)
Update: CargoShip drops sounds resources on disable
- Also added a couple convenience StopXSound methods, since it has a bunch of different sounds.
Tests: none, trivial change (same type of change as before)
Update: Ferry drops it's sound resources when disabled
Tests: none, trivial change (same type of change as previous)
Bugfix: PatrolHeli now releases modulators alongside the sounds
Tests: none, trivial change
Bugfix: Drone now releases pitch modulator on destruction
Tests: none, trivial change
Update: Modular Vehicle drops sound resources on destruction
Tests: plugged in engine comps on Craggy's spawned vehicle, drove around in it. Put some timed c4 and drove until explosion - confirmed resources got released via logs.
Update: Helicopter now drops sound resources when disabled/retired
- Also fixed a potential NRE when requesting a sound fails
Tests: spawned an attack heli and flew around in it with jumping out at various stages. Also destroyed it to trigger sound recycling.
Bugfix: Bicycle now uses it's coasting sound when not pedaling
Tests: rode the bicycle with pedaling on and off.
Update: Bycicle drops all sound resources when sound definition changes
- Previously it tried to manage lifetime of modulators internally, but since we can pool it'll happen automatically now.
Tests: rode the bike with jumping off during different moments. Noclipped away and back, redid same actions - all stable.
Update: DPV stops all sounds when no longer simulating
In theory, there were edge cases where previously it was possible that some sounds would not be cleaned up.
Tests: rode the DPV, jumped off at various points, picked it up and redeployed. Noclipped around the area
Update: MovementSounds releases sound resources on disable
- Also got rid of IOnParentDestroying implementation - it's handled by OnDisable now
Tests: ran in water. Killed self mid run to test onDisable - all good