I'll build a complete 3D Rubik's Cube speed-solving game — gesture/keyboard layer turns, scramble challenges, timer + scoring, juicy particles/shake/sound, and a persistent high-score table. Let me first look at the project structure.
Tailwind v4 + React 19. Now I'll install three and lucide-react, and check the existing HTML/CSS entry files.
Dependencies installed. Now I'll create the HTML shell (title, fonts, meta) and the global stylesheet with the neon-void theme, plus the audio synth engine and high-score storage helpers — these are independent files.
HTML shell and theme stylesheet are in. Now the WebAudio synth engine (clicks, whooshes, arpeggios — all synthesized, no assets) and the localStorage high-score helpers.
Now the core of the game — the Three.js cube engine with gesture/keyboard input, springy layer animations, particles, screen shake, solve detection, and an adaptive quality loop.
The engine is in place, but I need to fix one real bug: the gesture drag vector must be measured from the actual ray-hit point, not the plane's closest point — and spring-back cancels should be silent. Let me patch that.
Both edits applied (the lint error resolved once the second one landed). Now fix the drag computation to use the stored grip point and soften spring-back feedback.
Removing the now-unused helper and making cancelled (spring-back) drags quiet.
The second edit landed; let me check the tail of the file to remove the leftover helper correctly.
Engine core is complete. Now the full game UI in App.tsx: state machine, start screen with difficulty select + high-score table, HUD with live timer, pause overlay, game-over screen with count-up score, and global keyboard shortcuts.
App shell is done. Now several important fixes: a pending-scramble resolver leak in reset(), spring-back drags wrongly counting as moves, a React.ReactNode type reference without the React import, and pass-through pointer events on the menu overlay so the cube stays toyable behind the UI.
Now the App.tsx fixes — ReactNode import and menu pointer pass-through.
All patches in. Let me run the first build to catch any issues.
Build passes on the first shot. Quick check of main.tsx to make sure the entry is clean (StrictMode double-mount safety, CSS import).
StrictMode-safe engine lifecycle confirmed. A few final polish edits: a mobile-friendly control hint in the HUD, and scroll-safe centering for the pause/game-over overlays on small screens.
The pause overlay wrapper needs its closing tag, and I'll apply the same pattern to game-over. Let me view the current structure.
One more closing tag needed for the game-over flex wrapper.
Build is green. Let me do a final careful review of the engine's gesture/animation paths to catch any runtime logic issues.
The move pipeline logic checks out. Let me verify the gesture input section once more.
Engine input logic is verified solid. Final touches: an inline SVG favicon and meta description, then rebuild.
Final build to confirm everything is production-ready.
CUBE³ — 3D 魔方速解游戏 is built and shipping a single-file bundle. Here's what you get:
The Game
A complete, fully-interactive 3D Rubik's cube — PBR rendered with rounded plastic cubies, glowing neon stickers, and a nebula-void aesthetic. It's a speed-solving challenge: pick a scramble depth, the cube shuffles itself in seconds, "GO!" flashes, and the clock starts on your first move. Solve it to bank a score weighted by time, moves, and turn efficiency.
Tight controls (keyboard + touch)
- Touch/mouse: grab any sticker and flick — the layer follows your finger in real time with physical drag-to-angle mapping, then springs into the nearest quarter turn (double-flicks commit 180° turns). Drag empty space to orbit, pinch/scroll to zoom.
- Keyboard: standard cubing notation —
U D L R F B (+ Shift for counter-turns), arrows to orbit, +/- zoom, Esc/P pause, R instant restart, Enter/Space to start or run it back.
Juice
- Springy
easeOutBack layer snaps with synthesized click sounds (pure WebAudio, zero assets) + haptics on mobile
- Particle swirls on every turn, bursts when a face completes, confetti explosion + slow-mo camera spin on solve
- Screen shake scaled to each event, GO! flash, animated score count-up
- Face-completion detection and full solve validation from the real cubie state
Game states
Start screen (with a live, playable attract-mode cube behind the UI) → scrambling → ready → running → pause overlay (auto-pauses when the tab hides) → SOLVED screen with stat breakdown → instant restart. Top-8 local high-score table with rank medals, "NEW BEST" crowning, and mute/best persistence in localStorage.
60fps engineering
Shared geometries/materials (~80 draw calls total), pooled GPU particle system (zero per-frame allocation), timer written straight to the DOM bypassing React re-renders, pixel-ratio capped at 2 with an adaptive quality governor that steps down if frame times drift, and resize-aware camera framing for portrait phones.
Difficulties: 热身 ×8, 经典 ×20, 大师 ×40. Go set the first record — 魔方挑战已就位。
Files built: index.html, src/index.css, src/lib/audio.ts, src/lib/storage.ts, src/game/CubeEngine.ts, src/App.tsx