506 Commits over 123 Days - 0.17cph!
Clean: Fixing depr warnings in Scripts/Entity
- Deleted VehicleModuleSeating.EditorCopyIntoBaseVehicle - all prefabs had up-to-date seating (we can remove the field soon)
- Deleted not-referenced Casette.FailedNetworkFileRequest (been marked as "deleteme" for 3-4y)
- Converted more types to use IServerFileReceiver - Casette, Signage. Ran RPC codegen to clean up.
- More ParticleSystems module use
- More ClientRPC RpcTarget-overload usage
- BasePlayer - explicitly read/write u64s (was happening implicitly via obsolete api)
Tests: none, trivial changes
Clean: fixing depr warnings in Scripts/Util
- Part of AssetStorage clean added a warning when compression gets ignored (we only have 1 use case right now, Terrain normal maps)
- Remove TextureImporter obsolete field usage
- TextureImporter.linearTexture -> .sRGBTexture
- MeshRenderer.motionVectors -> .motionVectorGenerationMode
- More ParticleSystem module usage
98 warnings to go
Tests: None, trivial changes
Clean: fixed depr warnings in Assets/Prefabs
- RequestFileFromServer to use IServerFileReceiver overload + ran RPC codegen
- ClientPRCPlayer -> ClientRPC
- more using particle system modules directly
About 115 to go
Tests: checked bradley effects work, checked chainsaw effects work, checked photoframe drawing works
Clean: Fixing deprecation warnings in Content
Also did a drive-by on all the extra newlines
Tests: spawned a vehicle with the component, observed vfx in water
Clean: Fixed deprecation warnings in Third Party/Community package
Replaced obsolete RequestFileFromServer by implementing IServerFileReciever. Regenerated RPC codegen. Will need to update the public repo as well.
Tests: insufficient, booted up local session, but couldn't test the new API.
Clean: Fixing deprecated code in most of Third Party packages
- Removal of dead code dependent on SystemInfo.supportsImageEffects or SystemInfo.supportsRenderTextures
- Removal of MarkRestoreExpected calls
- Using ParticleSystem.MainModule to set multipliers
Tests: none, trivial changes
Clean: fixing deprecation warnings in Standard Assets
- Removed dead code around SystemInfo.supportsImageEffects
- Removed MarkRestoreExpected calls
- Use ParticleSystem's module to control multipliers
Tests: none, trivial changes
Clean: upgrade deprecated code in Plugins
- Replacing WWW with UnityWebRequest, also updated success checks to more generic versions
- Texture.Resize -> Texture.Reinitialize
- Mute deprecation warning when accessing a value (since we validate beforehand)
- EditorGUILayout.EnumMaskField -> EditorGUILayout.EnumFlagsField
Tests: Booted up local session - no new warnings/errors in logs, code took expected branches
Clean: Disable Obsolete warnings in TextMeshPro pkg
This is external package, so we should just ignore what happens in their pond.
Tests: none, trivial change
Update: Fixing deprecation warnings from obsolete Pool API use
Tests: none, trivial changes
Optim: Avoid unboxing in Pool.Free(ListDictionary)
Was reported by Clr Heap Allocation Analyzer and I missed it originally.
Tests: none, trivial change
Merge: from main
Tests: built all targets, ran around solo on CraggyIsland
Update: disabling ServerTests to not mislead that they are working
Tests: none, trivial change
Merge: from main
Tests: ran new unit tests - all green
Update: Refactoring code to not need Pool.FreeDynamic
Since there's no more users of Pool.FreeDynamic, removing it as well.
Tests: Ran CompanionServerTests - all green.
Clean: Makign tests available only in CLIENT+SERVER
Also adding assert messages to CompanionServerTests for slightly more clarity
Tests: built all targets in editor - pass. Ran all CompanionServer tests couple times - all green.
Bugfix: Tests now able to run after a play session
- ServerMgr now cleans up players on shutdown in editor
- Tests are able to temp overwrite TerrainTexturing
- Tests disable gameplay analytics
Tests: ran all tests multiple times - all green
Optim: Don't wait full timeout for CompanionServer if it's done
Tests now run 2.5s instead of 12s.
Tests: Ran all tests multiple times - all green
Update: Adding last tests to CompanionServerTests
One of them, TestNexusAuth, doesn't do deep testing since it requires setup of NexusServer, which is incompatible because of DontDestroyOnLoad.
Tests: Ran all unit tests multiple times - all green
Update: Avoiding multiple GameObject instatiation in CompanionServerTests
There's now one testDummy that can be used as a component storage. This allows to have proper "alive" components. This revealed a couple issues (late database cleanup leading to locks, not fully configured clan participation) which I've fixed.
Tests: reran all tests multiple times - all green
Update: Added Subscription-related tests to CompanionServerTests
2 more down, 2 to go.
Tests: ran all tests multiple times - all green
Update: Adding EntityInfo related tests to CompanionServerTests.cs
2 down, 4 to go.
Tests: ran all unit tests multiple times - all green
Update: Adding Camera-related tests to CompanionServerTests.cs
This adds 3 more (total 13, 6 to go). These tests don't setup an environment to validate the full flow, but they do prove that request handling is correct.
Tests: ran all tests multipel times - they pass.
Update: Adding Clat-related tests to CompanionServerTests
This adds 4 mote tests. Added test-related funcitonality to ClanManager to init/deinit.
Tests: ran new unit tests individually, together with rest, multiple times - all pass.
Update: Adding Team related tests to CompanionServerTests
This adds 4 new tests. Expanded RelationshipManager access for testing, also allowing skipping of sending updates on team changes (as it makes tracking responses harder). Lastly, removed an extra update send for player joining a team as it was already sent in MarkDirty.
Tests: ran new unit tests repeatedly, they pass
Bugfix: RelationshipManager.PlayerTeam implements IPooled
My new batch of tests revealed that PlayerTeam wasn't properly cleaned up when returned to the pool, causing test failures on repeated runs(teams still had members in them after disbanding).
Tests: ran new tests (submitted in next CL), they pass
Update: consolidating CompanionServerTests logic
Now that patterns are relatively clear we can simplify logic. This'll make adding the remaining 19 tests faster/easier.
Tests: ran new tests
New: Starting set of CompanionServerTests
A set of functional tests that validate operation of CompanionServer (Rust+). This only covers 3 request types out of 19, but proves that this should work in principle. Next up is adding the remaining tests and making it safe in regards to server-client modes.
Tests: Ran new unit tests - they pass.
New: Adding Server unit tests foundation
Sadly, they're not fully functional now - the client and server connect to each other, but the full client handshake doesn't happen. Will chase this up after I setup companion server tests (what I originally intended to test).
Tests: none, as I know it's borked
Update: Fixing all deprecated uses of Pool since merge from main
Tests: built all targets
Update: merge from main
Tests: built all targets
Update: Pool uses warnings instead of errors for deprecated API
Motivation: This will prevent causing errors for our modders/existing plugins and send a message that it needs to be updated. I'll remove these deprecated APIs next patch cycle.
- Also removed a couple TODO since they're either not viable for now or complete.
Tests: none
Update: Replacing all calls to Pool.GetList with Get<List<T>>
Now that we're cleaning up lists automatically when we call Free or FreeUnamnaged, GetList lost it's use. Replacement was done via regex + added using namepsace statements where missing. This affected ~740 cases.
Tests: Built all targets.
Update: Marking Pool.GetList as obsolete
- Also bringing back list clearing on GetList invokation - to avoid breaking mods suddenly
Tests: built all targets
Update: Changing ProtoBuff codegen to use Pool.Get<List<T>>
This eliminates 680 cases of GetList<T> use, which is about 40%.
- CodeGenerator built in debug conf with commit 7d37b927 (FreeList-Depr branch)
Tests: built all targets.
Update: Review Feedback - Part 3
Renaming FreeUnmanaged primary overload to FreeUnsafe to clearly indicate that it's an undesired API.
Tests: built all targets
Tests: Review Feedback - Part 2
This covers basic scnearios of Pool usage.
Tests: Ran the new unit tests - they pass.
Clean: Review Feedback - Part 1
- Make scopes explicit with brackets
- Get rid of System namespace prefix (as we declare that we use System's names)
- Renamed `deepFree` defaulted arg into `freeElements`
- FreeUnmanaged(MemoryStream) no longer sets Position anymore
- Commented the API
Tests: Built C+S target (as it's trivial build-only changes)
Update: Removing FreeDynamic from Pool
Reimplemented the 2 cases where it's used to work without losing information about the type (so we can use Free instead). This also gets rids of unnecessary allocations.
Tests: Built all targets. Tried to test runtime (2p multipalyer), got confirmation that the server initializes but nothing hits it. In next CL I'll push out a unit test for ServerMgr, since it looks to be possible.
Update: Making Pool.Free capable of "deep freeing"
Motivation: Since we're getting rid of custom "FreeList" calls, then we should also remove FreeListAndItems, the last custom func in the "Free" set.
- Collections-related Free overload now can deep-free - calling Free on all elements of a collection.
- Marked FreeListAndItems as obsolete (with error) and piped it over to Free overload
- Updated 4 callsites of FreeListAndItems to use Free(T, true) instead
Tests: built all targets.
Update: Further constraining Pool - Step 3
Now that all usecases of Pool's API have been redirected to new methods, I can further constrain and annotate the API.
- Further constrained all container-like Free overloads to only accept ref-types with default ctor and IPooled interface
- Marked FreeList<T> as obsolete (with errors) and piped it into FreeUnmanaged overload (this is dangerous/leaky, but I've updated all existing calls to Free/FreeList)
- Marked ClearList as obsolete (with errors) - also inlined it's logic at the only callsite in the project
- Removed Clear call from GetList, since now we always clear lists via overloads
- Removed checks from main Free overload
Tests: built all targets. No runtime tests. Ran around on CraggyIsland in 2 player multiplayer, did minor spawning of items, constructions, shooting, player damage.
Update: Replacing all cases of Pool.FreeList - non-controversial cases
This modifies the remaining(after previous 2 unsafe submissions) set of cases where we had FreeList(292 files) - they all either fall into FreeUnmanaged(don't implement IPooled) or Free(implements IPooled). The replacement has been done by constraining FreeList<T> with T : IPooled first, this revealed ~560 build errors which got fixed with FreeUnmanaged. Then all the remaining FreeLists that weren't producing an error should've been replaced with Free calls.
Tests: built all targets in Unity. Ran around on CraggyIsland in 2 player multiplayer (built a tiny house), checked bullet decals spawning/despawning properly.
Update: Migration to "unsafe" FreeUnmanaged - Interface Code
This CL contains all cases where we call FreeUnmanaged with T : interface - this is dangerous because we don't know whether T is IPooled or not. If/when in the future we make FreeUnmanaged to skip invoking OnPoolEnter, this will lead to leaks/bugs.
Tests: Built all targets.
Update: Migration to "unsafe" usage of FreeUnmanaged - Generic Code
These cases are part of generic code that either provides containers/algos for other parts of logic or part of currently-dead code. They're unsafe because if they start getting used with T : IPooled, then in the future if/when we change Unmanaged to not check IPooled it might leak/bug out.
Tests: Built all targets.
Update: New CodeGenerator for Pool.FreeUnmanaged<MemoryStream> change
* CodeGenerator built with a3cd77f3 from FreeList-Depr branch
* This replaces all uses of Pool.FreeMemoryStream in Rust.Data/generated/ProtocolBuffers.Serializer.cs
Tests: built all targets in editor.
Update: Updating ProtoBuf Codegen to use new Pool API
* Includes new debug CodeGenerator binaries(built from FreeList-Depr branch, commit 1874d134). RustProtoBuf will be merged to main once I get closer to completion of teh refactor.
* Generated new Rust.Data/generated/*.generated.cs files with no FreeList calls
Tests: build tests for all targets
Update: Constraining Pool.Free - Step 2
* Adding collection-related FreeUnmanaged overloads for all existing collection-related Free overloads
* Putting IPooled constraint on almost-all collection-related Free overloads (skipping List - that'll be next chonky CL)
* Changed StreamBuffer overload to be a FreeUnmanaged overload
Tests: built all targets in unity
New: Adding Facepunch.Tests assembly for unit testing Facepunch libs, with ListExtension tests
Motivation: when working on core libraries we gotta have confidence that we won't bork something somewhere by changing core algos&utils. With this test assembly, we have a common place to document behavior of Facepunch lib before we go modify it.
Added 64 test cases for ListExtension changes (I couldn't reliably confirm in 3p multiplayer session). Test assembly configured in lean fashion.
Tests: built all targets in editor. Ran all existing tests, including new ones being submitted. Observed ~10 failures in NavMesh and TextMeshPro, but new tests pass.
Optim: reimplementing List.Compare to use an inplace algorithm
Caused by my upcoming changes to Free<HashSet<T>> requiring IPooled(I could've worked around it, but it was better to optimize it). Although I didn't benchmark, this in theory is a straight win - 3 less loops, no need for extra pools, and also fixes a harmless-but-perf bug(remained set had more elements than expected).
Tests: Build for Client target. I also need to do runtime validation with a 3player multiplayer session - I ran out of time, will done once I'm back home.
Update: Adding Pool.FreeUnmanaged overload for MemoryStream
Since Free got changed to accept IPooled only, it allows us to delete a runtime check in the editor env.
Tests: build only in editor, all targets