Skip to content

feat: experimental 3D controller configurator (behind flag) - #412

Open
ryanmagoon wants to merge 4 commits into
mainfrom
feat/controller-3d-configurator
Open

feat: experimental 3D controller configurator (behind flag)#412
ryanmagoon wants to merge 4 commits into
mainfrom
feat/controller-3d-configurator

Conversation

@ryanmagoon

Copy link
Copy Markdown
Owner

Summary

Spikes a 3D controller configurator behind an experimental feature flag, as a foundation toward #81. When the flag is on, a staged, orbitable 3D Super Nintendo controller renders above the existing 2D mapping UI in Settings → Controllers. The proven 2D mapping UI is untouched — the 3D view is purely additive.

Toggle it from Settings → General → Experimental → "3D controller view" (persisted as gamelord:experimental:controller3d).

What's included

  • Controller3D — a react-three-fiber canvas (key/fill/rim lighting, studio IBL, contact shadow, orbit controls). Presentational and Storybook-able; zero IPC / window.gamelord coupling. preserveDrawingBuffer is on so the canvas is screenshottable.
  • SnesController — the controller modeled procedurally from primitives, with per-button emissive highlight + press-depth already wired to a highlightedButtons prop (ready for live buttonStates in a follow-up).
  • useExperimentalFlag — a small localStorage-backed flag hook establishing the gamelord:experimental:* convention (no flag infra existed before).
  • Storybook stories — staged / static / highlighted states.
  • Tooling: scoped oxlint override for r3f's JSX intrinsics (react/no-unknown-property); a happy-dom localStorage polyfill in both test setups (vitest 4's stub lacks getItem/removeItem/clear, which the dep bump surfaced as 26 failures) and a Gamepad test-mock cast fix.

Status / honesty

This is a spike, not the finished feature. The procedural model is a first-pass placeholder — proportions and framing need work (the capture below is at an unflattering near-edge-on angle). The plan is to swap in a license-vetted realistic .glb and wire per-button mesh highlighting + the click-to-assign flow described in #81 as follow-ups.

3D controller — procedural first pass
Procedural first-pass fallback (placeholder, framing/proportions WIP). Verify it live via Storybook: Components/Controller3D.

Testing

  • pnpm typecheckpnpm lint
  • pnpm --filter @gamelord/ui test ✅ (21 files / 325 tests)
  • pnpm --filter @gamelord/desktop test ✅ (32 files)

Relates to

Partial progress toward #81 (staged 3D foundation + flag). Realistic model and click-to-assign remain.

🤖 Generated with Claude Code

@vercel

vercel Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
gamelord-desktop Ignored Ignored Preview Jul 12, 2026 3:28am

ryanmagoon and others added 4 commits July 11, 2026 23:27
Install the CloudAI-X threejs-skills (.claude/skills/threejs-*) for 3D
guidance, and add three, @react-three/fiber, and @react-three/drei to
@gamelord/ui to support a 3D controller view.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
vitest 4's happy-dom environment installs a file-backed localStorage stub
missing getItem/removeItem/clear, breaking any code under test that touches
localStorage (5 ui + 21 desktop failures surfaced by the dep-bump lockfile
churn). Install a spec-compliant in-memory Storage in both package test
setups, reset between tests.

Also cast the useGamepad test mock through unknown — the updated lib.dom
Gamepad type no longer overlaps the partial mock.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add a staged 3D Super Nintendo controller to the Controllers settings tab,
gated behind a new gamelord:experimental:controller3d flag (toggled from
Settings > General > Experimental).

- Controller3D: react-three-fiber canvas with key/fill/rim lighting, IBL,
  contact shadow, and orbit controls. Presentational and Storybook-able.
- SnesController: procedurally modeled from primitives — wide/thin dog-bone
  shell with rounded ends, domed face buttons in an angled well, cross d-pad,
  angled Start/Select pills, shoulder bumpers. Per-button emissive highlight
  and press-depth, wired for future live buttonStates.
- useExperimentalFlag: localStorage-backed flag hook (gamelord:experimental:*).
- Storybook stories for staged/static/highlighted states.
- oxlint: scope-disable react/no-unknown-property for r3f JSX intrinsics.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Rebuild the 3D controller from primitives into a realistic model:
- extruded dog-bone (stadium) shell with smooth welded normals and real
  proportions, replacing the rounded-box body
- domed face-button caps (lathe profile) in dark socket rings
- beveled extruded d-pad cross in a circular recess
- Select/Start pills on angled recessed track plates
- cable strain-relief boss and cord off the top edge
- softer key light + moderated gloss so cap colors read instead of
  washing out; higher default camera for a proper hero angle

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ryanmagoon
ryanmagoon force-pushed the feat/controller-3d-configurator branch from a06437f to cd953d3 Compare July 12, 2026 03:28
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