Multiplayer Movement & Sync Library for JavaScript
Get Started GitHub Examples

Welcome to Puppeteer.js

Puppeteer is a modular, extensible JavaScript library designed to support multiplayer game development using 3D frameworks like Three.js. It includes networking, interpolation, prediction, and movement handling, and is structured to scale up to competitive or simulation-heavy multiplayer games.

Whether you're building a simple cooperative game or a complex competitive multiplayer experience, Puppeteer provides the tools you need to synchronize player movements, handle network latency, and create smooth gameplay.

🧮
3D Math Utilities

Built-in Vector3, Quaternion, and Transform classes for efficient 3D calculations and manipulations.

🔄
Interpolation System

Snapshot-based interpolation system for smooth visual representation of networked objects.

🌐
WebSocket Networking

Client and host implementations for easy multiplayer room setup and state synchronization.

🏃
Movement Controllers

Physics-based movement with directional controls for responsive character movement.

⏱️
Utilities

Common utilities like Clock, Logger, and UUID generators to support your development.

🔌
Framework Integration

Designed to work seamlessly with popular 3D frameworks like Three.js.

Project Structure

Puppeteer is organized into modular components that can be used independently or together:

/puppeteer/ ├── core/ - Basic math classes (Vector3, Quaternion, Transform) ├── interp/ - Interpolation, snapshot logic ├── net/ - Networking (client & host) ├── movement/ - Physics & directional movement ├── utils/ - Utility modules (Clock, Logger, UUID) ├── index.js - Library entry point └── sample.html - Example usage with Three.js

Core Concepts

Vector3 / Quaternion:
Core math utilities for 3D space.
Transform:
Combines position and rotation.
Snapshot:
Stores a Transform with a timestamp.
Interpolator:
Computes smooth transitions between Snapshots.
RoomClient:
Handles WebSocket client networking.
RoomHost:
Hosts WebSocket server for multiplayer rooms.
MovementController:
Moves a player in a specific direction based on speed and deltaTime.

Quick Start

Install Puppeteer using npm:

npm install puppeteer-js

Or include it via CDN:

<script src="https://cdn.example.com/puppeteer/latest/puppeteer.min.js"></script>

Basic usage with ES6 imports:

import Puppeteer from './puppeteer/index.js'; // Create a player transform const playerTransform = new Puppeteer.Transform( new Puppeteer.Vector3(0, 0, 0), new Puppeteer.Quaternion() ); // Connect to multiplayer room const client = new Puppeteer.Net.RoomClient("wss://example.com/game"); // Set up movement controller const movement = new Puppeteer.Movement.MovementController(playerTransform);

Ready to Dive In?

Explore our comprehensive documentation to learn more about Puppeteer's features and how to integrate them into your multiplayer games.

View Full Documentation See Examples