branchrust_reboot/main/item_poolingcancel
37 Commits over 30 Days - 0.05cph!
Merge: from main
Tests: editor build
Clean: remove CancelTask ReturnItems param
Param was always set to true.
Tests: Crafted to completion and with cancellation (voluntary + killing)
Update: rewrite the same bugfix a bit better
- More explicitly explained why it's needed
Tests: none, trivial change
Bugfix: Release items that we've moved from crafting tasks back to inventory.
Tests: Crafted low grade fuel with 4 fat in inventory, then killed self mid-craft and saved - no NRE
Update: GameSetup can load save with double-quotes
Makes it friendly with explorer's "copy as path" action.
Tests: loaded a procedural save
Merge: from main
Tests: none, trivial changes
Merge: from main
Tests: built all modes, tried to repro 2 previous known bugs - didn't happen.
Merge: from main
Tests: built all modes in editor
Merge: from main
Tests: none, no conflicts
Optim: Recycle a list when paying for placement
Tests: none, trivial change
Optim: Avoid transient allocations for GetReloadMenu
This is more like a janitorial fixup rather than anything significant. Not recycling GameMenu.Options list because it's a struct, and we don't have a good strategy of shrinking containers in the pool yet.
Tests: Changed ammo for AK via radial menu
Optim: Reduce allocations when running reloading logic on the server
- Added non-allocating singular IAmmoContainer.FindX methods
We've got a bunch of places where we are only interested in result but try to gather all.
Tests: Built all modes in editor. In local session, shot a couple mags with different ammo types. Explicitly switched ammo type via radial menu, and implicitly via reload-on-empty.
Update: Getting rid of allocating PlayerInventory.AllItems
- Previous AllItemsNoAlloc is now new GetAllItems
- Added PlayerInventory.Contains
Tests: none, trivial changes
Update: List<Item> now use Free instead of FreeUnmanaged.
- Amortized a couple consecutive push calls
Need to do the same for ItemContainer.
Tests: Built all modes in editor. No runtime tests as it's trivial changes.
Merge: from main
Tests: built all modes in editor
Merge: from main
Tests: built all modes in editor
Update: Disable ItemPooling on Client and make server on by default
- Controlling variable is no longer replicated to client.
Client-side item handling is very lax and would need substantial changes. I don't want to hold up serverside release to get the full package out, I'd rather relase it bit by bit (and less risk of volatility).
Tests: Did all tests with both enabled and disabled server-side Item pooling
- Built all modes in editor.
- Tried reproducing 2 original bugs - didn't work.
- Loaded up a save that used to lead to a bug - didn't happen.
- Tested in local 2p session on Craggy - could kill, loot, equip and see changes on characters.
- Logs enabled through entire process - client didn't try to explicitly cleanup items (since disabled, as intended).
- Validated that it's possible to launch with command line disabling item pooling.
- Validated that it's possible to override item pooling with executable args
Update: added ItemManager logging of Item's lifecycle
- level 1 reports creation, loading and removal
- level 2 reports scheduling for removal
Tests: ran locally in the editor, switched items, dropped gear, looted existing containers. Checked that we get logging related allocs, but they're small (and I can remove them a bit later)
Bugfix: Rcon no longer waits for first command to start broadcasting log messages
Tests: Connected to server via test RCon page - started seeing output immediately
New: RustLog utility - consistently formatted logs with conditional output
- Extracted from BaseMonoBehavior, with forwarding of it's logs to RustLog
- Added Item category
We have scenarios where we have categorized logs in cases where we don't have BaseMonoBehavior available(Items) - this fills that niche.
Tests: Built all modes in editor. Ran with Network logging enabled - saw expected output. RCon page was good.
Update: regenerated ItemManager.EnablePooling command
Forgot to do it in previous submit
Tests: none, trivial change
Update: ItemRemove now schedules self recycling on Client
- subject if ItemManager.EnablePooling is set or not
This can automatically handle cases where we have client-side WorldItem & ItemContainers storing client-side items(amortizes synchronization) - but needs code fixing for that.
Tests: Tested dropping items(with pooling disabled it's ok, with enabled it's borked), equipping armor(same) - will fix in next CLs
Merge: from main
Tests: Build Server mode in editor, all good
Clean: comment explaining Client-side exclusive ItemManager use
Tests: none, trivial change
Merge: from main
Tests: editor build for all modes(Server borked, but fix coming)
Update: ItemManager is available on the client
- Like server, ticks in the background and cleans up items
- when creating/loading items can optionally specify whether it's client-side or server-side item (checked in exclusive modes)
- Made EnablePooling a replicated var, it disables clientside effects
We have a bunch of client-side item allocations that we don't correctly clean up - this will help deal with that.
Tests: built all modes in editor
Bugfix: don't leak an item if creation request was invalid
Tests: none, trivial change
Bugfix: don't create and access a dangling Item when Pooling is enabled
- at the same time it also optimizes inventory processing by batching the update as a result of multiple equipment events.
Tests: Tested by loadinga a save that borked the inventory by spawning NPCs - passed. Also validated that in multiplayer, wearables update when the player sleeps if they got changed by a different player.
Update: adding a server "itemmanager.enablepooling" convar to control item pooling
- starts off by default
Item pooling is too unstable to not have a dynamic switch - already got bit 2 times by it. Who knows what other horrors are hiding out there.
Tests: enabled after loading craggy, gave an ak - saw an uptick in pool.print_memory telemetry. disabled, despawned ak - no changes in telemetry.
Bugfix: disabling Item pooling
This causes issues on the server which prevents playing.
Tests: loaded a save that consistently produced exceptions - not anymore.
Merge: from main
Tests: none
Merge: from main
Tests: none (no conflicts)
Bugfix: Don't throw when cancelling partially finished crafting queue work item
Tests: Got 2 stacks of 300wood, scheduled 2 single doors as a single crafting operation, cancelled after first door crafted - no exceptions
Bugfix: avoid sending consumed-0 telemetry events when crafting
Tests: Had a queue of 2 items with perfect resource allocation - hit breakpoint once on first item craft instead of twice as before
Merge: from main
Tests: none
Update: Bringing back Item pooling
- Added a couple extra fields that were missed
Still need to reproduce the NRE we encountered earlier.
Tests: built all modes in editor. Spawned an AK, put an ext-mag on it, threw away to despawn, spawned a new one - didn't have attachments
Merge: from main
Tests: default editor build