study: single-threaded command-queue tick (thin World, no lock) #54
Labels
No labels
alpha:wave-0
alpha:wave-1
alpha:wave-2
alpha:wave-3
area:assets
area:combat
area:ecology
area:infra
area:render
area:scripting
area:ui
area:world
enhancement
epic
migration
post-alpha
roadmap
tech-debt
type:bug
type:chore
type:design
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
marco/IsoMmo#54
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
World is now a pure lock+delegate facade (#49), but its surface is still broad — ~30 methods across every domain — because the single
_gatelock forces it to be the gateway for every operation. It reads like a god-class even though each method is thin.The deeper fix: connection handlers enqueue intents (as
TryEnqueueMovealready does); a single-threaded tick applies them via the systems. World becomes state + tick orchestration — no lock, no broad mutating facade.Why it is worth studying now: the spell system (its first real client) wants exactly this — server-paced word emission is enqueue-intent + process-at-tick. Doing it before/with the spell system avoids building the spell system against the current lock model and refactoring later.
Trade-offs to work through:
SystemMessage) become asynchronous — returned via the tick result / a message. Rework the handler flow.Definition of Done (for the study)
Study written:
docs/command-queue-study.md(PR above). Decision: adopt B (single-threaded simulation, ModernUO-style). Validated against ModernUO (single game thread, no world lock, packets processed on the game thread → immediate feedback). Migration via a single-threaded executor, phased so the suite stays green each step (Phase 1: executor foundation → route World access → move reads off connection threads → remove the lock). Combat under B: pipeline stays in a system, per-typeOnHitreaction hooks on the entity.Implemented and merged in #56 (main
28df348): single-threadedSimulationexecutor, tick moved onto the sim thread (WorldTick/SimulationHost), everyWorldaccess routed throughInvokeAsync, andWorld._gateremoved. World now holds no lock. Study conclusions realized.