Client Application
The Hyperscape client is a React-based web application with Three.js WebGPU rendering. It provides a modern MMORPG experience with VRM avatars, responsive UI panels, and real-time multiplayer.Client code lives in
packages/client/src/. The rendering systems are in packages/shared/src/systems/client/.Architecture Overview
Entry Point
The client entry point ispackages/client/src/index.tsx:
Authentication Flow
Authentication uses Privy for wallet-based login:Screens
Login Screen
- Wallet connection via Privy
- Social login (email, Google)
- Session persistence
Character Select Screen
- List existing characters
- Create new character
- Character preview with VRM avatar
Game Client
- Main game loop
- World initialization
- UI overlay rendering
UI Architecture
The client uses a clear separation between reusable UI primitives and game-specific code:UI Design System (src/ui/)
Pure, reusable UI components and systems:
Game-Specific Code (src/game/)
All game logic and components:
Core UI (CoreUI.tsx)
The main UI wrapper that renders HUD elements and game panels:3D Graphics System
Renderer (WebGPU with WebGL Fallback)
The graphics system uses Three.js with WebGPU for high-performance rendering, with automatic WebGL fallback for environments that don’t support WebGPU (e.g., WKWebView in Tauri, older browsers):Renderer Backend Detection
WebGL Fallback Features
When running on WebGL backend:- No TSL Post-Processing: Bloom, tone mapping, and color grading are disabled
- Simplified Shadows: Single directional light instead of Cascaded Shadow Maps (CSM)
- Auto Exposure: Still works (tone mapping exposure is renderer-agnostic)
- Settings Panel: Displays “WebGL” instead of “WebGPU”
Rendering Pipeline
- Pre-render: Update matrices, frustum culling
- Shadow Pass: Render cascaded shadow maps
- Main Pass: Render scene with deferred lighting
- Post-Processing: Bloom, tone mapping, effects (TSL-based)
- UI Overlay: Render 2D React UI on top
Model Loading & Transform Baking
TheModelCache system handles GLTF model loading with transform baking to prevent rendering issues:
- Position/rotation/scale properties
- Baked into matrices
- Non-decomposable transforms (shear)
Camera System
Supports multiple camera modes:VRM Avatar System
Characters use VRM format avatars with humanoid bone mapping:VRM Bone Mapping
Client Systems
Located inpackages/shared/src/systems/client/: