branchrust_reboot/main/baseplayer_serverupdateparallel/occlusion_reworkcancel
30 Commits over 31 Days - 0.04cph!
Optim: ServerUpdateParallel - update player subscription groups just before we run sever occlusion update
This ensures that server occlusion frame cache is built from up-to-date occluders, and allows to save on more occlusion checks downstream in ConnectedPlayersUpdate
Tests: 2p session on Craggy with UsePlayerUpdateJobs 2
Clean: split up FinalizeTickParallel monstrosity
This is end of prep to rearrange systems for better occlusion cache reuse
Tests: 2p session on craggy with UsePlayerUpdateJobs 1 and 2
Update: add native list expand to GatherPlayersToUpdate
No effect in current case, but can prevent surprise exceptions in the future if reused
Tests: none, trivial change
Clean: minor refactor of ServerUpdatePlayerTick
Getting ready to shuffle system steps around, to re-expand occlusion cache and potentially reduce network traffic
Tests: none, trivial changes
Bugfix: avoid stale occlusion results for new occludeeds
Didn't realize UpdateSubscriptions modifies occludees - this returns a bunch of overhead. Will try to fix next.
Tests: none, trivial change
Optim: deduplicate occlusion queries
Saves 15-50% in 1k baseplayer pairs parallel occlusion perf tests.
Tests: occlusion unit tests
Clean: ServerOcclusionJobs.Algorithm uses int3 instead of SubGrid
Simplifies the code a bit
Tests: ran unit tests
Clean: get rid of non-burst CalculatePathBetweenGrids
- Also removed obsolete tests
We've been using burst version for a bit, and with current fixes it balooned to too many lines of code
Tests: ran unit tests
Bugfix: apply same neighbour occlusion fix to jobs
Perf tests of 100k paths show degradation (serial +25%, parallel +52%), but perf tests for 10k baseplayer occlusion show negligeble impact (serial -9%, parallel +1%).
Tests: occlusion unit tests pass
Bugfix: reimplement occlusion neighbour logic in non-burst flow
- Added anothed optim todo now that we have axis-count-specific neighbour checks
This partially fixes the failing test (it still fails since now it trips up in burst version)
Tests: ran unit tests
Update: Re-enable sorted pair occlusiuon visibility caching
Tests: none, I know it's borked
Merge: from baseplayer_serverupdateparallel
Update: move serial server occlusion update code to the relevant partial class file
- Use ReadOnly interface for lists to avoid read-write access violations
Tests: compiles in editor
Optim: avoid player's world transform querying and use cached pos instead
Hoping it'll help reduce the 50% self time of ServerUpdateParallel on 200pop server
Tests: none, trivial change
Optim: OcclusionCache store sorted pairs
- Don't store SubGrids in the cache, just their indices - saves a bit of mem
Allows to double the effective capacity of the cache
Tests: 2 player session in editor with occlusion behind the hill
Clean: Move all of the player server occlusion logic to it's own file
- Removed now resolved TODOs
Now that it has both task and serial modes of operation, it takes too much space in server partition file.
Tests: compiles in CLIENT+SERVER editor
Update: use ConcurrentDictionary for BasePlayer.lastPlayerVisibility
Trying the simplest approach first, lets see how it scales on release pop.
Tests: 2 player local session with occlusion culling de-/spawning player
Update: early out from running occlusion checks if no players to process
Tests: none, trivial change
Bugfix: use cached network time of one player to avoid worker thread calls to script api
Tests: none, one more to fix
Clean: wrap Task.Wait into a named lambda
This will make it appear in server snapshots
Tests: none, trivial change
Update: main thread now participates in occlusion task processing
Tests: none, as I need to adapt more code to make it friendly to running on workers
Update: work-in-progress task splitting for server's occlusion checks
Rewrote the high level code to be able to run PlayerFound/Lost in batches on worker threads - need to confirm if it's legal
Tests: none
Update: reimplement how occlusion treats overrides
- this is a reimplementation of
118512
Allows to further simplify OcclusionLineOfSight code - enables removal of OcclusionPlayerFound/Lost
Tests: on craggy with 2 players, ran behind the hill, disappeared, turned on occlusion override - player appeared
Update: plug in batched occlusion logic
- fix early-disposed container
Need to figure out how to factor out the OnPlayerFound/Lost, but getting close
Tests: 2p on craggy in editor - walked behind the mountain and disappeared
Update: plug in new batched server occlusion job
Tests: none, need to hook up the calling code
Update: extract algorithm from ServerOcclusionJobs.CalculatePathBetweenGridsJob
Tests: inspected asssembly
Update: batched OcclusionLineOfsight skeleton
Tests: none, not engaged yet
Update: refactor server occlusion job to take out grid definition
Prep for adding a batch version
Tests: on craggy in editor with 2 players, ran behind the hill and got despawned
Update: refactor occlusion loop to be friendly for batching
Need to simplify BasePlayer.OcclusionLineOfSight before I can start working on batched job
Tests: none, no functional changes for now
UPdate: move serverocclusion caching logic a level higher
Goal is to get rid of OcclusionPlayerFound/Lost in the query, so this is first baby step
Tests: none, trivial change