# DISPATCH — worker_cocos_client

## Identity
- Role: Cocos Creator 3.x Client Core & Systems Worker
- Subagent Type: teamwork_preview_worker
- Working Directory: c:\Projects\FreeExile\.agents\teamwork\worker_cocos_client
- Parent: orchestrator_20

## Mission
Implement Milestones M1, M2, M4, M5, and M6: Complete Cocos Creator 3.x TypeScript Client at `client/cocos/`, including kinematics, animation FSM, combat, scenes (Sanctuary & Dungeon), Boss Gate, UI HUD, reactive 9-language i18n, web preview pipeline, and browser automation test runner.

## Authoritative Inputs
- Read ORIGINAL_REQUEST.md: `c:\Projects\FreeExile\.agents\teamwork\ORIGINAL_REQUEST.md` (specifically ## 2026-10-03T07:43:50Z)
- Read PROJECT.md: `c:\Projects\FreeExile\.agents\teamwork\orchestrator_20\PROJECT.md`
- Read survey reports:
  * `c:\Projects\FreeExile\.agents\teamwork\explorer_survey_1\survey_client.md`
  * `c:\Projects\FreeExile\.agents\teamwork\explorer_survey_2\survey_server_proto.md`
  * `c:\Projects\FreeExile\.agents\teamwork\explorer_survey_3\survey_build_and_qa.md`

## Scope Boundaries & Exclusive Write Ownership
- You exclusively own:
  * `client/cocos/` (all project structure, TypeScript source scripts, assets, shaders, preview-template) EXCEPT `assets/scripts/proto/bundle.*` which is provided by `worker_proto_server`.
  * `tools/qa/run_cocos_human_journey.py` (Playwright automation script for the 8-step journey)
- DO NOT touch files owned by `worker_proto_server` or `test_writer_e2e`.

## Mandatory Integrity Warning
DO NOT CHEAT. All implementations must be genuine. DO NOT hardcode test results, create dummy/facade implementations, or circumvent the intended task. A teamwork_preview_auditor will independently verify your work. Integrity violations WILL be detected and your work WILL be rejected.

## Native Lifecycle Hook Protocol
If any edit is blocked by Native Impact Guard (`[BLAST RADIUS BLOCKED]`), run:
`python tools/analysis/blast_radius.py --target <path> --ack`
to acknowledge dependencies and unlock editing for 30 minutes.

## Technical Architecture to Implement at `client/cocos/`
1. Project & Build Configuration (M1):
   - `package.json`, `tsconfig.json`, `project.json`, `settings/v2/packages/project.json`.
   - Asset directories: `assets/scripts/`, `assets/resources/`, `assets/shaders/`, `preview-template/`.
   - Shaders: `sprite_pbr.effect` with Normal mapping and emissive channels.
2. Kinematics, Camera & Animations (M2):
   - 2.5D Isometric projection (2:1 ratio, 64x32 tile coordinates): screenToWorld & worldToScreen.
   - Player kinematics with Zero-Residual Momentum: instant digital halt in frame 0 when input mag <= 0.05. No residual drift!
   - 2-axis Wall-Sliding along obstacles.
   - Zero-heap A* pathfinder.
   - Camera controller with exponential damping lerp and dynamic zoom.
   - Animation FSM (Idle, Run, Attack, Hurt, Dodge) with motion-matching, 8 directions, and bottom-center pivot [0.5, 0.90].
3. Networking & Reconciliation (M3 Integration):
   - `NetworkManager.ts`: WebSocket connection to `ws://127.0.0.1:8080`, binary 2-byte opcode framing matching server specs.
   - Entity interpolation with exponential damping (0.25).
4. Scenes, Combat & Boss Gate (M4):
   - Sanctuary (`zone_boundless_sanctuary`): 100% monster-free safe haven, 4 encampment NPCs (Scavenger, Blacksmith, Shaman, Tracker) with interaction radius <= 2.5m, Y-sorting (`depth = wx + wy`).
   - Target Dummy at (6.0, -3.0): DPS telemetry, poise break, combo testing.
   - Combat feel: 3-step combo cycle (Q/W/E/Space), 0.25s i-frame dodge roll, hit-stop micro-freeze (33-66ms), telegraph decals with poise-break, damage numbers.
   - Dungeon (`zone_tang_kiem_nhai`): Waypoint safe radius (8.0m), Fog of War (8-tile reveal), monster packs.
   - Boss Gate controller: 3-pack encounter threshold, runic seal ring dissolution, Strand Executioner boss (HP 18,500), loot fountain with rarity beams.
5. UI HUD, Inventory & Reactive i18n (M5):
   - Dual liquid orbs (Life/Mana) with wave crests.
   - Minimap (120x80) synchronized with zone Fog of War.
   - 40-slot backpack inventory with item tooltips and rarity borders.
   - Character creation modal with `[🎲 Tên Ngẫu Nhiên]` randomizer (6 archetypes, 12 Vietnamese names).
   - Reactive 9-language i18n (`vi`, `en`, `zh`, `ja`, `ko`, `th`, `de`, `ru`, `es`) in-place without page reload.
6. Web Preview Pipeline & Automated Runner (M6):
   - Standalone web preview harness in `preview-template/` or `web-preview/` runnable via local HTTP server on port 8088/7456.
   - TypeScript build verification (e.g. `tsc --noEmit`).
   - Playwright test runner `tools/qa/run_cocos_human_journey.py` to automate the 8-step journey on a real browser, capturing screenshots and logs.

## Deliverables
- Fully working, type-safe Cocos Creator TypeScript client at `client/cocos/`.
- TypeScript build verification passing with zero errors.
- Working web preview pipeline and Playwright runner.
- Document build and verification commands in `handoff.md`.


## 2026-10-03T08:04:37Z
You are worker_cocos_client. Working directory is c:\Projects\FreeExile\.agents\teamwork\worker_cocos_client. Read your DISPATCH.md at c:\Projects\FreeExile\.agents\teamwork\worker_cocos_client\DISPATCH.md, ORIGINAL_REQUEST.md at c:\Projects\FreeExile\.agents\teamwork\ORIGINAL_REQUEST.md, PROJECT.md at c:\Projects\FreeExile\.agents\teamwork\orchestrator_20\PROJECT.md, and the 3 survey reports in .agents/teamwork/explorer_survey_*. Implement the complete Cocos Creator 3.x TypeScript Client at client/cocos/ (kinematics, zero-residual momentum, FSM animations, combat, Sanctuary & Dungeon scenes, Boss Gate, HUD, reactive 9-language i18n, web preview pipeline, and tools/qa/run_cocos_human_journey.py). Run build type-check, verify web preview, write handoff.md, and notify parent.
