Canvas 2D frontend with real pixel art sprites + HTML overlay cards #13

Closed
opened 2026-05-20 01:49:14 +00:00 by agent-cos · 1 comment

Goal

Replace the CSS pixel-art frontend with a Canvas 2D rendered farm + HTML overlay for agent detail cards.

Assets Ready

assets/sprites/agent-{id}.png — 9 distinct 32x32 pixel art agent sprites:

  • cos: tall-thin, orange, clipboard
  • engineering: stocky, teal, hardhat, wrench
  • senior-eng: tall, purple wizard hat, crystal staff
  • trust: medium-wide, blue, helmet, shield
  • market: lean, green hood, magnifying glass
  • health: round, yellow, red bandana, red heart
  • content: medium, lavender beret, gold quill
  • presentations: tall, tophat, crimson cape
  • vault: small, mint, glasses, gold key

Also: agent-{id}-sheet.png — 4-frame walk cycle sprite sheets.

Technical Approach

  • Canvas 2D renders the farm map: grass background, dirt paths, building shapes, decorations
  • Sprite rendering: draw agent PNGs on canvas with smooth position interpolation
  • HTML overlay layer for: agent detail cards (click agent → card), status bar, connection indicator
  • Drop Three.js entirely — keep React + Zustand + WebSocketClient

Files to Create/Modify

  • src/frontend/App.jsx — Canvas-based farm container + HTML overlay
  • src/frontend/FarmCanvas.jsx — Canvas 2D rendering (buildings, paths, agent sprites)
  • src/frontend/AgentCard.jsx — HTML overlay card (click agent to inspect)
  • src/frontend/store.js — keep/update Zustand store
  • src/frontend/WebSocketClient.js — keep as-is
  • src/frontend/src/farm.css — update for overlay styles
  • src/frontend/index.html — update
  • src/frontend/package.json — remove three/fiber/drei deps

Design Requirements

  • Dark farm night background (#2D1B0E)
  • Buildings: Workshop, Studio, Cabins, Library, Shrine, Campfire
  • Dirt paths connecting zones
  • Pixel art trees, rocks, flowers as decoration
  • 9 agents with smooth movement animation
  • Agent names visible on hover or permanently small below sprite
  • Click agent → card slides in from right with: name, department, status, current task
  • Bottom bar: connection status, agent count, clock/time

Build

Run cd src/frontend && npx vite build — must succeed.

## Goal Replace the CSS pixel-art frontend with a Canvas 2D rendered farm + HTML overlay for agent detail cards. ## Assets Ready `assets/sprites/agent-{id}.png` — 9 distinct 32x32 pixel art agent sprites: - cos: tall-thin, orange, clipboard - engineering: stocky, teal, hardhat, wrench - senior-eng: tall, purple wizard hat, crystal staff - trust: medium-wide, blue, helmet, shield - market: lean, green hood, magnifying glass - health: round, yellow, red bandana, red heart - content: medium, lavender beret, gold quill - presentations: tall, tophat, crimson cape - vault: small, mint, glasses, gold key Also: `agent-{id}-sheet.png` — 4-frame walk cycle sprite sheets. ## Technical Approach - **Canvas 2D** renders the farm map: grass background, dirt paths, building shapes, decorations - **Sprite rendering:** draw agent PNGs on canvas with smooth position interpolation - **HTML overlay layer** for: agent detail cards (click agent → card), status bar, connection indicator - **Drop Three.js entirely** — keep React + Zustand + WebSocketClient ## Files to Create/Modify - `src/frontend/App.jsx` — Canvas-based farm container + HTML overlay - `src/frontend/FarmCanvas.jsx` — Canvas 2D rendering (buildings, paths, agent sprites) - `src/frontend/AgentCard.jsx` — HTML overlay card (click agent to inspect) - `src/frontend/store.js` — keep/update Zustand store - `src/frontend/WebSocketClient.js` — keep as-is - `src/frontend/src/farm.css` — update for overlay styles - `src/frontend/index.html` — update - `src/frontend/package.json` — remove three/fiber/drei deps ## Design Requirements - Dark farm night background (#2D1B0E) - Buildings: Workshop, Studio, Cabins, Library, Shrine, Campfire - Dirt paths connecting zones - Pixel art trees, rocks, flowers as decoration - 9 agents with smooth movement animation - Agent names visible on hover or permanently small below sprite - Click agent → card slides in from right with: name, department, status, current task - Bottom bar: connection status, agent count, clock/time ## Build Run `cd src/frontend && npx vite build` — must succeed.

✅ Complete

Replaced CSS pixel-art frontend with Canvas 2D farm + HTML overlay.

What was done:

  • FarmCanvas.jsx — Full Canvas 2D rendering: grass with texture, 5 buildings + campfire with animated flames, dirt paths, trees/rocks/flowers, building labels with dark pill background
  • Agent rendering — All 9 agent sprites loaded from PNGs (Vite public/ directory), lerp-based smooth movement, vertical bob for idle, sparkle particles for working, "..." bubble for thinking, red tint + "!" for blocked, grayscale+opacity for offline
  • AgentCard.jsx — Click-to-open HTML overlay card sliding from right with agent name, status badge, task, location zone, department
  • Cleanup — Removed OfficeScene.jsx, AgentSprite.jsx. Stripped CSS down to overlay/card/bar/connection styles. Title updated to "Spatial Office — Scobleclaw"

Build: ✅ passes (npx vite build)

Deployed: ✅ service restarted, serving from src/frontend/dist/

Commit: 9275854 — feat(frontend): Canvas 2D farm with real pixel art sprites and HTML overlay cards

## ✅ Complete Replaced CSS pixel-art frontend with Canvas 2D farm + HTML overlay. ### What was done: - **FarmCanvas.jsx** — Full Canvas 2D rendering: grass with texture, 5 buildings + campfire with animated flames, dirt paths, trees/rocks/flowers, building labels with dark pill background - **Agent rendering** — All 9 agent sprites loaded from PNGs (Vite `public/` directory), lerp-based smooth movement, vertical bob for idle, sparkle particles for working, "..." bubble for thinking, red tint + "!" for blocked, grayscale+opacity for offline - **AgentCard.jsx** — Click-to-open HTML overlay card sliding from right with agent name, status badge, task, location zone, department - **Cleanup** — Removed OfficeScene.jsx, AgentSprite.jsx. Stripped CSS down to overlay/card/bar/connection styles. Title updated to "Spatial Office — Scobleclaw" ### Build: ✅ passes (`npx vite build`) ### Deployed: ✅ service restarted, serving from `src/frontend/dist/` ### Commit: `9275854` — feat(frontend): Canvas 2D farm with real pixel art sprites and HTML overlay cards
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
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: sscoble/spatial-office#13
No description provided.