2,785 Commits over 700 Days - 0.17cph!
Update(tests): add TestGetHeightsIndirect_UV_Overworld and TestGetHeightsIndirect_UV_DeepSea tests
Tests: ran all unit tests
Update: TerrainHeightMap - redirect all height and normal calcs to go via HeightMapData impl
- Renamed HeightMapData.GetHeight -> GetHeight01
Tests: all unit tests pass, perf tests results seem same
Update: fill in some missing overloads in TerrainHeightMap
- get rid of commented methods
Tests: ran unit tests
Clean: replace GetHeightsFastIndirect with GetHeightsIndirect
- also fix a bug with invalid indexing
- TerrainMap<T> now exposes internal src buffer as a ReadOnly view
Starting cleanup effort, rough path ahead
Tests: ran unit tests
Clean: remove Perf.TestGetHeightFastIndirectOld and related bits
Tests: none, trivial change
Update: switch GetHeightsFastJobIndirect to use HeightMapData.GetHeight instead of inlined logic
- removed extra 4 madds by using Fast's index calculation
It's slightly slower on 512x512 test (0.9ms -> 1ms) due to Clamp01 calls, but we can afford consistency with GetHeight - will allos us to promote "fast" as "normal" and deduplicate
Tests: ran perf tests, compared asm
Update: rewrite TerrainHeightMapJobs.GetHeightsFastJobIndirect to use HeightMapData
- temporarily added Perf.TestGetHeightFastIndirectOld for easier assembly comparison
Generates the same assembly, so same perf
Tests: ran perf tests
Update(tests): add perf tests for TerrainHeightMap GetHeight family
Surprisingly, the *Fast versions are faster even in burst jobs. I want to rip them out(too many dupes), so going to try to replicate the benefits to common family
Tests: ran all unit tests
Clean: redirect a couple calls via GetHeight01/GetNormal(..., NativeArray.ReadOnly)
Tests: none, trivial change
Bugfix: TerrainHeightMap.GetNormalsIndirect - reimplement using HeightMapData core
- also slightly refactored HeightMapCore height logic
Fixes it not knowing about deep sea
Tests: all TerrainHeightMap unit tests pass
Update(tests): add TestGetNormalsIndirect_Deferred
Conceptually it's same logic underneath, but routed through different code, so worth a unit test
Tests: ran new unit test - fails on deep sea indices as expected
Bugfix: TerrainHeightMap.GetNormal(float, float) now checks for deep sea
- added utility funcs that sample user provided NativeArray<short>.ReadOnly
- regenerated validation normals for unit tests from TestGetNormal
Tests: TestGetNormal passes, TestGetNormalsIndirect fails as expected
Bugfix: TerrainHeightMap.GetHeightsIndirect - rewrite using HeightMapData core
This fixes missing deep sea lookups
Tests: ran TestGetHeightsIndirect - passes
Update: refactor core of GetHeight logic into it's own struct
- updated GetHeights to use it
Tests: TestGetHeights passes
Bugfix: TerrainHeightMap.GetHeights - clamp to border when interpolating heightmap samples
Tests: TestGetHeights passes
Update(tests): add TerrainHeightMap unit tests that cover GetHeight + GetNormal and their variants
Tests: ran unit tests, some failures are unexpected
Update(tests): add support to generate test positions in deep sea bounds
- updated TestWaterLevelsConsistency to use those extra positions, but surprisingly the test passes
- documented everything(I think?) that's wrong with WaterLevel.GetWaterLevels
Tests: ran updated unit test
Merge: from servercacheplayerinfo_optim
- Optim: reduce the amount of state we recache every frame
- Bugfix: fix some state being out of date by half-a-frame
Tests: unit tests + playing on craggy
Update(tests): amend BatchWaterLevels and SerialWaterLevels to support variety of query counts
Existing 10k test is a bit unrealistic (even if shows nice improvement)
Tests: ran perf tests
Update: GetWaterFactors - fetch parent entity only once
- updated perf test to have 5% to spawn parented player
Tests: ran unit tests
Optim: GetWaterFactors - add overload that can use cached mountables states for active players
- amended perf tests to spawn players with 5% chance to be mounted
400 batched queries: 0.6ms -> 0.55ms (serial are 2.32ms)
Tests: ran unit tests
Optim: ServerCachePlayerInfo - move isMounted and mountables caching to point of modification instead of every frame
Tests: built a boat on craggy and steered the wheel
Update: ServerCachePlayerInfo - cache isMounted, mountable for player
Tests: built a bouat on Craggy and used the steering wheel
Update: use dirty indices for copy
Test: none, trivial change
Update: propagate PlayerServerStates down to Antihack methods
- updates unit tests for changed API
Tests: unit & perf tests, ran around craggy
Bugfix(tests): don't try to manage unit test specific PlayerStates, rely on internal static one (sadface)
- also fix ServerOcclusionGroup tests not fully cleaning up players
There's an architecture barrier that's hard to push through to support multiple PlayerStates, so keep it simple for now
Tests: ran a bunch of unit tests, no longer sporadically failing
Clean: refactor various player server states into one big struct
Allows us to shrink func signatures and automate state propagation when we add new arrays. Only cleaned up bare minimum of funcs to get things working, need to do more
Tests: ran all relevant-ish unit tests (discovered TestOverlapOBBsConsistency is failing, will fix separately), played on craggy
Optim: ServerCachePlayerInfo - don't cache isRunning
Time to clean up all the extra args everywhere, having 10 param funcs is no bueno
Tests: consistency tests
Optim: ServerCachePlayerInfo - don't cache onground and isflying
Tests: ran unit consistency tests
Bugfix: accidentally used ducked instead of ducking modelstate, whoops
Tests: ran consisntecy unit tests
Optim: ServerCachePlayerInfo - stop caching isDucking
Tests: AH consistency unit tests
Optim: ServerCachePlayerInfo - don't cache isOnLadder
Tests: ran AH consistency unit tests
Bugfix: missed a couple places where ModelState.Blocking is updated
Tests: none, trivial change
Clean: fix up formatting crimes in BasePlayer-SaveLoad.cs
Tests: none, trivial change
Update: duplicate ModelState.flags and ducking properties into their own arrays, keep them in sync with incoming model states
Will allow me to removed caching of 5 properties in ServerCachePlayerInfo
Tests: booted craggy
Optim: ServerCachePlayerInfo - don't cache IsCrawling, it can be deduced from PlayerFlags
Tests: ran speed consistency unit test, ran around craggy, crawled while wounded - all's gud
Clean: remove JobHandle IsValid extension
This was a workaround for a Unity issue that was fixed in 6.3.14f1
Tests: none, trivial change
Optim: ServerCachePlayerInfo - only recache positional state if position changed from last call
Tests: ran around on craggy, sawm, crouched. retried connecting couple times
Optim: ServerCachePlayerInfo - avoid transform access when recaching player center
Tests: none, trivial change
Bugfix: separate position-dependent and other player state caching
It was possible that for a couple frames cached player state would be incorrect
Tests: none
Merge: from server_player_refreshcolliders_optim (previously jobs3_...)
- Optim: avoid water queries when refreshing connected player colliders
Tests: On Craggy, ran around, sawm and crouched - could see gizmo size change
Optim: use cached swimming results instead of new water queries when refreshing player's collider
Tiny savings(~1 micro per player), but every bit helps
Tests: ran around craggy, went swimming, crouched - saw collider gizmo size change
Clean: refactor ConnectedPlayersUpdate into batched blocks
Makes it easier to see at a glance where our time is spent in profiling snapshots
Tests: ran around on craggy
Merge: from pool_mt
- Bugfix: avoid extensive spills/misses with new Pool
- Clean: UseMutexPool is now correctly showing 2 entries in console autocomplete
Tests: unit tests, booted into Playground and Procgen 2k worlds and checked print_memory
Clean: redefine UseMutexPool variable as separate ClientVar and ServerVar instead of merged ConsoleVar
- Codegen
Former doesn't show 2 options in console
Tests: booted into craggy and checked suggestions
Bugfix: add a fuzzy check to prevent Pool read-write head desync causing lots of misses+spills
Surprisingly, it's about 15-25% faster than before fix in MT scenarios, but expectedly slower by 10% in ST (still faster than og Pool)
https://files.facepunch.com/danielprihodko/1b1011b1/WyJ3SUYrMB.png
Tests: ran SpillageRunaway unit test 10 times, booted into Playground 4 times - no debug messages about misses/spills. botted 2k procgen world and checked print_memory
Update(tests): change spill tests assertions to permit writed head to run ahead of read head
Tests: ran unit tests
Update(tests): add a synthetic test to cause pool spill runaway
- moved other spillage tests to Unit namespace and merge into 1 test
Made it to fail consistently at 4 consume threads
Tests: ran tests