branchrust_reboot/main/baseplayer_vis_nrecancel
31 Commits over 30 Days - 0.04cph!
▉▋▆▅▆▇: ▊▊▇▌▄▍▋ ▊▇▄▍▋▇▄▄▆▇ ▍▊▍ ▍▅▄▍ ▍▄▇▌▇▌▇▋█▄▉ ▍▇▆▋ ▍▋▅█▋▋▋▇▊▊▆ █▇ █▇▇▉▊ ▇▍▄-▉▌▇█▊ ▅▆▆█▅▌▄
▅▋▅▋▊: ▆▅▆▊▊▆▅▇▄ ▇▅▋▍▇▍ ▇▊▇▍▌ ▍▅▊█ ▅▅▉▇ █▆▋▅▉▍▇▆, ▋▇▍▉▆ ▅▊▌▄, ▉▉▋▍▋██, ▆▍▊▅█▋▉▉▊▋, ▍▌▉▄▅▄▍▋ - ▊▇ ▇▇▊▌█ ▌█▉▊▌█▊▋ ▆▌ ▊▆▆ ▋▍▌█▍█▅▌▆'▍ ██▋, ▅▅ ▅▄▌▆ ▋▊ ▊▆▍▌
Update: Add a safety guard to DestroyOnClient to avoid destroying client's local player
Tests: 2p session on craggy (though there's no case in vanilla where this can happen)
Optim: pool SpectatorSubStrategy and SpectatedSubStrategy
Tests: 2p session on craggy with disconnects - checked pool.print_memory afterwards
Update: convert IsBeingSpectated utility
- Updated dependent code to use new GetSpectators instead of old nested children approach
Tests: spectated player on craggy that shot scientists - headshot sounds replicated correctly to the spectator
Clean: remove BaseEntity spectating support and fix up types/names of relevant code
This code was broken for multiple years, and couldn't think of a reason it could be useful, so simplifying.
Tests: spectated on craggy, cycled view modes
Update: when spectated player disconnects, switch spectators to a new target
- this also fixes a leak of spectated players list, since it gets cleared by above action
Tests: flew out, disconnected - spectator returned to self. Reconnected, started spectating joined player - all replicated.
Update: reimplement spectating to use ISubscriptionStrategy instead of secondary groups
- Done via SpectatorSubStrategy (takes subscriptions of target) and SpectatedSubStrategy (notifies when group changes)
- Removed old secondary group code and reverted relevant Network API changes
- Made Networkable.OnSubscriptionChange public
This also fixes the bug with previous version that it only saw "near" distance entities
Tests: Spectated player on craggy, flew around until island disappeared from rendering - no NREs. Got 2 things to improve, and I think it's done
Update: extract how we gather network group subscribers into a ISubscriberStrategy
- implemented a DefaultSubscriberStrategy
This CL doesn't have any logic change, it just reorganizes code so that we can start overwriting this(need it for spectating now and parallel processing in the future).
Tests: 2p on craggy - saw the island entities spawn in as well as the players replicate
Bugfix: spectators now subscribe to spectatees via secondary group
This prevents spectatee from being culled out by network grid onthe spectators end, leading to NREs. This is temporary solution, as it doesn't have the same network range as the primary group.
Tests: spectating a palyer on craggy, then flew around till the island was no longer visible
▋▇▅▋▍: ▅▍▌'▍ ▅▌▇ ▋▇ ▄▄█▉▅ ▌▍▌▇▌▅██▄▌▋▅▆▇▅▇▊▌▍▅▋█ █▆ ▌▄██▆▄▌▌▉▍
▅▌ ▌▍▆▊▉▊▍▍▆▍ ▊▄▊ ▍▇ ▆████▉ ▊▉▋▊▍▆▄▄ ▌▊ ▆▅▇█▋▉▇▉▄█, █▄ ▌██▌▆'▊ ▊▇▅▉ ▋▇▆█▉▍▉ █▍▍ ▇▇▇▌▇ ▉▊▊ ▅▌▇▍▄'▊ ▊▆▆▄▄▇▇ ▉▉▋█▄▆▆ ▄▇▍▊█ █▊█▅▉▉▋, ▍▍▆▆▅▋ ▆▊▋ ▆▋▉█▊ ▉▌▌▊
█▆▆█▊: ▌▌▋▉ ▉▍▆▅▊ ▉▆██▇▆▉ ▊▋ ▊ █▌ ▊█▅▌▌▌▊ █▅▆█ ▉▇▇██▆▋▊▉▄ - ▄▍▅▅'▅ █▊▅ ▌▉▊ ▍▋▅▇▉▊▊.
▋▋▋▇▄: █▄▌'▊ █▇▌ █▇ ▊▋▊▇ ▅▄▋▇▄▅▍▅▋▋▆▅█▊▉▅▊▉▅▊▋▊▌▍▄ ▊▄▋ ▋▆▌▉▊▊▉▋█▇ ▋▉█▍▊▇▉
▉ ▍▊▆▆▊ ▄▊▄▉ ▉▅▌ ▇█ ▅▆ ▇▉▍▋ ▉▋▅▋▊▇▌▉▅▌ ▍▉▇▉▊▇██▉▋ ▍▊▅▄▉▊▄ ▇█▅▉▅ ▇▌ ▄▆█▉▊▇▆▄▌▊ (▉▊ █▋▋ ▋▌ ▌▄▆▋▍ ▊▅▅▄ ▆▉ ▅▄▆▌▆▉██▍). ▍▌▆ ▉▍ ▋█ █▍▅▆▉▊ ▇▋▄▅▄▅ ▉▇▇▉▄▊▌▋▇▋ █▍ ▇▇▌▌▍▋▊▌▅▆, ▋▆ ▌▄▄ █▊▉▋▄ █▆▌▉▊▆ ▆▌▄▍.
▄▋▉▆▌: ▅▌█▋ ▇█▅▄▇ ▊▄▋▍▊█▅ ▌▍ ▇█▅▉▆▆▊ ▉▋▌▅ ▅▍▊▉ ▅▍▉▅ ▋█▉▇▅ - ▉▍ ▉▉▆▆▉▌▆▋▆▌ ▋▊▊▅▄. ▌▋▆ ▍▅▊█▅▋▊▌ ▄▄▉▋ ▅▍▍▆▋▅▆█▇ ▆▍▅█ ▋█▇▍▍▊▉▌▄ ▆█ ▇▄▇▉▉▋▌▅▆█ ▋▌▊ ▇█▍ ▊▆ ▍▊▆█▍█▇ ▇▌▄█▍ ▍▄▋▉▍▊ - ▋▋▌▊ █▌▍ ▄▍▊▊ ▊▉ ▋ ▍▉▄
Optim: cache spectated target
Turns out it's quieried very frequenly
Tests: 2p session on craggy with disconnects
Update: first version of spectate that doesn't require parenting to target player
Doing this to avoid weird bugs with nested players in other systems.
Tests: 2p session on craggy with spectating. Toggled camera modes and toggled invis. tried spectating after server occlusion culled other player. Noticed that nutrition, comfort info didn't replicate, map compas reacted to spectator's input - will fix those next
Bugfix: fix invis players not replicating positions & rotations
Tests: spectated invis player, didn't observe and animation glitches as the comment warned (tried rock, torch, ak)
Bugfix: don't destroy local player when spectating player going invisible
Fallout from the recent rewrite.
Tests: while being spectated, toggled invis a bunch of times - no NREs on the client. invis player doesn't replicate, though, will fix next.
▉█▊▋▊▋: █▍▌▇▇▊▋▉▇▆▋ ▋█▅▍▅.▋▅█▊▄ ▆▉▋▆▊█▌
- ▊▉▄▅▍▍█ ▌▉▍▌▊▊▍▇▍▇.█▊▅▉█▋▉▆▍▋▅█▄▄▋ ▅▌▌▌▆ ▉▋ ▉▊▅▊▋▇▌▄▅ - ▌▊█▌ ▄▇▆▆▌▉▌▄ ▆ ▆██▌ ▅█▌▄▉ ▋▋▋▅██▌▍▅█ ▍▉▆▌▉▆▋▌▉ ▊▄ ▊▊▋▆█ ▊▅▌▅▇▅▅▇▍▋
▅▍ ▌▋█▌▇█ ▄▊▍▊▌▊█ ▊▆ █▉▄▄▍▌▄▌▊▅▍▅▋█▍, ▍▌ ▅▌ ▄▋▅ ▅▇▆▊▊█▄ ▆▆ ▋▊▍▊▋▌▊▅▄▋ ▍▋▋▇▆▆▆▍ ▊▄█▊▊ █▆▇▊▋ <-> ▆▆▉▋█▌▆ ▉▌▋▆ ▄▅▍▋ ▆▋██▍. ▄███▇▆▋, ▅▄█ ██▅▍▌▌ ▆▆ ▇▌▅▋██▋▊▌█▌
█▊▌▌▋: ▊▌▋▄▇ ▅▄ ▄█▇▇▌▌▆ ▅▌ ▄▉▄▊▌▇▄▍▋▋, ▇▆▆▊▌▊▉█▆ ▄▄▅▌▅, ▋▅▆▄▄ ▍▋▉▇▄▇, ▅▋▆▌▇▌▌▇ ▊▋▋▋▌, ▉▋▆▇▄▅▋▍ ▊▍▌▋▅ - ▍▌▋▍▌▍▆▆▋▌ ▆▊▌▅ ▆▋▆ ▇▍█▇▉ ▇▊ █▉▆ ▇██▌█ ▅▅▌▍. ▉▋▍▌█▊▋▌▄▋ ▅▍ █▅█▉▌▇, ▌█▉ ▅▉ ▆ ▊▍▋▇ ▍▌█ - ▋▆▇▅█▇▅▍ ▊▋█▊▊█▇ ▌▇▍▆ ▉▌ ▇█ ██▆▋/▅▉▌█▌▅▆, █▊ ▅▍▍ ▆ ▋█▅ ▊▄▉▌▌▇▄█▇▋▇.
Bugfix: remove false-positive log for deferred player destroy
- remove unnecessary override
Discovered when spactating a player that constantly toggles invis. Doesn't fix the NRE itself, but further reduces false-positives. Still looking for the root cause
Tests: spectated a player constantly toggling invis
Bugfix: reduce error false-positives by ensuring bot IDs never overlap
- Permit random overlap once we exhaust MaxBotIdRange ids (which is old behavior) but emit an error
Because we always picked a random bot ID, it was possible that there'd be an overlap and it could confuse dependent systems (like my logging for the NRE). Hoping this reduces false-positive error logging.
Tests: in editor spawned a couple players and killed them, then monitored the ID queue with debugger
Merge: from main
Didn't refresh and missed the desired fixes
Update: move breadcrumbs a bit to get better callstack
- eliminated a false-positive
Tests: built standalone and connected to staging - no more error logs on connect to server
Update: convert error logs to error-once logs
The current changes mitigate the problem, which will allow peeps to play longer while we chase up what's going wrong.
Tests: none, trivial change
Update: adding more logging in an attempt to catch baseplayer NREs
Tests: 2p local session with spectating, disconnects
Clean: remove hacky testing code changes
Tests: editor compiles
Bugfix: potentially fix BasePlayer Vis NRE
- Added extra logs to catch other sources
- Refactored code to extract invariant checks
Not confident it'll actually solve it, if it does - can remove extra logs
Tests: using spec_loop command to force client to quickly spectate-then-stop in a loop. Tried both in editor and standalone builds - no issues(though I couldn't repro it originally this way anyway)
Update: testing code to try to trigger NREs. so far unsuccessful
Need to switch away from the task for a bit, will get back to it later today
Tests: 2p session, used spectate_loop to see what happens on 2nd player end - no NREs