Build a polished, playable browser game: بازی مار که دنبال سیب می رود. Make the core…
- User
Build a polished, playable browser 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 will explore the existing project files to understand the directory structure and available setup.
I will check
package.jsonto see what libraries and icons are installed.I will install
lucide-reactfor UI icons.I will check
index.htmlandsrc/index.css.I will check
src/index.css.I will update
index.htmlto add Persian and arcade fonts from Google Fonts, set up proper RTL/LTR support, and update the page title and meta tags.I will create
src/types/game.tsto define data types for snake coordinates, special items, game modes, themes, achievements, and bilingual text.I will create
src/utils/i18n.tswith Persian and English UI translations, game mode explanations, and playful feedback strings.I will create
src/utils/config.tscontaining the game definitions: visual skins, achievements, grid configurations, power-up timers, and theme color palettes.I will create
src/utils/sound.tswith a Web Audio API synthesizer that generates crunchy apple bites, combo chimes, golden fanfares, explosions, teleport swooshes, and an ambient background synth loop.I will create
src/utils/storage.tsto manage local persistence for high scores, achievements, user nickname, selected skins, and themes.I will clean up the unused imports in
src/utils/storage.ts.I will create
src/components/Navbar.tsxfeaturing the language switcher, sound and music toggles, visual theme selector, and buttons to open leaderboards and achievements.I will create
src/components/HUD.tsxto display real-time gameplay metrics: Score, High Score, Combo Chain meter, Active Powerup timers, and difficulty badge.I will create
src/components/VirtualControls.tsxfor responsive mobile D-Pad touch controls and gesture guidance.I will create
src/components/StartScreen.tsxwith mode selection, difficulty toggles, snake skin customization, and a hero start button.I will remove unused icon imports in
src/components/StartScreen.tsx.I will create
src/components/GameOverModal.tsxto display final session statistics, new high score notifications, share functionality, and an instant restart trigger.I will remove the unused
Awardimport fromsrc/components/GameOverModal.tsx.I will create
src/components/PauseModal.tsxto handle game pausing, sound/music volume tweaks mid-game, and menu return.I will create
src/components/LeaderboardModal.tsxto display the high score Hall of Fame with mode tabs and top player badges.I will remove the unused
Awardicon andcurrentThemevariable insrc/components/LeaderboardModal.tsx.I will create
src/components/AchievementsModal.tsxto display unlockable badges and milestones.I will create
src/components/GameCanvas.tsximplementing a 60 FPS HTML5 Canvas engine with sub-grid interpolation, particle explosions, floating feedback text, animated eyes and tongue, portal mechanics, and responsive input buffering.I will create
src/App.tsxas the main application controller linking the state machine, audio engine, local storage, start screen, game canvas, HUD, and popups.I will remove the unused
Reactdefault import insrc/App.tsx.I will now build the project to confirm there are no TypeScript or compilation errors.
I have built and verified the playable browser game: بازی مار و سیب | Nimble Snake Retro Arcade.
✨ What I Built & Key Highlights:
-
🚀 Instant Fun Within the First 10 Seconds:
- Juicy Feedback & FX: Radial particle bursts on every apple eaten, floating score text (
+10 x2 COMBO!), animated googly eyes that blink and track direction, and dynamic screen shake effects (shake-mildandshake-heavy). - Web Audio Synthesizer: No external audio files needed — built-in Web Audio API generates crunchy apple bites, golden fanfares, combo chimes, bomb explosions, portal teleports, and an ambient synth background beat.
- Combo Chain System: Eating apples within a 6-second window builds up a multiplier (
x2,x3, up tox5), rewarding fast, aggressive play!
- Juicy Feedback & FX: Radial particle bursts on every apple eaten, floating score text (
-
🎮 4 Unique Game Modes:
- سیبزار کلاسیک (Classic Orchard): Traditional progressive speed curve with golden apples.
- جنون زمانی (Time Frenzy - Arcade): Loaded with chili peppers (fire trail & speed boost), freeze clocks (slow motion), and bomb hazards.
- هزارتوی پورتال (Portal Labyrinth): Neon portals teleport the snake across the board while avoiding hazard walls.
- آرامش ذن (Infinite Zen): No walls, no game over — wrap-around grid for relaxing flow state gameplay.
-
🎯 Ultra-Tight Controls & Input Buffering:
- Keyboard: Arrow keys and WASD with a direction buffer queue (
nextDirQueue) that records rapid successive keypresses, eliminating accidental self-collisions when turning fast. - Touch & Mobile: Fluid swipe gesture recognition across the canvas plus an on-screen virtual 4-way D-Pad with instant restart and pause buttons.
- Keyboard: Arrow keys and WASD with a direction buffer queue (
-
🏆 Complete Arcade Ecosystem:
- Start Screen: Custom nickname entry, mode selection, difficulty toggles (Easy, Normal, Hard, Hyper), and visual skin customization (Emerald Viper, Royal Turquoise & Gold, Cyber Pink, Golden Dragon, Toxic Biohazard, Cosmic Prism).
- Local High-Score Table: Hall of Fame stored in
localStorage, filterable by game mode with trophies, dates, and top player badges. - Achievements Showcase: 8 unlockable milestones with automatic toast fanfare when achieved.
- Pause & Game Over: Detailed post-game analytics (max length, combo streak, apples eaten), instant restart via Spacebar or Tap, and a Share Score card copy tool.
-
🎨 Cohesive Visual Themes & 60 FPS Rendering:
- 4 Visual Themes: Cyberpunk Neon, Royal Persian Garden, Retro 8-Bit, and Cosmic Aurora.
- Bilingual Support: Instant toggle between فارسی (FA) (with RTL layout and Persian typography via Vazirmatn) and English (EN).
- 60 FPS Performance: Decoupled physics step rate and rendering frame interpolation ensure smooth slithering motion on both desktop and mobile screens.
Files built:
index.html,src/types/game.ts,src/utils/i18n.ts,src/utils/config.ts,src/utils/sound.ts,src/utils/storage.ts,src/components/Navbar.tsx,src/components/HUD.tsx,src/components/VirtualControls.tsx,src/components/StartScreen.tsx,src/components/GameOverModal.tsx,src/components/PauseModal.tsx,src/components/LeaderboardModal.tsx,src/components/AchievementsModal.tsx,src/components/GameCanvas.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.