Skip to content

Latest commit

ย 

History

127 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿš€ SPACESHIPS

3D multiplayer space combat โ€” pilot, fight, and dominate the asteroid field

Play Now

Three.js Node.js JavaScript WebSocket SQLite Express JWT


Table of Contents


โœจ Features

Feature Description
๐ŸŒŒ 3D Space Combat Fully realized 3D environments with asteroids, moons, and a dynamic skybox
๐ŸŒ Real-time Multiplayer Live dogfights with WebSocket sync across all connected pilots
๐ŸŽฏ Campaign Mode Three-mission story arc with a boss capital ship, checkpoints, and a lives system
๐Ÿš€ Homing Missiles Smart missiles with obstacle avoidance โ€” countered by flares
๐ŸŽจ Ship Customization Personalize your color scheme, saved to your pilot account
๐ŸŽฎ Gamepad Support Full controller support via the Web Gamepad API
๐Ÿ“ฑ Mobile Ready Touch-friendly HUD with virtual joystick and on-screen buttons
๐Ÿค– AI Opponents Bot pilots with pathfinding and combat logic
๐Ÿ”’ Pilot Accounts Secure auth with bcrypt + JWT to track stats and customization
โšก 60 FPS Optimized Frustum culling, instanced rendering, and batched WebSocket messages

๐ŸŽฎ Game Modes

Campaign

Three sequential missions, each unlocked by completing the previous one. Progress is saved locally.

flowchart LR
    A([๐Ÿš€ Mission Select]) --> B
    B["Mission 1
    Asteroid Corridor"] -->|complete| C
    C["Mission 2
    Deep Space Push"] -->|complete| D
    D["Mission 3
    Capital Ship Boss"] -->|victory| E([๐Ÿ† Campaign Complete])

    style A fill:#1e1b4b,color:#c7d2fe,stroke:#4338ca
    style B fill:#0f172a,color:#7dd3fc,stroke:#0369a1
    style C fill:#0f172a,color:#7dd3fc,stroke:#0369a1
    style D fill:#450a0a,color:#fca5a5,stroke:#b91c1c
    style E fill:#14532d,color:#bbf7d0,stroke:#15803d
Loading

Lives system: You get 3 lives per run. Dying warp-flashes you back to the last checkpoint at 55% health โ€” no full restarts.

The boss is a fully animated capital ship with 4 rotating turrets, patrol movement, and 12 hitbox zones spread across its hull.

Multiplayer

Join or create a lobby and compete against other pilots in real time. Ship positions, rotations, weapon fire, and damage are all synchronized via WebSocket.

Solo

Freeplay against AI bot opponents to sharpen your skills, or just explore the asteroid field at your own pace.


๐Ÿ•น๏ธ Controls

Keyboard & Mouse

Input Action
W / S Thrust forward / back
A / D Roll left / right
Mouse Aim and look
Left Click Fire bullets
Right Click (hold) Free-look camera
F Fire homing missile
Q Deploy flares (missile countermeasure)
Shift Boost
Space Drift

Gamepad

Input Action
Left Stick Roll / Throttle
Right Stick Aim / Look
RT / A Fire
LB Boost
LT Drift
Start Menu

Touch

Virtual joystick on the left half of the screen drives movement. On-screen buttons handle weapons, boost, and drift. A throttle slider gives fine speed control.


โš”๏ธ Weapons

Weapon Type Notes
Bullets Rapid-fire projectiles Short range, high rate of fire
Beam Sustained energy weapon Overheats with continuous use
Missiles Homing projectiles Navigates around asteroids; look-on-target to lock
Flares Countermeasure Deploys 20 decoys that burn ~1.8 s each burst
flowchart LR
    Fire["Fire Missile ๐Ÿš€"] --> Tracking["Homing\n(obstacle avoidance)"]
    Tracking -->|target clear| Hit["๐Ÿ’ฅ Hit"]
    Tracking -->|flares detected| Seduced["Diverts to flare"]
    Seduced --> Miss["โœ— Miss"]

    style Fire fill:#1e1b4b,color:#c7d2fe,stroke:#4338ca
    style Hit fill:#14532d,color:#bbf7d0,stroke:#15803d
    style Miss fill:#450a0a,color:#fca5a5,stroke:#b91c1c
    style Tracking fill:#0f172a,color:#7dd3fc,stroke:#0369a1
    style Seduced fill:#451a03,color:#fed7aa,stroke:#c2410c
Loading

๐Ÿ—๏ธ Architecture

graph TD
    Browser["๐Ÿ–ฅ๏ธ Browser Client\nThree.js ยท ES6 Modules"]
    Server["โš™๏ธ Node.js Server\nExpress ยท ws"]
    DB[("๐Ÿ—„๏ธ SQLite\npilots.db")]

    Browser <-->|"WebSocket โ€” positions, combat, events"| Server
    Browser -->|"HTTP โ€” auth, static assets"| Server
    Server <--> DB

    subgraph client ["Client Modules"]
        direction LR
        Renderer["Three.js\nRenderer"]
        Physics["Ship\nPhysics"]
        Weapons["Weapons\nbullets ยท beams ยท missiles"]
        Audio["Audio\nEngine"]
        Input["Input\nKB ยท Gamepad ยท Touch"]
    end

    Browser --- client
Loading

๐Ÿ“ Project Structure

โ”œโ”€โ”€ public/
โ”‚   โ””โ”€โ”€ src/
โ”‚       โ”œโ”€โ”€ main.js           # Game loop, state, campaign logic
โ”‚       โ”œโ”€โ”€ ship.js           # Ship model, movement, physics
โ”‚       โ”œโ”€โ”€ bot.js            # AI pathfinding and combat
โ”‚       โ”œโ”€โ”€ lobby.js          # Lobby, matchmaking, campaign routing
โ”‚       โ”œโ”€โ”€ auth.js           # Client-side authentication
โ”‚       โ”‚
โ”‚       โ”œโ”€โ”€ bullets.js        # Rapid-fire projectile system
โ”‚       โ”œโ”€โ”€ beams.js          # Sustained beam weapon
โ”‚       โ”œโ”€โ”€ missiles.js       # Homing missiles + flare countermeasures
โ”‚       โ”‚
โ”‚       โ”œโ”€โ”€ input.js          # Keyboard / mouse / gamepad
โ”‚       โ”œโ”€โ”€ touchhud.js       # Mobile touch controls
โ”‚       โ”œโ”€โ”€ camera.js         # Third-person camera
โ”‚       โ”œโ”€โ”€ customization.js  # Ship customization UI
โ”‚       โ”œโ”€โ”€ audio.js          # Sound effects and music
โ”‚       โ”œโ”€โ”€ filter.js         # Post-processing visual filters
โ”‚       โ”‚
โ”‚       โ”œโ”€โ”€ asteroids.js      # Asteroid generation and physics
โ”‚       โ”œโ”€โ”€ skybox.js         # Space background rendering
โ”‚       โ”œโ”€โ”€ trails.js         # Engine trail particles
โ”‚       โ”œโ”€โ”€ moon.js           # Moon rendering
โ”‚       โ”œโ”€โ”€ mothership.js     # Static mothership object
โ”‚       โ”œโ”€โ”€ warp.js           # Warp jump visual effect
โ”‚       โ”‚
โ”‚       โ”œโ”€โ”€ carrier.js        # Aircraft carrier (team base)
โ”‚       โ”œโ”€โ”€ terrain.js        # Ground terrain + airfields
โ”‚       โ”œโ”€โ”€ airfield.js       # Landing and spawn zones
โ”‚       โ”œโ”€โ”€ trees.js          # Environmental foliage
โ”‚       โ”œโ”€โ”€ water.js          # Water surface rendering
โ”‚       โ””โ”€โ”€ clouds.js         # Volumetric cloud layer
โ”‚
โ”œโ”€โ”€ server/
โ”‚   โ”œโ”€โ”€ index.js              # Express routes + WebSocket handler
โ”‚   โ””โ”€โ”€ db.js                 # SQLite interface
โ”‚
โ”œโ”€โ”€ index.html                # Entry point
โ””โ”€โ”€ pilots.db                 # Pilot accounts database

๐Ÿ› ๏ธ Tech Stack

Frontend

Three.js JavaScript

Backend

Node.js Express SQLite

Auth & Security

JWT bcrypt


๐Ÿ“„ License

This game and all its code, assets, and design are the exclusive property of the creators. Unauthorized copying, reproduction, distribution, or use of this game in any form is strictly prohibited.


๐Ÿ‘พ Credits

Role Contributor
Game creator & Logic Ian
Online play & backend infrastructure Gheat

About

three JS space shooter

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages