1,688 Commits over 427 Days - 0.16cph!
Bugfix(editor): LoadMapFile - don't NRE when no scene is loaded and Server Occlusio Debug is open
Tests: used in editor
Merge: from server_occlusion_poppin
- Bugfix: fixes false-negative occlusion queries at the top of the hills
- Bugfix: fixes false-positive occlusion queries while looking through a hill
- Optim: sped up occlusion cache generation by 65%+ (4.5k from 134s -> 50s, can be faster with sufficient RAM)
- Editor: extended LoadMapFile with Server Occlusion debug tools
Tests: generated reported bug case and visualized and debug traced. Generated 6k, 4.5k, 2k and Craggy to confirm generation doesn't crash.
Buildfix: don't try to draw on the server-only build
Tests: editor compiles
Clean: code cleanup and custom_occlusion_query command
- ran generate code
Tests: compiles in editor
Optim: ServerOcclusion - try to avoid redundant HasCustomTag calls
Only saves 1s out of 30s run, but should scale better if we increase GridOffsets in the future.
Tests: generated and visualized
Optim: ServerOcclusion - split work in batches and process them serially
This reduces RAM pressure and possible paging, but still generates enough work for CPU (8mil subgrid cells per batch) to keep it busy. 4.7k generation times went from 50s -> 30s. Gonna clean up and merge.
Tests: generated and visualized
Optim: ServerOcclusion - jobify a bit more + use ScheduleParallel
4.7k map generation time goes from 69s -> 52s, stopping here. I'm likely getting diminishing returns on my PC due to heavy paging (generation takes 8GB+ ram) - will break it down next.
Tests: regenerated and visualized cache
Optim: ServerOcclusion - convert rest of narrowphase to Burst
- Replaced couple NativeList inside TestInsideTerrain with NativeArray to avoid 2GB limitation. Need a different solution for 7k maps
4.7k world generation time went from 130s -> 69s. Longest part is OcclusionIncludeRocks now (47s)
Tests: regenerated occlusion on 4.7k world, then visualized the grid
New: TestInsideTerrain - Burst version
- added unit test
Tests: ran unit test
Optim: ServerOcclusion - convert OcclusionIncludeRocks part of narrow phase to Burst
Total generation time went from 240s -> 130s. There's still 80s worth of TestInsideTerrain to rewrite
Tests: regenerated and visualzied in editor
New: AreInsideMesh - burst versions of IsInsideMesh
- added unit tests
Tests: ran unit tests
Bugfix: ServerOcclusion - don't ignore rocks that are close to the center of a subgrid cell
Tests: regenerated and visualized in editor - seemed sensible, no gaps observed
Optim: ServerOcclusion - rewrite cache generation broadphase to use parallel jobs
- Takes broadphase from 4.8s to 0.4s
This is tiny, since narrow-phase is the longest (on my 4.7k test map total time is ~240s). I'll do narrowphase next.
Tests: generated on a custom map and visualized the occlusion grid
Bugfix(editor): LoadMapFile - check for relevant state after domain reload to allow occlusion cache rebuild
Tests: triggered a couple reloads, no NREs when generating cache
New: added GamePhysics.CheckBounds that uses parallel Burst jobs
- added unit test to validate it
Tests: ran unit tests
Bugfix(editor): LoadMapFile - ensure terrain state is setup after domain reload when we generate server occlusion cache
Tests: ran generate server occlusion cache after code edits
Clean: missed newlines
Tests: none, trivial change
New(editor): LoadMapFile - added Server Occlusion Debug section
- refactored ServerOcclusion.DebugPath to not draw anything and just gather cells traced
Allows to debug occlusion bugs without having to enter play mode
Tests: used the tool in the editor, confirmed it compiles in SERVER+CLIENT and SERVER envs
Bugfix: ServerOcclusion - Save an extra grid chunk of data if our topside neighbor has terrain
- Added versioning to the occlusion cache file
This avoids the hollow terrain problem at the expense of a bit more memory use. Need to optim the impl - it doubles phys queries, so doubles generation time
Tests: used custom_occlusion_query and validated cases that previously incorrrectly passed
Debug: ServerOcclusion - for player_occlusion_subgrids, show cached info as well
This shows the reason why it's possible to see through terrain at specific angles - our "narrow passages" approach get into hollow terrain
Tests: used above to fly around and inspect the world
Debug: ServerOcclusion - add occlusion_blocked_cells and custom_occlusion_query editor convars
- occlusion_blocked_cells visualizes all blocked cells nearby
- custom_occlusion_query allows to setup a query via 2 gameobjects in the editor(in play mode)
- restored player_occlusion_subgrids
Tests: used the commands
Bugfix: ServerOcclusion - don't block visibility if there's one blocked string passage
This fixes edge-cases around hills, but there's still an issue of being able to see through hill - investigating
Tests: used player_occlusion_subgrids to test a bunch of paths
Debug: changed up player_occlusion_subgrids to render results from ServerOcclusion.Algorithm.Gather
- Gather now also marks if it used the neighbour passage or direct path or was blocked
- Gather respects various convars
Think I see what the problem is - my recent algo changes have a bug with neighbour passages. Investigating further
Tests: used above server var to visualize paths
Bugfix: LoadMapFile - assign Terrain layer to created terrain
Required for server occlusion
Tests: recreated the scene, now server occlusion cache generation works
Debug: ServerOcclusion - use manually controlled points to define a query in server-editor during playmode
- don't use cache, use phys queries directly (for what-ever reason cache is borked on this custom map, will investigate later)
Written as throwaway, will clean up at the end
Tests: visualized the path of one of the poppin cases
Redo of Update: LoadMapFile - allow to optionally spawn prefabs only within user provided bounds
This stop my pc from exploding
Tests: used to spawn a small area around bug location
Undo of previous CL - too many files snuck in
Update: LoadMapFile - allow to optionally spawn prefabs only within user provided bounds
This stop my pc from exploding
Tests: used to spawn a small area around bug location
Update: augment serverocclusiondebug command to draw the path of occlusion query
Written as throw-away code, will clean-up later
Tests: used the command to debug, works with disabled ddraw instancing, but the data it displays looks wrong - investigating
Optim: Get rid of allocs in BradleyAPC::DoPhysicsMove
Tests: loaded monument island with a launch site, verified bradley spans and rides around. in profiler DoPhysicsMove had 0 allocs
Optim: get rid of allocs in BuildingPrivlidge::IsAuthed
Tests: set up TC on Craggy, was able to auth/deauth
Bugfix: ensure entities are subscribed to switched-to group before we transition it's children to new group
- This resolves an issue when moving around fast with an item in hands, and it suddenly gets re-equipped
Caused by backup of player subscription queue, which can "desync" player - they'll move to a new group they're not yet subscribed to.
Tests: flew around at 100-speed noclip and monitored subscription queue size. despite backup, it no longer re-equipped my gun
Clean: comments, spans and names
Tests: none, trivial changes
Optim: UsePlayerUpdateJobs 2 - merge partially ordered chains of snapshots
- This reduces allocations (since we create less tasks), and should help with parallelization (reducing task scheduling overhead), but requires preprocess cost
Tests: on craggy with UsePlayerUpdateJbos 2, flew out of bounds and respawned(this causes 500+ entity snapshots to be sent) 10 times in a row - no exceptions, disconnects and all entities seemed to be present
Bugfix: fix a missing profile scope in FoliageGrid
Tests: used the profiler in editor, no more errors
Bugfix: UsePlayerUpdateJobs 2 - maintain partial ordering of snapshots when sending to player using tasks
- This fixes rare parenting desync that can manifest as a weapon attachment world model not hiding (or something much worse)
Need to optimize it by merging tasks, as this can create too many tasks for the server to process
Tests: flew around on Craggy with fast noclip - attachments didn't "duplicate". Shot animals, switched active items. Tested occlusion with 2p and geared guns
Optim: UsePlayerUpdateJobs - limit duplicate snapshot check to per-player only
Snapshot queues can grow up to 1k per player, so this should reduce the lookup overhead a smidge.
Tests: 2p session on Craggy with UsePlayerUpdateJobs 2
Merge: from baseplayer_serverupdateparallel
- Bugfix/Update: don't use parallel snapshot sending in UsePlayerUpdateJobs 1 (it's a level 2 feature)
Tests: used both modes in Craggy, confirmed things are working
Update: gate parallel snapshot queue behind UsePlayerUpdateJobs 2
All other parts have separation of no tasks under UsePlayerUpdateJobs 1 and tasks allowed under 2, but this slipped my net
Tests: used both in local session on Craggy
Merge: from baseplayer_serverupdateparallel
- Bugfix for frequently disabling UsePlayerUpdateJobs leading to player cache desync
Tests: wrote a unit test that confirms the bug and confirms the fix
Update: move OcclusionCache reset to always happen for disabled UsePlayerUpdateJobs
Don't think this fixes anything, but helps avoid invalid emergency shutdown fallout if it happens in the future.
Tests: none, trivial change
Bugfix: StableObjectCache - properly drop references when clearing
- PlayerCache emergency shutdown logic inspects internal buffer, which tripped up. Change also allows GC
- Added a unit test that validates Clear call.
Tests: Ran the new unit test - it was borked before the fix, gud afterwards
Merge: from baseplayer_serverupdateparallel
- Bugfix: PlayerCache can no longer desync when disabling UsePlayerUpdateJobs
- Optim: removed couple extra allocs in UsePlayerUpdateJobs 2
Tests: ran unit tests + bunch of disable-enable of UsePlayerUpdateJobs in local session
Bugfix: invalidate all non-null managed objects
- Previously it allowed for UnityNull objects to be skipped, leading to desync of StableObjectCache
Tests: ran PlayerCacheTests.StressTest - it now passes
Update: ammend PlayerCacheTests.StressTest to trigger cleanup causing desync with StableObjectCache
Tests: ran test, failing as expected