refactor(client): decompose GameScreen into focused components #119

Merged
marco merged 1 commit from refactor/gamescreen-decompose into main 2026-07-20 22:59:34 +02:00
Owner

What

GameScreen had grown to ~950 lines carrying six concerns at once (connection lifecycle, the server-message switch, client world state + entity lookups, input handling, the draw passes, coordinate helpers) — the same god-class shape World.cs shed in #54.

Split into focused collaborators, mirroring the World facade rule:

Component Role
ClientWorld visible entities, inventory, interaction state, transient VFX; answers what/where is entity X
ServerMessageDispatcher applies a server message to ClientWorld (wire → state + VFX)
GameInputController per-frame input → client intents via a send callback
WorldRenderer ground / depth-sorted / overlay draw passes + owns GridRenderer
ScreenProjection shared camera-relative screen↔tile math (over IsoProjection)
Palette shared VFX/overlay colour constants

GameScreen is now a ~130-line coordinator (was 946) that owns the connection and wires the components.

Also adds the client mirror of the World HARD GATE to CLAUDE.md: a Screen is a thin coordinator, not a god-class.

Not in scope

Behaviour-preserving refactor: no protocol change, no gameplay change. No ProtocolVersion bump.

Definition of Done

  • GameScreen.cs contains no server-message switch, no per-id entity lookup, and no draw pass — only lifecycle + wiring + delegation (verifiable by reading the file: ~130 lines).
  • Whole solution builds, zero warnings; dotnet test green (324 tests).
  • CLAUDE.md states the Screen-is-a-thin-coordinator HARD GATE.
  • Manual smoke test (just dev): log in, walk (right-drag), attack a creature, cast a spell, drag a ground item onto the bag, open bag/paperdoll — all behave exactly as on main.
## What `GameScreen` had grown to ~950 lines carrying six concerns at once (connection lifecycle, the server-message `switch`, client world state + entity lookups, input handling, the draw passes, coordinate helpers) — the same god-class shape `World.cs` shed in #54. Split into focused collaborators, mirroring the `World` facade rule: | Component | Role | |---|---| | `ClientWorld` | visible entities, inventory, interaction state, transient VFX; answers *what/where is entity X* | | `ServerMessageDispatcher` | applies a server message to `ClientWorld` (wire → state + VFX) | | `GameInputController` | per-frame input → client intents via a `send` callback | | `WorldRenderer` | ground / depth-sorted / overlay draw passes + owns `GridRenderer` | | `ScreenProjection` | shared camera-relative screen↔tile math (over `IsoProjection`) | | `Palette` | shared VFX/overlay colour constants | `GameScreen` is now a **~130-line coordinator** (was 946) that owns the connection and wires the components. Also adds the **client mirror of the `World` HARD GATE** to `CLAUDE.md`: a `Screen` is a thin coordinator, not a god-class. ## Not in scope Behaviour-preserving refactor: **no protocol change, no gameplay change**. No `ProtocolVersion` bump. ## Definition of Done - [x] `GameScreen.cs` contains no server-message `switch`, no per-id entity lookup, and no draw pass — only lifecycle + wiring + delegation (verifiable by reading the file: ~130 lines). - [x] Whole solution builds, zero warnings; `dotnet test` green (324 tests). - [x] `CLAUDE.md` states the Screen-is-a-thin-coordinator HARD GATE. - [ ] **Manual smoke test** (`just dev`): log in, walk (right-drag), attack a creature, cast a spell, drag a ground item onto the bag, open bag/paperdoll — all behave exactly as on `main`.
feat: ground items show stack sprite by amount; single-click reads, double-click picks up
All checks were successful
ci / Lint & Test (pull_request) Successful in 1m48s
452a457511
Merge branch 'main' into feat/backpack-stacking
All checks were successful
ci / Lint & Test (pull_request) Successful in 1m29s
c32adf539e
# Conflicts:
#	client/IsoMmo.Client/assets/assets.isoa
#	src/IsoMmo.GameServer/Gameplay/Items/BaseItem.cs
#	src/IsoMmo.GameServer/Gameplay/Items/Item.cs
#	src/IsoMmo.GameServer/Gameplay/Items/ItemCatalog.cs
#	src/IsoMmo.GameServer/Gameplay/Items/OwnedItemView.cs
#	src/IsoMmo.Shared/Protocol/ProtocolVersion.cs
feat(client): pick up ground items by dragging them onto the backpack
All checks were successful
ci / Lint & Test (pull_request) Successful in 1m35s
38072f5bf2
Replace the single-click-read / double-click-pickup and the E / G quick-drop
shortcuts with a single drag gesture: grab a ground item with the mouse, drop it
on the backpack panel to pick it up (the server still validates range). Coins are
not equippable, so the paperdoll is not a drop target.
marco force-pushed refactor/gamescreen-decompose from f9ff0088b2
All checks were successful
ci / Lint & Test (pull_request) Successful in 1m39s
to 70a98e74a9
All checks were successful
ci / Lint & Test (pull_request) Successful in 1m32s
2026-07-20 22:57:10 +02:00
Compare
marco merged commit cb9d7b53cc into main 2026-07-20 22:59:34 +02:00
marco deleted branch refactor/gamescreen-decompose 2026-07-20 22:59:34 +02:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
marco/IsoMmo!119
No description provided.