Make tick smoothers multithreaded
Tick Smoothing: execution refactor (single-thread -> jobified)
This PR changes how the existing tick smoothing runs: from per-object, main-thread execution to a centralized jobified pipeline in TickSmoothingManager. The core smoothing idea remains the same; the implementation/dispatch model is different.
Key differences (before vs after)
-
Before: each
TickSmootherControllersubscribed toTimeManagerand ran smoothing on the main thread.
After: the controller onlyRegister/Unregisters; all event wiring (OnUpdate/OnPreTick/OnPostTick, RTT, prediction replay) and execution are handled inTickSmoothingManager. -
Before: per-object state lived in controller/smoother instances.
After: state is stored in the manager as indexed Native/SoA containers (masks likecanSmooth/useOwner/objectReconciling/..., realtime interpolation/multipliers, move-rates, snapshots, and a per-indexTickTransformPropertiesqueue). -
Multithreading approach: work is expressed as explicit job chains with
JobHandledependencies (no per-object main-thread loops).- Transform work uses
IJobParallelForTransformoverTransformAccessArray(_graphicalTaa,_targetTaa,_trackerTaa). - Non-transform work uses
IJobParallelForwith batching (ComputeBatchSizebased onJobsUtility.JobWorkerCount).
- Transform work uses
-
Dispatch pattern: “payload + executeMask”. Jobs populate payload arrays (move, discard, set rates, snap, teleport, enqueue/clear, replay modify), and subsequent jobs apply only entries where
executeMask != 0. -
Tick buffer: the per-object tick buffer is now job-friendly via
StripedRingQueue<TickTransformProperties>(one ring queue per index/stripe). Queue trimming (limits + required headroom over interpolation) is performed inDiscardExcessive...as part of job chains.
Phase breakdown (job chains)
-
OnPreTick- Update fast masks on main thread
PreTickMarkJob→ discard → teleport (and queue clear) →PreTickCaptureGraphicalJob→Complete()
-
OnPostTickCaptureLocalTargetJob→PostTickCaptureTrackerJob→PostTickJob(produces snap/enqueue payloads)- discard → snap → add/enqueue →
Complete()
-
OnUpdateUpdateJob(move payload) →MoveToTargetJob(moves graphical; may trigger set rates/multiplier/clear) →Complete()
-
RTT / prediction replay
- Separate job chains update realtime interpolation and perform
ModifyTransformPropertiesafter prediction replay.
- Separate job chains update realtime interpolation and perform
Additional changes
- Added
MovementSettings.UseLocalSpaceto select local/world space for position/rotation smoothing. - Updated
.asmdefdependencies for Jobs/Burst/Mathematics/Collections.