Skip to content

grep-many/phewland

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

18 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Phewland Logo Phewland โ€” Multiplayer 3D Shooter Playground

Phewland is a browserโ€‘based multiplayer 3D shooter playground built with React, Three.js, and peerโ€‘toโ€‘peer networking โ€” no backend server required.

A fastโ€‘paced experimental thirdโ€‘person shooter that runs entirely in the browser, combining modern React tooling, realโ€‘time physics, and hostโ€‘authoritative multiplayer.


๐Ÿ“› Badges

Game Multiplayer Networking React Three.js Physics Build License: MIT


๐Ÿ–ผ๏ธ Preview

Gameplay Preview


๐Ÿง  What This Project Is

  • ๐ŸŽฏ Realโ€‘time multiplayer shooter
  • ๐ŸŒ Fully browserโ€‘based (WebGL + WebRTC)
  • ๐Ÿšซ No traditional backend server
  • ๐Ÿงฑ Hostโ€‘authoritative peer synchronization
  • โš™๏ธ Physicsโ€‘driven gameplay
  • ๐Ÿงช Designed as:
    • A game prototype
    • A Reactโ€‘Threeโ€‘Fiber reference
    • A multiplayer architecture experiment

โœจ Features

  • ๐Ÿ”ซ Realโ€‘time shooting with physicsโ€‘based bullets
  • ๐Ÿง Thirdโ€‘person character controller
  • ๐ŸŒ 3D map & environment lighting
  • ๐Ÿ“ก Peerโ€‘toโ€‘peer multiplayer (PlayroomKit)
  • ๐Ÿ† Live leaderboard (kills / deaths)
  • ๐ŸŽฎ Joystick + keyboard support
  • ๐Ÿ’ฅ Hit effects & audio feedback
  • ๐Ÿ–ฅ๏ธ Fullscreen gameplay

๐Ÿ›  Tech Stack

Frontend / Game Engine

  • React 19
  • TypeScript
  • Vite
  • Three.js
  • @react-three/fiber
  • @react-three/drei
  • @react-three/postprocessing

Physics

  • Rapier Physics
  • @react-three/rapier

Multiplayer

  • playroomkit
    • Player state synchronization
    • Hostโ€‘authoritative logic
    • Peerโ€‘toโ€‘peer networking
    • Input abstraction

Styling & Assets

  • Tailwind CSS
  • GLTF / GLB 3D models
  • Action audio (MP3)

๐Ÿงฉ Architecture Overview

Phewland uses a hostโ€‘authoritative peerโ€‘toโ€‘peer model:

  • First player becomes the host
  • Host simulates:
    • Physics
    • Bullets
    • Damage
    • Kills / deaths
  • Other clients:
    • Send input
    • Receive synced state
  • Rendering and controls are fully local

Highโ€‘Level Architecture

graph TD
    Host[Host Player]
    Client1[Client Player]
    Client2[Client Player]

    Host -->|State Sync| Client1
    Host -->|State Sync| Client2

    Client1 -->|Input| Host
    Client2 -->|Input| Host
Loading

๐Ÿ—‚ Project Structure

.
โ”œโ”€โ”€ index.html
โ”œโ”€โ”€ package.json
โ”œโ”€โ”€ vite.config.ts
โ”œโ”€โ”€ eslint.config.js
โ”œโ”€โ”€ tsconfig*.json
โ”œโ”€โ”€ public/
โ”‚   โ””โ”€โ”€ vite.svg
โ”œโ”€โ”€ types/
โ”‚   โ””โ”€โ”€ global.d.ts
โ””โ”€โ”€ src/
    โ”œโ”€โ”€ main.tsx
    โ”œโ”€โ”€ App.tsx
    โ”œโ”€โ”€ index.css
    โ”œโ”€โ”€ assets/
    โ”‚   โ”œโ”€โ”€ audio/
    โ”‚   โ”œโ”€โ”€ models/
    โ”‚   โ””โ”€โ”€ index.ts
    โ””โ”€โ”€ components/
        โ”œโ”€โ”€ experience.tsx
        โ”œโ”€โ”€ map.tsx
        โ”œโ”€โ”€ leader-board.tsx
        โ”œโ”€โ”€ player-info.tsx
        โ”œโ”€โ”€ character-controller.tsx
        โ”œโ”€โ”€ character-soldier.tsx
        โ”œโ”€โ”€ crosshair.tsx
        โ”œโ”€โ”€ bullet.tsx
        โ””โ”€โ”€ bullet-hit.tsx

๐Ÿงฑ Core Modules Explained

  • Initializes WebGL canvas
  • Enables shadows & postโ€‘processing
  • Wraps the scene with physics & suspense

experience.tsx (Game Orchestrator)

  • Player join / leave handling
  • Bullet lifecycle management
  • Kill & death tracking
  • Network synchronization
  • Lighting & environment setup
  • Movement & rotation
  • Shooting logic
  • Camera follow
  • Health, death & respawn
  • Collision damage detection
  • Physicsโ€‘based bullets
  • Hostโ€‘validated collisions
  • Visual hit shards
  • Automatic cleanup
  • Live player list
  • Kill / death stats
  • Player colors & avatars
  • Fullscreen toggle

๐Ÿ” Core Gameplay Flow

sequenceDiagram
    participant Client
    participant Host

    Client->>Host: Movement Input
    Client->>Host: Fire Event

    Host->>Host: Simulate Physics
    Host->>Host: Detect Collisions
    Host->>Host: Update Game State

    Host->>Client: Sync State
Loading

๐ŸŽฎ Controls

  • Move: Keyboard or joystick
  • Aim: Player rotation
  • Fire: Shoot button
  • Fullscreen: Topโ€‘right icon

๐Ÿš€ Getting Started

Prerequisites

  • Node.js 18+
  • npm / pnpm / yarn

Installation

npm install

Development

npm run dev

Open: http://localhost:5173

Production Build

npm run build
npm run preview

๐ŸŒ Multiplayer Notes

  • First player becomes host
  • Host:
    • Controls physics
    • Validates hits
    • Updates scores
  • No dedicated server
  • If host disconnects โ†’ session resets

โš ๏ธ Assumptions & Limitations

  • No dedicated server
  • No anti-cheat system
  • Not suitable for large lobbies
  • Experimental networking
  • Browser performance dependent

๐Ÿ“œ License

This project is licensed under the MIT License. See the License: MIT for details.

About

Phewland is a browser-based multiplayer 3D shooter playground built with React, Three.js, Rapier, and PlayroomKit. It uses a host-authoritative peer-to-peer model for real-time gameplay, physics-based combat, and live leaderboard sync without a traditional backend server.

Topics

Resources

License

Stars

Watchers

Forks

Contributors