https://github.com/decker-dev/wizard-game-react
2D pixel art wizard survival shooter built with Next.js. Survive infinite waves, upgrade weapons, and compete on global leaderboards.
https://github.com/decker-dev/wizard-game-react
arcade-game browser-game canvas game-development html5 nextjs pixel-art shooter supabase survival typescript vercel waves zombie-game zombies
Last synced: 5 months ago
JSON representation
2D pixel art wizard survival shooter built with Next.js. Survive infinite waves, upgrade weapons, and compete on global leaderboards.
- Host: GitHub
- URL: https://github.com/decker-dev/wizard-game-react
- Owner: decker-dev
- License: gpl-3.0
- Created: 2025-06-01T13:54:54.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-07-15T00:21:14.000Z (8 months ago)
- Last Synced: 2025-08-10T17:57:15.163Z (7 months ago)
- Topics: arcade-game, browser-game, canvas, game-development, html5, nextjs, pixel-art, shooter, supabase, survival, typescript, vercel, waves, zombie-game, zombies
- Language: TypeScript
- Homepage: https://mystic.lat
- Size: 12.3 MB
- Stars: 4
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# đŽ MYSTIC REALM DEFENDER
### *A 2D magical survival game with infinite waves of mythological creatures*
[](https://mystic.decker.sh)
[](https://nextjs.org/)
[](https://supabase.com/)
[](https://www.typescriptlang.org/)
---
## đŽ **About the Game**
**Mystic Realm Defender** is a 2D magical survival game developed during the **first Vibe Gaming Hackathon in LATAM** as part of Buenos Aires Tech Week. Control a powerful wizard and defend the mystical realm by surviving infinite waves of mythological creatures using powerful spells and magical abilities.
### đ **Developed by:**
- **[Lauti](https://x.com/lautidev_)** - Vibe Developer
- **[Alejo](https://x.com/alejorrojass)** - Vibe Developer
- **[Decker](https://x.com/0xDecker)** - Vibe Developer
---
## ⨠**Game Features**
### đ¯ **Core Gameplay**
- **Infinite wave system** with exponential difficulty scaling every 10 waves
- **6 distinct creature types** including normal, caster, tank, speed, explosive, and boss enemies
- **Advanced AI pathfinding** with A* algorithm and collision avoidance
- **Progressive spell upgrade system** with 6 levels (0-5) of magical power
- **Health pack system** for survival strategy
- **Mobile-responsive** with virtual controls for touch devices
### đĒ **Magic System**
- **Spell Levels (0-5)**: Each level enhances casting abilities
- **Level 0**: Single projectile (250ms cooldown)
- **Level 1**: Faster casting (200ms cooldown)
- **Level 2**: Double projectile spread (180ms cooldown)
- **Level 3**: Larger projectiles (160ms cooldown, 150% size)
- **Level 4**: Triple projectile barrage (150ms cooldown)
- **Level 5**: Quadruple spell storm (120ms cooldown, 200% size)
### đš **Enemy Variety**
- **Normal Creatures**: Basic pursuers (30 HP base, 3 crystals reward)
- **Caster Creatures**: Ranged spell attackers (50 HP base, 7 crystals reward)
- **Tank Creatures**: High HP, slow movement (120 HP base, 10 crystals reward)
- **Speed Creatures**: Fast but fragile (15 HP base, 5 crystals reward)
- **Explosive Creatures**: Explode on death (25 HP base, 8 crystals reward)
- **Boss Creatures**: Massive enemies every 5 waves (300 HP base, 50 crystals reward)
### đ
**Leaderboard System**
- **Top 3** highest scores from the greatest wizards
- **Complete history** of magical battles
- **Global statistics** with total realms defended
- **Real-time persistence** with Supabase magic
---
## đŽ **How to Play**
### đšī¸ **Controls**
```
Desktop:
WASD / Arrow Keys â Wizard movement
Spacebar â Cast spells in movement direction
ESC â Exit fullscreen
F â Toggle fullscreen
Mobile:
Virtual Joystick â Movement
Fire Button â Cast spells in movement direction
```
### đ¯ **Objectives**
1. **Survive infinite waves** of increasingly difficult mythological creatures
2. **Collect crystals** from defeated enemies to purchase upgrades
3. **Use the Arcane Shop** between waves to enhance spells and health
4. **Compete globally** for the highest score on the leaderboard
5. **Master the spell system** to achieve maximum magical power
---
## đ **Technologies Used**
### **Frontend & Game Engine**
- **Next.js 15** - React framework with App Router architecture
- **TypeScript** - Full type safety across the entire codebase
- **HTML5 Canvas** - Custom 2D game engine with 60 FPS rendering
- **React 19** - Latest React with concurrent features
- **Tailwind CSS** - Utility-first styling with custom magical theme
### **Backend & Database**
- **Supabase** - PostgreSQL database with real-time subscriptions
- **Row Level Security (RLS)** - Secure data access controls
- **Edge Functions** - Serverless API endpoints for game logic
### **Development & Build Tools**
- **Bun** - Ultra-fast JavaScript runtime and package manager
- **Biome** - Fast linter and formatter (ESLint + Prettier alternative)
- **PostCSS** - CSS processing with plugins
- **Vercel Analytics** - Performance and usage tracking
### **Game Assets & Graphics**
- **Pixel art sprites** - Custom wizard, creature, and effect assets
- **Press Start 2P font** - Retro gaming typography
- **Custom particle systems** - Crystal collection and floating effects
---
## đĻ **Installation and Development**
### **Prerequisites**
- **Bun** (recommended) or **Node.js 18+**
- **Git**
- **Supabase** account for database functionality
### **Local Development Setup**
1. **Clone the repository**
```bash
git clone https://github.com/decker-dev/wizard-game-react
cd wizard-game-react
```
2. **Install dependencies**
```bash
# With Bun (recommended for speed)
bun install
# Or with npm
npm install
```
3. **Environment configuration**
```bash
# Create .env.local file
NEXT_PUBLIC_SUPABASE_URL=your_supabase_project_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
```
4. **Database setup**
```sql
-- Execute in Supabase SQL Editor:
-- sql/create_tables.sql contains all necessary table schemas
```
5. **Start development server**
```bash
bun dev
# Runs on http://localhost:3001
```
---
## đī¸ **Database Architecture**
### **Leaderboard Table**
```sql
CREATE TABLE leaderboard (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
player_name VARCHAR(50) NOT NULL,
score INTEGER DEFAULT 0,
waves_survived INTEGER DEFAULT 0,
created_at TIMESTAMPTZ DEFAULT NOW()
);
```
### **Game Statistics Table**
```sql
CREATE TABLE game_stats (
id SERIAL PRIMARY KEY,
stat_type VARCHAR(50) NOT NULL UNIQUE,
total_games_played INTEGER DEFAULT 0,
created_at TIMESTAMPTZ DEFAULT NOW(),
updated_at TIMESTAMPTZ DEFAULT NOW()
);
```
---
## đ¨ **Project Architecture**
```
đĻ mystic-realm-defender/
âââ đ app/ # Next.js App Router
â âââ đ game/ # Game page route (/game)
â âââ đ credits/ # Credits page (/credits)
â âââ đ settings/ # Settings page (/settings)
â âââ đ api/ # API routes
â â âââ validate-score/ # Score validation endpoint
â âââ layout.tsx # Root layout with fonts and analytics
â âââ page.tsx # Home page component
â âââ globals.css # Global styles and Tailwind base
â âââ manifest.ts # PWA manifest configuration
â âââ sitemap.ts # SEO sitemap generation
âââ đ components/ # React UI Components
â âââ GameScreen.tsx # Main game orchestration component
â âââ GameCanvas.tsx # Canvas rendering and game loop
â âââ GameUI.tsx # In-game interface (health, score, wave)
â âââ Marketplace.tsx # Upgrade shop between waves
â âââ Leaderboard.tsx # Score rankings display
â âââ MobileControls.tsx # Touch controls for mobile devices
â âââ GameOverlay.tsx # Game state overlays (pause, game over)
â âââ ScoreSubmissionModal.tsx # Score submission and sharing
â âââ HomeScreen.tsx # Main menu and navigation
â âââ LoadingScreen.tsx # Asset loading screen
â âââ ShareModal.tsx # Social sharing functionality
â âââ CoinParticles.tsx # Crystal collection effects
â âââ FloatingParticles.tsx # Background ambient effects
â âââ CoinIcon.tsx # Crystal currency icon
âââ đ hooks/ # Custom React Hooks
â âââ useGameController.ts # Main game state orchestration
â âââ useGameState.ts # Game entity state management
â âââ useAssetLoader.ts # Sprite and texture loading
â âââ useInputHandlers.ts # Keyboard and mouse input
â âââ useGameAudio.ts # Sound effects and music system
â âââ useLeaderboard.ts # Score persistence and retrieval
â âââ useGameScreens.ts # Screen state management
âââ đ game/ # Core Game Logic
â âââ Player.ts # Wizard character controller
â âââ Creatures.ts # Enemy AI and behavior systems
â âââ Projectiles.ts # Spell and magic bolt physics
â âââ Collisions.ts # AABB collision detection
â âââ Renderer.ts # Canvas rendering engine
âââ đ utils/ # Utility Functions
â âââ math.ts # Vector mathematics and physics
â âââ marketplace.ts # Upgrade cost calculations
â âââ coinParticles.ts # Particle effect systems
âââ đ types/ # TypeScript Definitions
â âââ game.ts # Game entity interfaces and types
âââ đ constants/ # Game Configuration
â âââ game.ts # Balancing constants and settings
âââ đ data/ # Static Game Data
â âââ obstacles.ts # Map obstacle definitions
â âââ mapLayouts/ # Level layout configurations
âââ đ lib/ # External Integrations
â âââ supabase.ts # Database client configuration
â âââ metadata.ts # SEO and PWA metadata
âââ đ public/ # Static Assets
â âââ đ wizard/ # Player character sprite sheets
â âââ đ creature/ # Normal enemy sprites
â âââ đ mage/ # Caster enemy sprites
â âââ đ health/ # Health pack sprites
â âââ đ explosive/ # Explosive creature sprites (WIP)
â âââ floor-texture.png # Game background texture
â âââ og.png # Social media preview image
â âââ favicon.ico # Site favicon
âââ đ sql/ # Database Scripts
â âââ create_tables.sql # Supabase table schemas
âââ đ styles/ # Additional Stylesheets
```
---
## đ **Available Scripts**
```bash
# Development
bun dev # Start development server on port 3001
bun build # Build optimized production bundle
bun start # Start production server
# Code Quality
bun lint # Run Next.js linting
```
---
## đ **Technical Highlights**
### **đŽ Custom Game Engine**
- **60 FPS rendering** with requestAnimationFrame optimization
- **Object pooling** for projectiles to prevent memory leaks
- **Spatial partitioning** for efficient collision detection
- **Sprite animation system** with directional character movement
- **Camera system** with smooth player following and map boundaries
### **đ§ Advanced AI Systems**
- **A* pathfinding** for intelligent navigation around obstacles
- **Steering behaviors** including seek, flee, separation, and obstacle avoidance
- **Line of sight** optimization for performance
- **Behavioral patterns** unique to each creature type
### **đą Mobile-First Design**
- **Responsive detection** with automatic mobile optimization
- **Virtual controls** with customizable joystick and fire button
- **Touch gesture** support for smooth mobile gameplay
- **Fullscreen API** integration for immersive experience
### **⥠Performance Optimizations**
- **Efficient rendering** with dirty rectangle updates
- **Memory management** with proper cleanup cycles
- **Asset preloading** for smooth gameplay experience
- **Debounced input handling** for responsive controls
---
## đ **Game Jam Achievement**
This project was developed during the **Vibe Gaming Hackathon LATAM**, part of Buenos Aires Tech Week 2024.
### **đ¯ Hackathon Accomplishments:**
- â
**Complete game** with full gameplay loop
- â
**6 enemy types** with unique behaviors and AI
- â
**Progressive difficulty** system with infinite scaling
- â
**Real-time leaderboard** with global competition
- â
**Mobile compatibility** with touch controls
- â
**Polish and effects** including particle systems
- â
**Deployment** on production infrastructure
---
## đ¤ **Contributing**
We welcome contributions to enhance the mystical realm! Here's how to get involved:
### **Development Workflow**
1. **Fork** the repository
2. **Create** a feature branch (`git checkout -b feature/enhanced-spells`)
3. **Implement** your changes with TypeScript
4. **Test** thoroughly on both desktop and mobile
5. **Add patch notes** for your changes (see Patch Notes Requirements below)
6. **Submit** a pull request with detailed description
### **đ Patch Notes Requirements**
**All pull requests MUST include patch notes** describing what was added, modified, or improved:
1. **Update** `/data/patchNotes.ts` with your changes
2. **Follow the existing format** with proper categorization:
- `NEW` ⨠- New features or content
- `IMPROVED` ⥠- Enhancements to existing features
- `FIXED` đ§ - Bug fixes and corrections
- `BALANCED` âī¸ - Game balance adjustments
3. **Include version number** following semantic versioning (e.g., v1.2.3)
4. **Write clear descriptions** of what changed and why
5. **Add your changes** to the top of the patch notes array
**Example patch note entry:**
```typescript
{
version: "v1.3.0",
title: "Enhanced Spell System",
date: "2025-06-XX",
description: "Major improvements to spell casting mechanics",
changes: [
{
category: "NEW",
items: [
"Added spell combo system for advanced players",
"New visual effects for level 5 spells"
]
},
{
category: "IMPROVED",
items: [
"Spell casting now feels more responsive",
"Better projectile collision detection"
]
}
]
}
```
### **Contribution Areas**
- đ¨ **New sprites** for explosive and speed creatures
- đĩ **Audio system** enhancements and sound effects
- đŽ **New creature types** with unique behaviors
- đ **Game balance** improvements and testing
- đ **Accessibility** features and improvements
---
## đ **License**
This project is licensed under the **GNU General Public License v3.0** (GPL-3.0).
**Mystic Realm Defender** - A 2D magical survival game with infinite waves of mythological creatures
Copyright (C) 2025 Lauti, Alejo, and Decker (Vibe Gaming Hackathon Team)
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see [https://www.gnu.org/licenses/](https://www.gnu.org/licenses/).
For more details, see the [LICENSE](./LICENSE) file.
---
## đ **Links & Resources**
- **đŽ Play the Game**: [mystic.decker.sh](https://mystic.decker.sh)
- **đ Hackathon Event**: [Paisanos.io Vibe Gaming](https://lu.ma/xqvznvg4?locale=es)
- **đĻ Developers**:
- [Lauti (@lautidev_)](https://x.com/lautidev_)
- [Alejo (@alejorrojass)](https://x.com/alejorrojass)
- [Decker (@0xDecker)](https://x.com/0xDecker)
---
**Made with đŽ magical code and â¤ī¸ during Buenos Aires Tech Week**
*"Defend the mystical realm with the power of TypeScript and creativity"*
