branchrust_reboot/main/parellel_validatemovecancel
197 Commits over 59 Days - 0.14cph!
Update: Use GetIgnoreIndirect(vec3, vec3, ...) to further simplify code
As a bonus this avoids a bit of data repacking and NativeArray creation - there's more to come
Tests: ran unit tests
Update: use WaterTestFromVolumesIndirect to simplify code
This could be a small optimization, since we have to move less data around, but not focusing on that - just trying to reduce complexity.
Tests: ran unit tests
Tests: TestWaterInfosConsistency now generates fake WaterVolumes
Need this since I'm starting to modify the "volumes" path as well.
Tests: ran the unit tests
Update: replacing a bunch of GetWaterInfos internal BufferLists with NativeArrays
Preparing to replace more of managed logic with burst jobs
Tests: Ran unit tests
Optim: replace height fetching with a burst job
Tests: unit tests
Optim: replace initialization with with a burst job
Tests: ran unit tests
Update: replace Spans with NativeArray in WaterLevel.GetWaterInfos
Will allow to pursue using burst jobs internally.
Tests: tests passed
Update: leaving an optim todo idea comment
Tests: not applicable
Update: sprinkle some profiling scopes
Tests: ran unit tests
Optim: use persistent allocs in GetWaterLevels
- I need to properly clean those up at server shutdown, but I'll solve that later
1k waves perf test shows ~100micros savings and no allocs - 1.45ms vs old 1.55ms. This is final optim in the area for now, making us ~80% faster than vanilla managed code(8.6ms).
Tests: ran unit tests
Optim: remove last managed loop that picks between dynamic waves and static water
1k test with waves shaves off ~0.25ms - 1.55ms vs previous 1.8ms
Tests: ran unit tests
Optim: gather coarse distances to shore via indirect batch
1k waves perf test shows another ~0.5ms shaved - from 2.3ms to 1.8ms
Tests: ran unit tests
Optim: grab TerrainHeights via indirect batch
1k waves perf test used to take 3ms, now 2.3ms
Tests: ran unit tests
Update: gathering OceanSim's water heights in indirect way
- Also fixed the OceanSim's GetHeightsJobIndirect job as it works on world positions, not uvs
This allows me to convert the rest of the logic to Burst jobs.
Tests: ran unit tests
Update: Bunch of utility Burst jobs for WaterLevel.GetWaterLevels outstanding jobification
Tests: none, they are not plugged in
Update: Use NativeArray for TerrainTexturing.ShoreVector storage of distances and vectors
- Had to add an editor-only safety check for WaterCamera for a super rare exception
Tests: Played procgen and Craggy in editor. Forced a bunch of domain reloads to validate WaterCamera doesn't break anymore
Update: perf tests for WaterInfo/-s
For 1k sample points - batch version is 4(no waves)/3(with waves) times faster than serial
Tests: not applicable
Update: addding perf tests to GetWaterLevel/-s
- Doesn't have cases that have water volumes, so slowest path not stressed in both cases
On 1k locations batch version is 10x faster than serial(130micros vs 1.18ms) with no waves, with waves - 3x faster(3ms vs 9ms)
Tests: not applicable
Optim: replacing GetWaterLevels hot path with burst jobs
- Converted some internal NativeArrays to persistent, lazy growing ones to reduce allocation overhead
On a 25 player case shows a 25% improvement/5micros, though the sample size is too small(not enough players to check). I need a good way to test this at larger scales, or these 5min waiting times will murder me.
Tests: ran unit tests, ran staging demo multiple times, water checks counters in the expected range.
Bugfix: properly access count from CoarseQueryGridBoundsJobIndirect
Tests: ran unit tests
Merge: from erosion
Bringing across TerrainMap NativeArray conversion that I need for my batch checks
Tests: reran TerrainMap tests
Merge: from main
Aligning with erosion branch parent CL
Tests: none, no conflicts
Optim: skip issuing 0-length WaterCollision.GetIgnore jobs
Tests: ran unit tests
Optim: make TerrainCollision.GetIgnore and WaterCollision.GetIgnore use indirect Burst jobs
- Also added a bunch of optim TODOs
Starting to build up an indirect collection of methods. Next up will convert related GamePhysics calls
Tests: ran unit tests - they passed. Played back staging demo multiple times with analyzedemo - got comparable in-water counts
New: add WaterStateProcessor for full server demo analysis
- Also redid ViolationProcessor to avoid leaking internal implementation to other files
Tracks how many players across all server frames were in water - using it to track consistency of water checks while modifying internals
Tests: played back staging demo - got consistent-enough results
Merge: from main
Tests: none, no conflicts
Bugfix: Use valid index in WaterTestFromVolumes
Tests: detected during staging demo playback with useparallelupdatejobs - reran the demo, no more NREs
Merge: from main
Tests: none, no conflicts
Bugfix: Initialize WaterSystem coarse grid on clients
- Also make it safe for scenes that don't have a water setup (like playground)
Tests: tested with a separate client connecting to server - saw that Client was initializing everything correctly in the right order
Bugfix: ensure WaterCollision grid is setup with right terrain dimensions
Tests: In editor, started on craggy - size matched. Started on procgen - matched. Played demo - matched. In all cases validated initialization order to confirm no colliders/volumes were added too early. Exported PNG of the grid.
Bugfix: FullServerDemos - transient entity recording fixes
- Use DemoCount instead of ChunkIndex when determing to send snapshots - ChunkIndices reset, so they can rarely overlap for an entity and cause it to not send a snapshot
- Reset counter on prefab pooling - previously it could cause skipping of transient entity snapshotting
Tests: recorded a bunch of demos in editor
Bugfix: ServerDemoPlayer - skip the auth flow when playing the demo
- also index packet logging messages - makes it easier to sort out order of things in editor logs
Seems the simpler thing to do for now.
Tests: played back staging demo - much less error spam
Update: ServerDemoPlayer - add Ready message logging
Tests: none, trivial change
Update: ServerDemoPlayer - log more message types
Tests: ran demo from staging server
Update: ServerDemoPlayer - switch to control error reporting
Tried the demo from staging, the error spam is too much and not super helpful, so adding a toggle to disable it.
Tests: Played back the staging demo
Optim: Avoid handling null cases in a batch with only non-null values
- Also updated the test to spawn entities, since now it's a requirement for the func.
This removes the need to juggle data to setup batch operations. Should save a bit of time.
Tests: Ran the updated unit tests
▄▇▅▆▇▊: ▇▆▆▊▉▍ ▄▋ ▊▉▆▇▅▉▋▇▉▄▅▋█▉▆ ▋▇▆▍█ ▅▊ ▅▅▋▌▅▅▄▍▄▆▍█▅▆▋█▇▉▆▋ ▌▅▄▊ ▅▌▍▉▆▇▍▊▉▄▇▄
▉▆▇▊▆: ▉▄▌▌▄▇ ▍▄▌▌ ▇ ▅▇▋▄ ▅▅▊▇ ▅▉▋▊▇▇▌▅▌▋▌▄▅▊▉▆▄▆▋ ▅█▄ █▇ █
Merge: from main
Tests: none, no conflicts
Bugfix: CollectionUtil.SortInplace now correctly sorts
- Also renamed these utils as previous names were confusing
Tests: ran the old + new unit tests - all pass
Update: Adding unit tests for CollectionUtil
Discovered that my SortInplace is borked, so I'll fix it in the next update.
Tests: ran the new unit tests
Update: consolidate various scatter code used in batched WaterLevel and GamePhysics checks
Will cover them with tests just to be extra safe.
Tests: ran WaterLevel and GamePhysics unit tests
Update: Name a couple magic constants
Tests: none, trivial change
Clean: rogue newline
Tests: trivial change
Update: TerrainCollision.GetIgnore(Span...) now uses the ignore grid broadphase
Tests: ran new unit tests that go through this path
Update: new unit tests for GamePhysics.HandleIgnoreCollisions
- Also removed an unnecessary branch
Tests: ran the new unit tests
Merge: from main
Tests: none, no conflicts
Merge: from main
Tests: none, no conflicts
Merge: from main
Tests: none
Clean: ServerDemo - fix up names of entities that get reported via errors
Tests: played back procgen demo
Bugfix: ServerDemoPlayer - invert the error reporting logic for DestroyEntity
Previously, we considered it an error if we couldn't find an entity that demo stream tried to destroy. But, if the server behaves correctly, then it should be already destroyed - so now we report an error when we do find an entity.
Tests: played back the complex demo from procgen - errors still present, but harmless