Overview
The@hyperscape/client package is the web game client:
- Vite for fast builds with HMR
- React 19 UI framework
- Three.js 3D rendering (WebGPU with WebGL fallback)
- Privy authentication
- Farcaster miniapp SDK
- Tauri desktop app support
- Solana wallet integration
Rendering
WebGPU with WebGL Fallback
The client usesTHREE.WebGPURenderer with automatic fallback to WebGL for compatibility:
WebGPU (Preferred):
- Modern high-performance rendering
- TSL post-processing effects
- Cascaded shadow maps (CSM)
- Requires Chrome 113+, Edge 113+, or Safari 17+
- Graceful degradation for older browsers and WebViews
- Single directional shadow maps (no CSM)
- Disabled TSL post-processing
- Works in WKWebView (Tauri), older Safari, and browsers without WebGPU
Package Location
Screens
Located insrc/screens/:
UI System Architecture
UI System (src/ui/)
Complete UI system with components, hooks, stores, and theming:
Game Components (src/game/components/)
Domain-organized game UI components:
HUD Components (src/game/hud/)
Anchor-Based Positioning
Windows use Unity/Unreal-style anchors for responsive scaling:- 9 anchor points: corners, edges, center
- Offset-based: Windows store offset from anchor, not absolute position
- Responsive: Preserves anchor relationships on resize
- Default anchors:
- Chat, Skills/Prayer:
bottom-left - Minimap:
top-right - Inventory, Menubar:
bottom-right - Action bar:
bottom-center
- Chat, Skills/Prayer:
Drag-and-Drop System
Powered by@dnd-kit with custom enhancements:
- Inventory items: Drag to move, combine, or drop
- Action bar: Drag skills, prayers, combat styles
- Tabs: Drag to reorder or combine windows
- Windows: Drag headers to move
- Context menus: Right-click for OSRS-style menus
Environment Variables
Development
Production (Cloudflare Pages)
All
PUBLIC_* variables are exposed to the browser. Never put secrets in client environment variables.Running
Development
Production Build
Dependencies
Deployment
Cloudflare Pages (Production)
The client deploys to Cloudflare Pages with automatic GitHub integration: Configuration:- Build command:
cd packages/client && bun install && bun run build - Build output:
packages/client/dist - Root directory:
/(monorepo root) - Node version: 22
- Push to
mainbranch - Cloudflare Pages detects changes to
packages/client/** - Builds client with Vite
- Deploys to
hyperscape.pages.devandhyperscape.club - Creates preview deployments for pull requests
- URL pattern:
https://<branch>-<hash>.hyperscape.pages.dev - Automatic for every PR
- Uses production environment variables
- CORS automatically allows
*.hyperscape.pages.devorigins