# CarverJS Documentation > React game engine built on Three.js with P2P multiplayer ## Installation pnpm add @carverjs/core ## Docs ### Components - [Game](https://docs.carverjs.dev/components/game.html): Game is the entry point for every CarverJS application. It wraps React Three Fiber's , sets up the WebGL renderer, lighting, environment, input system - [World](https://docs.carverjs.dev/components/world.html): World is a level/scene container inside a Game./game.md. It groups Actors./actor.md, sets up a default camera, and optionally enables physics. Toggle worlds on/ - [Actor](https://docs.carverjs.dev/components/actor.html): An Actor is any renderable entity you place in a scene. Every actor shares a common set of transform and event props, but the type field determines what gets re - [Camera](https://docs.carverjs.dev/components/camera.html): Camera gives you full control over the camera in a World scene. Drop it as a child of World to replace the default camera and controls with your own configurati - [AudioListener](https://docs.carverjs.dev/components/audio-listener.html): AudioListener overrides the default audio listener position. By default, the Web Audio listener follows the active R3F camera. Mount this component to follow a - [SceneManager](https://docs.carverjs.dev/components/scene-manager.html): SceneManager organizes your game into discrete scenes menus, levels, HUDs with lifecycle management, stack-based navigation, and visual transitions. Place it in - [Scene](https://docs.carverjs.dev/components/scene.html): Scene declaratively registers a scene configuration with the SceneManager./scene-manager.md. It does not render scene content — the SceneManager handles renderi - [AssetLoader](https://docs.carverjs.dev/components/asset-loader.html): AssetLoader is a declarative preloader that loads all assets in a manifest before rendering its children. It shows a fallback typically a LoadingScreen./loading - [LoadingScreen](https://docs.carverjs.dev/components/loading-screen.html): LoadingScreen is a pre-built, customizable loading screen component designed to work with AssetLoader./asset-loader.md. It renders as HTML content within the As - [ParticleEmitter](https://docs.carverjs.dev/components/particle-emitter.html): ParticleEmitter is a declarative component for creating particle effects. Drop it into a scene or as a child of an Actor./actor.md to add fire, smoke, explosion ### Hooks - [useAnimation](https://docs.carverjs.dev/hooks/use-animation.html): Manages animation playback for GLTF/GLB models. Wraps drei's useAnimations with play/pause, speed control, looping, and crossfade support. - [useCamera](https://docs.carverjs.dev/hooks/use-camera.html): Provides imperative camera controls — shake, smooth transitions, and look-at. Used internally by the Camera component, but available directly for advanced use c - [useGameLoop](https://docs.carverjs.dev/hooks/use-game-loop.html): Registers a per-frame callback with control over update stage, timestep mode, and integration with the global game phase. Built on R3F's useFrame with priority- - [useInput](https://docs.carverjs.dev/hooks/use-input.html): useInput provides keyboard and pointer input for game logic. It reads from the InputManager../systems/input-manager.md which is automatically set up by Game../c - [useCollision](https://docs.carverjs.dev/hooks/use-collision.html): useCollision registers a lightweight collider on an Actor and fires callbacks when it overlaps with other colliders. No physics engine required — this is Carver - [useGridCollision](https://docs.carverjs.dev/hooks/use-grid-collision.html): useGridCollision provides a tile-based collision grid with O1 lookups. Ideal for grid-based games like Snake, tile RPGs, puzzle games, or any game that uses dis - [usePhysics](https://docs.carverjs.dev/hooks/use-physics.html): usePhysics provides an imperative API for controlling a Rapier rigid body. Use it inside children of a physics-enabled Actor../components/actor.md to apply impu - [useAudio](https://docs.carverjs.dev/hooks/use-audio.html): useAudio provides sound effects, music, and volume control for game logic. It reads from the AudioManager../systems/audio-manager.md which is automatically set - [useScene](https://docs.carverjs.dev/hooks/use-scene.html): useScene provides scene navigation and status. It reads from the scene store managed by SceneManager../components/scene-manager.md. - [useAssets](https://docs.carverjs.dev/hooks/use-assets.html): useAssets provides synchronous access to preloaded assets from the AssetManager../systems/asset-manager.md cache. Assets must be preloaded via AssetLoader../com - [useAssetProgress](https://docs.carverjs.dev/hooks/use-asset-progress.html): useAssetProgress subscribes to the AssetManager../systems/asset-manager.md's loading progress. It does not suspend — it returns the current snapshot and re-rend - [useTween](https://docs.carverjs.dev/hooks/use-tween.html): useTween provides property tweening, number interpolation, and timeline sequencing for game animations. It reads from the TweenManager../systems/tween-manager.m - [useParticles](https://docs.carverjs.dev/hooks/use-particles.html): useParticles creates and controls a particle emitter for visual effects like fire, smoke, explosions, and more. It reads from the ParticleManager../systems/part ### Types - [Types](https://docs.carverjs.dev/types/index.html): All types are importable from @carverjs/core/types. ### Multiplayer - [Getting Started with Multiplayer](https://docs.carverjs.dev/multiplayer/getting-started.html): CarverJS Multiplayer adds peer-to-peer networking to any CarverJS game. One player acts as the host, relaying state to all connected clients. Add a provider, ma - [Core Concepts](https://docs.carverjs.dev/multiplayer/core-concepts.html): This page covers the fundamental building blocks of CarverJS multiplayer: the host-client model, the networked prop, actor ownership, connection states, sync mo - [Lobby & Room Management](https://docs.carverjs.dev/multiplayer/lobby-and-rooms.html): CarverJS multiplayer ships four hooks that cover the entire lobby-to-gameplay lifecycle: discovering rooms, joining one, reading player state, and managing the - [Sync Modes](https://docs.carverjs.dev/multiplayer/sync-modes.html): CarverJS multiplayer provides three sync layers that can be used independently or combined. Each layer targets a different update frequency and game type — pick - [Configuration Reference](https://docs.carverjs.dev/multiplayer/configuration.html): Complete reference for every configurable option in the CarverJS multiplayer system. All options have sensible defaults — you only need to override what you wan - [Advanced Topics](https://docs.carverjs.dev/multiplayer/advanced.html): Deep dives into custom transports, dynamic spawning, interest management, performance tuning, and other advanced multiplayer patterns. - [MultiplayerBridge](https://docs.carverjs.dev/multiplayer/multiplayer-bridge.html): bridges the multiplayer context from the parent React tree into the R3F Canvas. This is required when is placed outsid ### Systems - [InputManager](https://docs.carverjs.dev/systems/input-manager.html): InputManager is a singleton that captures keyboard, pointer, and touch events from the DOM and makes them available to game logic on a per-frame basis. - [CollisionManager](https://docs.carverjs.dev/systems/collision-manager.html): CollisionManager is a singleton that runs AABB, sphere, and circle overlap detection each frame. It uses a spatial hash for broad-phase culling and supports lay - [GridCollisionManager](https://docs.carverjs.dev/systems/grid-collision-manager.html): GridCollisionManager is a singleton that manages a 2D tile-based collision grid backed by an Int32Array. It provides O1 cell lookups, neighbor queries, and worl - [PhysicsProvider](https://docs.carverjs.dev/systems/physics-provider.html): PhysicsProvider is an internal system that conditionally wraps scene content in Rapier physics. It consists of two components: - [AudioManager](https://docs.carverjs.dev/systems/audio-manager.html): AudioManager is a singleton that manages all audio playback using the Web Audio API, with an automatic HTML5 Audio fallback for environments without Web Audio s - [SceneManager (System)](https://docs.carverjs.dev/systems/scene-manager.html): The SceneManagerImpl singleton provides imperative scene navigation for use outside React components — in event handlers, network callbacks, or third-party libr - [AssetManager](https://docs.carverjs.dev/systems/asset-manager.html): AssetManager is a singleton that handles loading, caching, and lifecycle management of game assets. It supports GLTF models, textures, audio, JSON, and binary d - [TweenManager](https://docs.carverjs.dev/systems/tween-manager.html): TweenManager is a singleton that manages all property tweening, number interpolation, and timeline sequencing. It uses an object pool for zero-GC per-frame perf - [ParticleManager](https://docs.carverjs.dev/systems/particle-manager.html): ParticleManager is a singleton that manages all particle emitters. It uses GPU-instanced rendering via InstancedMesh and Structure-of-Arrays SoA particle data f ## Full Documentation Content --- ### Components > Game URL: https://docs.carverjs.dev/components/game.html Game Game is the entry point for every CarverJS application. It wraps React Three Fiber's World URL: https://docs.carverjs.dev/components/world.html World World is a level/scene container inside a Game./game.md. It groups Actors./actor.md, sets up a default camera, and optionally enables physics. Toggle worlds on/off with the active prop. A Game can have multiple Worlds — only the active one is visible and receives rendering. --- Quick Start --- Props Reference Prop Type Default Description ---------------------------------- active boolean true Whether this world is visible. Set to false to hide it. physics WorldPhysicsConfig — Enable Rapier physics. Requires @react-three/rapier. cameraProps2D CameraProps2D — Overrides for the default OrthographicCamera 2D mode cameraProps3D CameraProps3D — Overrides for the default PerspectiveCamera 3D mode orbitControlsProps OrbitControlsProps — Overrides for the default OrbitControls 3D mode children ReactNode — Scene content Actors, Camera, etc. --- Physics Pass a physics prop to enable Rapier-based physics for all Actors in the World. Install @react-three/rapier is an optional peer dependency — Rapier is lazy-loaded at runtime. If it's not installed and you pass a physics prop, a console warning is logged and children render without physics. WorldPhysicsConfig Field Type Default Description ----------------------------------- gravity number, number, number 0, -9.81, 0 Gravity vector timestep number \ "vary" 1/60 Physics timestep. "vary" uses variable timestep. interpolation boolean true Smooth rendering between physics steps debug boolean false Show wireframe collider outlines Basic physics 2D physics In 2D mode, Z translation and X/Y rotation are auto-locked per Actor. Debug mode :::tip Physics is configured at the World level, but each Actor opts-in individually via its own physics prop. See Actor./actor.md for ActorPhysicsProps. ::: --- Default Camera World provides a default camera based on the mode set on the parent Game: Property 3D Mode 2D Mode ---------------------------- Type PerspectiveCamera OrthographicCamera Position 0, 5, 10 0, 0, 100 FOV / Zoom 75 50 Near / Far 0.1 / 1000 0.1 / 1000 Orbit Controls Enabled Disabled Override defaults --- Custom Camera Drop a