Skip to content

holoduke/aiplane

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

12 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Vibe coded jet fighter game

A high-performance 3D fighter jet game featuring dynamic terrain generation, advanced lighting systems, and immersive gameplay mechanics built with Three.js.

Jet Fighter Game Screenshot 1 Jet Fighter Game Screenshot 2 Jet Fighter Game Screenshot 3

Features โœจ

๐ŸŒ Advanced Terrain System

  • Level-of-Detail (LOD) Rendering: Optimized terrain that adapts based on camera distance
  • Procedural Generation: Dynamic terrain generation using noise functions
  • Multiple Environments: Switch between different terrain styles (Mars, Realistic, Crystal)
  • Shader-Based Displacement: GPU-accelerated terrain height generation

โœˆ๏ธ Fighter Jet Gameplay

  • Realistic Flight Controls: Intuitive keyboard controls with physics-based movement
  • Combat System: Laser weapons with terrain collision detection
  • Multiple Game Modes:
    • Play Mode: Full fighter jet experience with combat
    • Float Mode: Free camera exploration of the terrain

๐ŸŒž Dynamic Lighting & Shadows

  • Cascaded Shadow Mapping: Multi-level shadow system for realistic lighting
  • Dynamic Sun System: Time-of-day simulation with moving sun
  • Lens Flare Effects: Realistic sun lens flares with terrain occlusion
  • Advanced Materials: PBR-style shading with multiple lighting models

๐ŸŽฎ User Interface

  • Interactive Control Panel: Real-time adjustment of lighting, shadows, and terrain
  • Screen Management: Seamless transitions between menu, game, and pause states
  • Environment Toggle: Quick switching between terrain environments
  • HUD Display: Real-time position and system information

๐Ÿ”Š Audio System

  • Dynamic Music: Context-aware audio that changes based on game state
  • Menu Music: Atmospheric background music for exploration
  • Game Music: High-energy combat music during gameplay

๐ŸŽจ Visual Effects

  • Post-Processing Pipeline: Bloom, anti-aliasing, and color grading
  • Particle Effects: Combat effects and environmental particles
  • Atmospheric Rendering: Realistic sky and atmosphere simulation
  • Performance Optimization: Efficient rendering with mobile device support

Technology Stack ๐Ÿ› ๏ธ

  • Engine: Three.js (WebGL)
  • Build Tool: Vite
  • Shaders: GLSL (Vertex & Fragment shaders)
  • Audio: Web Audio API
  • Input: Keyboard and mouse controls with pointer lock API

Getting Started ๐Ÿš€

Prerequisites

  • Node.js (v14 or higher)
  • npm or yarn
  • Modern web browser with WebGL support

Installation

  1. Clone the repository

    git clone https://github.com/felixpalmer/lod-terrain.git
    cd lod-terrain
  2. Install dependencies

    npm install
  3. Start development server

    npm run dev
  4. Open in browser Navigate to http://localhost:3000

Build for Production

npm run build

The built files will be in the dist/ directory.

Controls ๐ŸŽฎ

Menu Navigation

  • Enter: Start experience
  • Mouse: Navigate menu options

Game Controls (Play Mode)

  • A/D: Steer left/right
  • Space: Fire lasers
  • Shift: Fire bombs
  • Tab: Afterburner
  • Esc: Pause game
  • R: Restart game

Free Camera (Float Mode)

  • WASD: Move camera
  • Q/E: Move up/down
  • Mouse: Look around (pointer lock)
  • C: Toggle camera mode
  • Esc: Return to main menu

General Controls

  • T: Switch terrain environment
  • F: Toggle fog
  • P: Cycle performance stats

Project Structure ๐Ÿ“

src/
โ”œโ”€โ”€ game/                   # Game logic and systems
โ”‚   โ”œโ”€โ”€ Game.js            # Main game controller
โ”‚   โ”œโ”€โ”€ Player.js          # Fighter jet player
โ”‚   โ”œโ”€โ”€ InputManager.js    # Input handling
โ”‚   โ”œโ”€โ”€ CollisionDetector.js # Physics and collisions
โ”‚   โ””โ”€โ”€ EnvironmentEffectsManager.js # Particle effects
โ”œโ”€โ”€ ui/                    # User interface components
โ”‚   โ”œโ”€โ”€ UIManager.js       # UI controller
โ”‚   โ”œโ”€โ”€ ScreenManager.js   # Screen transitions
โ”‚   โ”œโ”€โ”€ ControlPanel.js    # Settings panel
โ”‚   โ””โ”€โ”€ IntroOverlay.js    # Start screen
โ”œโ”€โ”€ audio/                 # Audio system
โ”‚   โ””โ”€โ”€ AudioManager.js    # Music and sound effects
โ”œโ”€โ”€ assets/                # Static assets
โ”‚   โ”œโ”€โ”€ shaders/          # GLSL shader files
โ”‚   โ”œโ”€โ”€ models/           # 3D models
โ”‚   โ””โ”€โ”€ audio/            # Audio files
โ”œโ”€โ”€ environment/           # Environment management
โ”‚   โ””โ”€โ”€ EnvironmentManager.js # Terrain environments
โ”œโ”€โ”€ app.js                # Main application
โ”œโ”€โ”€ terrain.js            # Terrain generation
โ”œโ”€โ”€ LensFlare.js          # Lens flare effects
โ”œโ”€โ”€ material.js           # Material definitions
โ””โ”€โ”€ main.js               # Entry point

Key Systems ๐Ÿ”ง

Terrain Generation

The terrain system uses procedural noise generation combined with GPU-based displacement mapping for efficient, high-quality landscapes.

Shadow Mapping

Implements cascaded shadow maps (CSM) for realistic shadow rendering across large distances, essential for aerial gameplay.

Collision Detection

Uses height sampling for accurate collision detection between projectiles and the shader-displaced terrain.

Performance Optimization

  • LOD system reduces polygon count for distant terrain
  • Frustum culling eliminates off-screen objects
  • Efficient shader-based calculations
  • Mobile device optimization

Configuration โš™๏ธ

The game includes extensive configuration options accessible through the control panel:

  • Lighting: Sun time, intensity, ambient lighting
  • Shadows: Quality, distance, cascade settings
  • Terrain: Smoothing, height gain, noise resolution
  • Visual: Bloom, anti-aliasing, post-processing effects
  • Performance: Render quality, pixel ratio

Development ๐Ÿง‘โ€๐Ÿ’ป

Adding New Terrain Environments

  1. Create new shader files in src/assets/shaders/
  2. Add environment configuration in src/environment/
  3. Update the environment manager to include new options

Customizing Game Mechanics

  • Modify src/game/Player.js for flight physics
  • Update src/game/InputManager.js for control schemes
  • Extend src/game/CollisionDetector.js for new collision types

Shader Development

The project uses custom GLSL shaders for:

  • Terrain displacement and texturing
  • Shadow mapping
  • Post-processing effects
  • Atmospheric rendering

Performance Tips ๐Ÿ’ก

  • Shadow Quality: Lower shadow resolution for better performance
  • Terrain Detail: Reduce terrain levels on slower devices
  • Post-Processing: Disable bloom and anti-aliasing if needed
  • Render Scale: Lower pixel ratio for mobile devices

Browser Compatibility ๐ŸŒ

  • Chrome 90+
  • Firefox 88+
  • Safari 14+
  • Edge 90+

Requires WebGL 2.0 support.

Contributing ๐Ÿค

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License ๐Ÿ“„

This project is licensed under the ISC License - see the LICENSE file for details.

Acknowledgments ๐Ÿ™

  • Built with Three.js - 3D graphics library
  • Terrain system based on LOD Terrain by Felix Palmer
  • Music generated with Suno AI for atmospheric and combat tracks
  • Shader techniques from the WebGL and graphics programming community

Development Credits ๐Ÿค–

This entire project was vibe coded using AI assistance from:

  • Claude (Anthropic) - Primary development assistant
  • Codex (OpenAI) - Code generation and debugging
  • Gemini (Google) - Algorithm optimization and problem solving
  • Grok (xAI) - Creative solutions and feature ideation

The fusion of human creativity and AI collaboration made this ambitious 3D game possible.


Built with โค๏ธ using Three.js and modern web technologies

About

ai vibe coded plane game

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages