Skip to content

feat: add multiplayer pixel grid to hero section - #18

Merged
mattzcarey merged 1 commit into
mainfrom
feat/multiplayer-grid
Feb 18, 2026
Merged

feat: add multiplayer pixel grid to hero section#18
mattzcarey merged 1 commit into
mainfrom
feat/multiplayer-grid

Conversation

@mattzcarey

Copy link
Copy Markdown
Contributor

Summary

  • Adds a collaborative real-time pixel grid overlay to the hero section using a singleton GridAgent Durable Object (Cloudflare Agents SDK)
  • Visitors click grid cells to toggle them; all connected users see the same state via WebSocket
  • Cells decay after 60 seconds using scheduleEvery with a smooth client-side opacity fade

Changes

  • site/src/server.ts (new): GridAgent DO with toggleCell/clearGrid callables and decayCells scheduled sweep
  • site/src/components/Hero/MultiplayerGrid.tsx (new): React overlay using useAgent hook, grid-aligned cell rendering
  • site/src/components/Hero/index.tsx: Integrates MultiplayerGrid between canvas and icon cards
  • site/wrangler.jsonc: Worker entry, DO binding, SQLite migration, assets routing
  • site/package.json: Added agents dependency

Test plan

  • Open in two browser windows, click cells in one, verify they appear in both
  • Wait 60s — verify cells fade out and disappear
  • Refresh page — verify existing cells load from persisted state
  • Verify hero 3D scene, icon cards, and mouse effects still work normally

Adds a collaborative real-time pixel grid overlay to the hero. Visitors
click background grid cells to toggle them on; all connected users see
the same state via a singleton GridAgent Durable Object (Agents SDK).

- GridAgent DO stores cells as timestamp map, exposes toggleCell/clearGrid
- scheduleEvery decay sweep removes cells after 60s with client-side fade
- MultiplayerGrid React component uses useAgent hook for real-time sync
- Grid dimensions match the shader grid formula for pixel-perfect alignment
@mattzcarey
mattzcarey merged commit 79e8693 into main Feb 18, 2026
1 check passed
@mattzcarey
mattzcarey deleted the feat/multiplayer-grid branch February 18, 2026 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant