Skip to content

Orchestrator movement along the assembly line #24

Description

@williamthorsen

Parent: #22
Depends on: #23

Description

The orchestrator agent currently snaps to its target position when the run status changes (via the diff system detecting stationIndex/level changes). This ticket adds animated walk transitions so the orchestrator walks left-to-right along level 0 between stations as the run progresses and transitions between levels at the review area via ladders (vertical teleport).

This builds on the 2D layout MVP (#23), which is already merged.

Current behavior

  • run-to-scene.ts mapper computes the orchestrator's target position from CanonicalRunStatus (rightmost active phase, always level: 0)
  • agent-differ.ts detects when stationIndex, stackOffset, or level changes → categorizes as "moved"
  • FactoryScene.updateAgents() calls actor.walkTo(newPos) for moved agents — straight-line movement
  • AgentActor.walkTo() uses Excalibur's moveTo() at WALK_SPEED = 100; if called while already walking, silently returns (no queue, no cancel)
  • Orchestrator animation state is always 'working' during in-progress runs

Design decisions

  1. Orchestrator level during review: Goes to the highest reviewer level (reviewerCount - 1) to "oversee from top." Deterministic from reviewer count.

  2. Concurrent walks: Cancel-and-restart — cancel current walk via Excalibur's clearActions(), start new walk from the actor's current position toward the new target. Avoids stale intermediate destinations from rapid status updates.

  3. Architecture: Add walkPath(waypoints) to AgentActor with a generation counter for safe async cancellation. Path computation as a pure function in the layout module (computeWalkPath), using ladder geometry from LayoutResult.

  4. Orchestrator animation: Change from 'working' to 'idle' — the orchestrator oversees, it doesn't do work. Walking animation is handled internally by walkPath. Will be replaced by 'resting' in Phase 4.

Acceptance criteria

Must have

  • Orchestrator walks from station to station along level 0 when the active phase changes
  • Walking animation plays during horizontal movement
  • Orchestrator transitions between levels at the review area (vertical teleport is acceptable)
  • Movement is status-driven: triggered by CanonicalRunStatus changes, not scripted
  • If the page loads mid-run, orchestrator snaps to the correct position (no animation replay)
  • Concurrent walk requests are handled gracefully (cancel-and-restart)

Should have

  • Orchestrator pauses briefly at a station before walking to the next
  • Walking to upper-floor reviewers follows a logical path: horizontal to ladder, vertical, horizontal to station

Nice to have

  • Smooth deceleration when arriving at a station

Files

File Action
packages/factory/src/client/game/mappers/run-to-scene.ts Modify
packages/factory/src/client/game/layout/walk-path.ts Create
packages/factory/src/client/game/actors/AgentActor.ts Modify
packages/factory/src/client/game/scenes/FactoryScene.ts Modify
packages/factory/src/client/game/state/agent-state-resolver.ts Modify
+ corresponding __tests__/ files for each Modify/Create

Metadata

Metadata

Labels

featureAdded or improved external functionalityscope:factory

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions