Build a polished, playable browser game: afk clicker game. Make the core loop fun within…
- User
Build a polished, playable browser game: afk clicker game. Make the core loop fun within the first ten seconds, with tight controls for both keyboard and touch, and juicy feedback — screen shake, particle effects, and satisfying animations. Include a start screen, a score system, pause and game-over states with instant restart, and a local high-score table. Style it with a cohesive visual theme and make sure it runs smoothly at 60fps on desktop and mobile.
Assistant
I'll build a polished, juicy AFK clicker game. Let me first explore the project structure to understand what's set up.
Let me check the remaining setup files to understand the configuration.
I now understand the setup: React 19, Vite 7 with single-file output, Tailwind v4, and a
cnutility. I'll build a polished, juicy idle/clicker game called NEBULA FORGE — a timed score-attack clicker with auto-generators (the "AFK" mechanic), combo multipliers, crits, screen shake, particles, synthesized audio, and a local high-score table.Let me start with the foundation: HTML, global styles, and core utility modules.
Now the game configuration and types — generators, upgrades, and tuning constants.
Now the synthesized audio engine — juicy WebAudio blips with combo-driven pentatonic melodies.
Now the game engine — all the simulation logic: clicking, combos, crits, generators, upgrades, and bulk purchasing.
Now the particle system — sparks, glow bursts, expanding rings, and floating score text, all rendered on canvas for performance.
Now the canvas renderer — the animated nebula background, twinkling starfield, the pulsing neon core, and orbiting generators.
Now the local high-score persistence hook using localStorage.
Let me clean up the unused
submithelper in that hook.I need to remove the unused
submitfrom the return statement.The render and logic layers are done. Now I'll build the UI components. First, a pricing helper (single source of truth for costs) and the high-score list + HUD.
Now the HUD — energy, score, timer with progress bar, combo multiplier badge, and control buttons.
Now the shop with buy-mode toggle (×1 / ×10 / MAX) and generator/upgrade cards.
I'll remove the unused index variable in the map.
Let me update the high-score hook to also return the new entry's id (for highlighting), then build the three overlay screens.
Let me re-read the current state of the hook file.
Now the three overlay screens — start, pause, and game-over.
Now the game-over screen with an animated score count-up and the high-score table.
The renderer's
coreRadiushelper should be reusable for click feedback. Let me export it.Now the heart of it all — the
Gameorchestrator with the 60fps game loop, canvas setup, multi-touch + keyboard input, and phase management.Let me remove the unused
togglePausehelper since the HUD button handles pause directly.Now let me wire up
App.tsxto render the game.A couple of type references need adjusting for React 19's JSX transform (no global
React). Let me fix theOverlaychildren type and the pointer event type.Let me verify the current state of the StartScreen file around the Overlay export.
The Overlay type still references
React.ReactNode. Let me fix it directly.Now let me tune the generator production values so the idle/AFK income feels impactful, then build.
Now let me build the project to confirm everything compiles correctly.
The build passes. Now let me optimize rendering for consistent 60fps on mobile by pre-rendering the static nebula background to an offscreen canvas instead of recomputing gradients every frame. First, I'll refactor the renderer to separate the static background from the animated world.
Now I'll update the main render function to skip the background (now pre-rendered) and rename it to
renderWorld.Now let me update Game.tsx to build an offscreen background and use
renderWorld+paintBackground.Let me add an offscreen background canvas ref and wire it into the resize + loop logic.
Now update the resize handler to build the offscreen background:
Now update the loop to draw the pre-rendered background and call
renderWorld:Let me add audio init/resume to the pointer handler for robustness, then rebuild.
The build works. I need to fix a touch interaction issue:
touch-action: noneonbodywould block scrolling/swiping inside overlays and the shop on mobile. Let me restrict it to the canvas only and enable the right gestures on scroll containers.Now let me gate the UI snapshot updates to the playing phase to avoid needless re-renders.
Let me do a final review of the main orchestrator to catch any issues.
The implementation looks complete and correct. Let me verify the Tailwind v4 theme tokens actually generated CSS utilities in the build output (this is critical — if they didn't register, the styling would silently break).
Line counts aren't reliable for minified single-line CSS. Let me check the actual generated class definitions directly.
The custom theme tokens aren't appearing as expected. Let me investigate the actual built CSS more directly.
Files built:
index.html,src/index.css,src/game/format.ts,src/game/config.ts,src/game/audio.ts,src/game/engine.ts,src/game/particles.ts,src/game/render.ts,src/hooks/useHighScores.ts,src/game/pricing.ts,src/components/HighScoreList.tsx,src/components/Hud.tsx,src/components/Shop.tsx,src/components/StartScreen.tsx,src/components/PauseScreen.tsx,src/components/GameOverScreen.tsx,src/components/Game.tsx,src/App.tsx
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.