Nebula Runner
A browser-based endless space runner dodge asteroids, collect orbs, and survive the void
Overview
Nebula Runner is a fully browser-based endless space runner built with Next.js 15 and the HTML5 Canvas API no backend, no sign-up, no configuration required. It runs entirely offline with all game state persisted to localStorage. Unlike Flash-era games or heavy Unity WebGL exports, it loads instantly and plays at 60fps on any modern browser, including mobile.
โจ Features
- ๐ Physics-based ship movement smooth velocity and tilt with mouse, touch, and D-pad controls
- ๐ฏ 4 escalating difficulty tiers EASY โ MEDIUM โ HARD โ INSANE, each unlocking new obstacle types
- ๐ฅ Combo multiplier system chain orb collections for up to 5ร score multiplier
- ๐ก๏ธ Power-ups Shield, Slow Motion, and Invincibility with expiry warnings
- โ๏ธ Asteroid split mechanic near-misses at MEDIUM+ have a 25% chance to fracture asteroids
- ๐ Black holes accretion disk visuals and gravitational lensing effects
- โก Laser beam obstacles 1.5s warning phase followed by a 2s active kill zone (HARD+)
- ๐๏ธ Speed zones entering one doubles ship speed for 3 seconds (INSANE)
- ๐ 3-layer parallax star field warp-speed motion blur kicks in above score 200
- ๐ต Procedural audio 13 distinct sounds synthesized via Web Audio API, zero audio files
- ๐ Achievement system unlockable achievements persisted to localStorage
- ๐ฑ Mobile D-pad 60fps continuous movement with diagonal support via held directions
- ๐ซ Particle effects collision burst, orb collection spiral, thruster exhaust
- ๐ณ Screen shake on collision with linear decay
๐ Tech Stack
| Category | Technology |
|---|---|
| Framework | Next.js 15 (App Router + Turbopack) |
| UI | React 18 + TypeScript 5 |
| Styling | Tailwind CSS v3 + shadcn/ui |
| Game Rendering | HTML5 Canvas API |
| Audio | Web Audio API (procedural synthesis) |
| Persistence | localStorage |
| Deployment | Vercel |
๐ Quick Start
Prerequisites
- Node.js 18+
- pnpm (
npm install -g pnpm)
Installation
# 1. Clone the repo
git clone https://github.com/MuhammadTanveerAbbas/nebula-runner.git
cd nebula-runner
# 2. Install dependencies
pnpm install
# 3. Run the development server
pnpm dev
# 4. Open in browser
# http://localhost:3000
๐ Environment Variables
No environment variables are required. The game runs fully offline with zero configuration.
If you want to add optional deployment or analytics integrations, create a .env.local file:
# Deployment (optional)
NEXT_PUBLIC_APP_URL=https://your-domain.com
# Analytics (optional)
NEXT_PUBLIC_ANALYTICS_ID=your-analytics-id
๐ Project Structure
nebula-runner/
โโโ public/ # Static assets (favicon, robots.txt)
โโโ src/
โ โโโ app/ # Next.js App Router (layout, page, sitemap)
โ โโโ components/ # UI + game components (GameCanvas, MobileControls, etc.)
โ โ โโโ ui/ # shadcn/ui primitives
โ โโโ hooks/ # Custom React hooks (useGameEngine, use-mobile)
โ โโโ lib/
โ โโโ game/ # Core game engine (audio, constants, types, utils)
โโโ .env.example
โโโ package.json
โโโ README.md
๐ฆ Available Scripts
| Command | Description |
|---|---|
pnpm dev |
Start development server with Turbopack |
pnpm build |
Build for production |
pnpm start |
Start production server |
pnpm lint |
Run ESLint |
pnpm typecheck |
TypeScript type check |
๐ฎ Game Controls
| Input | Action |
|---|---|
| Mouse move | Aim ship |
| Touch drag | Aim ship |
| Space / Escape | Pause / Resume |
| Mobile D-pad (bottom-right) | Move ship in 4 directions |
๐ Deployment
This project is deployed on Vercel.
Deploy Your Own
- Click the button above
- Connect your GitHub account
- Deploy no environment variables needed
๐บ Roadmap
- [x] Physics-based ship movement
- [x] 4 difficulty tiers with unique obstacles
- [x] Combo multiplier system
- [x] Power-ups (Shield, Slow Motion, Invincibility)
- [x] Procedural Web Audio synthesis
- [x] Achievement system with localStorage persistence
- [x] Mobile D-pad with 60fps continuous movement
- [ ] Global leaderboard
- [ ] Additional power-up types
- [ ] Unlockable ship skins
๐ค Contributing
Contributions are welcome! Feel free to:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
๐ License
Distributed under the MIT License. See LICENSE for more information.