8000 GitHub - 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.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

2D pixel art wizard survival shooter built with Next.js. Survive infinite waves, upgrade weapons, and compete on global leaderboards.

License

Notifications You must be signed in to change notification settings

decker-dev/wizard-game-react

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ”ฎ MYSTIC REALM DEFENDER

A 2D magical survival game with infinite waves of mythological creatures

Deployed on Vercel Built with Next.js Powered by Supabase Built with TypeScript


๐ŸŽฎ 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:


โœจ 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
git clone https://github.com/decker-dev/wizard-game-react
cd wizard-game-react
  1. Install dependencies
# With Bun (recommended for speed)
bun install

# Or with npm
npm install
  1. Environment configuration
# Create .env.local file
NEXT_PUBLIC_SUPABASE_URL=your_supabase_project_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
  1. Database setup
-- Execute in Supabase SQL Editor:
-- sql/create_tables.sql contains all necessary table schemas
  1. Start development server
bun dev
# Runs on http://localhost:3001

๐Ÿ—„๏ธ Database Architecture

Leaderboard Table

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

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

# 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:

{
  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/.

For more details, see the LICENSE file.


๐Ÿ”— Links & Resources


Made with ๐Ÿ”ฎ magical code and โค๏ธ during Buenos Aires Tech Week

"Defend the mystical realm with the power of TypeScript and creativity"

Game Preview

About

2D pixel art wizard survival shooter built with Next.js. Survive infinite waves, upgrade weapons, and compete on global leaderboards.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Contributors 6

0