CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.Project Overview
Hyperscape is a RuneScape-style MMORPG built on a custom 3D multiplayer engine. The project features a real-time 3D metaverse engine (Hyperscape) in a persistent world.CRITICAL: Secrets and Private Keys
Never put private keys, seed phrases, API keys, tokens, RPC secrets, or wallet secrets into any tracked file.- ALWAYS use local untracked
.envfiles for real secrets during development - NEVER hardcode secrets in source, tests, docs, fixtures, scripts, config files, or GitHub workflow files
- NEVER place real credentials in
.env.example; placeholders only - Production and CI secrets must live in the platform secret manager, not in git
- If a new secret is required, add only the variable name to docs or
.env.exampleand load the real value from.env,.env.local, or deployment secrets
CRITICAL: WebGPU Required (NO WebGL)
Hyperscape requires WebGPU. WebGL WILL NOT WORK. This is a hard requirement due to our use of TSL (Three Shading Language) for all materials and post-processing effects. TSL only works with the WebGPU node material pipeline.Why WebGPU-Only?
- TSL Shaders: All materials use Three.js Shading Language (TSL) which requires WebGPU
- Post-Processing: Bloom, tone mapping, and other effects use TSL-based node materials
- No Fallback: There is NO WebGL fallback - the game will not render without WebGPU
Browser Requirements
- Chrome 113+ (recommended)
- Edge 113+
- Safari 18+ (macOS 15+) - Safari 17 support was removed
- Firefox (behind flag, not recommended)
- Check WebGPU availability: webgpureport.org
Server/Streaming Requirements
For Vast.ai and other GPU servers running the streaming pipeline:- NVIDIA GPU with Display Driver REQUIRED - Must have
gpu_display_active=trueon Vast.ai - Display Driver vs Compute: WebGPU requires GPU display driver support, not just compute access
- Must run non-headless with Xorg or Xvfb (WebGPU requires window context)
- Chrome Beta Channel: Use
google-chrome-betafor WebGPU streaming (better stability than Dev/Canary) - ANGLE Backend: Use Vulkan ANGLE backend (
--use-angle=vulkan) on Linux NVIDIA for WebGPU stability - Xvfb Virtual Display:
scripts/deploy-vast.shstarts Xvfb before PM2 to ensure DISPLAY is available - PM2 Environment:
ecosystem.config.cjsexplicitly forwardsDISPLAY=:99andDATABASE_URLthrough PM2 - Capture Mode: Default to
STREAM_CAPTURE_MODE=cdp(Chrome DevTools Protocol) for reliable frame capture - FFmpeg: Prefer system ffmpeg over ffmpeg-static to avoid segfaults (resolution order:
/usr/bin/ffmpeg→/usr/local/bin/ffmpeg→ PATH → ffmpeg-static) - Playwright: Block
--enable-unsafe-swiftshaderinjection to prevent CPU software rendering - If GPU cannot initialize WebGPU, deployment MUST FAIL (no soft fallbacks)
- Linux NVIDIA: Use ANGLE Vulkan (
--use-angle=vulkan --enable-features=DefaultANGLEVulkan,Vulkan,VulkanFromANGLE)- ANGLE OpenGL ES (
--use-angle=gl) fails with “Invalid visual ID” on NVIDIA - Native Vulkan (
--use-vulkan) crashes - Only ANGLE’s Vulkan backend works reliably
- ANGLE OpenGL ES (
- macOS: Use Metal backend (
--use-angle=metal)
Development Rules for WebGPU
- NEVER add WebGL fallback code - it will not work with TSL shaders
- NEVER use
--disable-webgpuorforceWebGLflags - NEVER use headless Chrome modes that don’t support WebGPU
- All renderer code must assume WebGPU availability
- If WebGPU is unavailable, throw an error immediately
Essential Commands
Development Workflow
Package-Specific Commands
Testing
Mobile Development
Documentation
Architecture Overview
Monorepo Structure
This is a Turbo monorepo with packages:gold-betting-demo, evm-contracts, sim-engine, market-maker-bot) has been split into a separate repository: HyperscapeAI/hyperbet. The duel arena oracle remains in Hyperscape for verifiable outcome publishing.
Build Dependency Graph
Critical: Packages must build in this order due to dependencies:- physx-js-webidl - PhysX WASM (takes longest, ~5-10 min first time)
- shared - Depends on physx-js-webidl
- All other packages - Depend on shared
turbo.json configuration handles this automatically via dependsOn: ["^build"].
TODO(AUDIT-004): CIRCULAR DEPENDENCY - shared ↔ procgen There is a circular dependency between@hyperscape/sharedand@hyperscape/procgen.Current workaround: procgen build ignores TypeScript errors. Recommended fix: Extract shared types to
- shared imports procgen for vegetation/terrain generation
- procgen imports shared for TileCoord type in viewers
@hyperscape/typespackage:
- Create new package with only type definitions (no runtime code)
- Both shared and procgen depend on types (no circular dep)
- Move TileCoord, Position3D, EntityData to types package
Entity Component System (ECS)
The RPG is built using Hyperscape’s ECS architecture:- Entities: Game objects (players, mobs, items, trees)
- Components: Data containers (position, health, inventory)
- Systems: Logic processors (combat, skills, movement)
RPG Implementation Architecture
Important: Despite references to “Hyperscape apps (.hyp)” in development rules,.hyp files do not currently exist. This is an aspirational architecture pattern for future development.
Current Implementation:
The RPG is built directly into packages/shared/src/ using:
- Entity Classes: PlayerEntity.ts, MobEntity.ts, ItemEntity.ts
- ECS Systems: Combat, inventory, skills, AI in src/systems/
- Components: Data containers for stats, health, equipment, etc.
- Keep RPG game logic conceptually isolated from core Hyperscape engine
- Use existing Hyperscape abstractions (ECS, networking, physics)
- Don’t reinvent systems that Hyperscape already provides
- Separation of concerns: core engine vs. game content
Critical Development Rules
TypeScript Strong Typing
NOany types are allowed - ESLint will reject them.
- Prefer classes over interfaces for type definitions
- Use type assertions when you know the type:
entity as Player - Share types from
types.tsfiles - don’t recreate them - Use
import typefor type-only imports - Make strong type assumptions based on context (don’t over-validate)
File Management
Don’t create new files unless absolutely necessary.- Revise existing files instead of creating
_v2.tsvariants - Delete old files when replacing them
- Update all imports when moving code
- Clean up test files immediately after use
- Don’t create temporary
check-*.ts,test-*.mjs,fix-*.jsfiles
Testing Philosophy
NO MOCKS - Use real Hyperscape instances with Playwright. Every feature MUST have tests that:- Start a real Hyperscape server
- Open a real browser with Playwright
- Execute actual gameplay actions
- Verify with screenshots + Three.js scene queries
- Save error logs to
/logs/folder
- 🔴 Players
- 🟢 Goblins
- 🔵 Items
- 🟡 Trees
- 🟣 Banks
Production Code Only
- No TODOs or “will fill this out later” - implement completely
- No hardcoded data - use JSON files and general systems
- No shortcuts or workarounds - fix root causes
- Build toward the general case (many items, players, mobs)
Separation of Concerns
- Data vs Logic: Never hardcode data into logic files
- RPG vs Engine: Keep RPG isolated from Hyperscape core
- Types: Define in
types.ts, import everywhere - Systems: Use existing Hyperscape systems before creating new ones
Working with the Codebase
Understanding Hyperscape Systems
Before creating new abstractions, research existing Hyperscape systems:- Check packages/shared/src/systems/
- Look for similar patterns in existing code
- Use Hyperscape’s built-in features (ECS, networking, physics)
- Read entity/component definitions in
types/folders
Common Patterns
Getting Systems:Development Server
The dev server provides:- Hot module replacement (HMR) for client
- Auto-rebuild and restart for server
- Watch mode for shared package
- Colored logs for debugging
Port Allocation
All services have unique default ports to avoid conflicts:| Port | Service | Env Var | Started By |
|---|---|---|---|
| 3333 | Game Client | VITE_PORT | bun run dev |
| 3400 | AssetForge UI | ASSET_FORGE_PORT | bun run dev:forge |
| 3401 | AssetForge API | ASSET_FORGE_API_PORT | bun run dev:forge |
| 3402 | Docusaurus | (hardcoded) | bun run docs:dev |
| 4001 | ElizaOS API | (hardcoded) | bun run dev:ai |
| 5555 | Game Server | PORT | bun run dev |
| 8080 | Asset CDN | (hardcoded) | bun run cdn:up |
Environment Variables
Zero-config local development: The defaults work out of the box. Just runbun run dev.
Secret handling is non-negotiable:
- Real private keys and API tokens must come from local untracked
.envfiles - Tracked files may only contain placeholders and variable names
- If you find a real credential in a tracked file, remove it and move it to
.envor the deployment secret store immediately
.env files: Each package has its own .env.example with deployment documentation:
| Package | File | Purpose |
|---|---|---|
| Server | packages/server/.env.example | Server deployment (Railway, Fly.io, Docker), streaming, oracle |
| Client | packages/client/.env.example | Client deployment (Vercel, Netlify, Pages) |
| AssetForge | packages/asset-forge/.env.example | AssetForge deployment |
| Plugin | packages/plugin-hyperscape/.env.example | ElizaOS agent configuration |
PUBLIC_PRIVY_APP_ID(client) must equalPRIVY_APP_ID(server)PUBLIC_WS_URLandPUBLIC_API_URLmust point to your server
Package Manager
This project uses Bun (v1.1.38+) as the package manager and runtime.- Install:
bun install(NOTnpm install) - Run scripts:
bun run <script>orbun <file> - Some commands use
npmprefix for Turbo workspace filtering
Tech Stack
- Runtime: Bun v1.1.38+
- Rendering: WebGPU ONLY (Three.js WebGPURenderer + TSL shaders) - NO WebGL
- Engine: Three.js 0.183.2, PhysX (WASM)
- UI: React 19.2.0, styled-components
- Server: Fastify, WebSockets, LiveKit
- Database: PostgreSQL (production via Neon/Railway, connection pool: 20), Docker (local)
- Testing: Playwright, Vitest 4.x (upgraded from 2.x for Vite 6 compatibility)
- Build: Turbo, esbuild, Vite
- Mobile: Capacitor 8.2.0
- AI Agents: ElizaOS
alphapackages - Streaming: FFmpeg (system preferred over ffmpeg-static), Playwright Chromium, RTMP
- Icons: Lucide React 0.577.0
- 3D Utilities: three-mesh-bvh 0.9.9
Troubleshooting
Build Issues
PhysX Build Fails
PhysX is pre-built and committed. If it needs rebuilding:Port Conflicts
Tests Failing
- Ensure server is not running before tests
- Check
/logs/folder for error details - Tests spawn their own Hyperscape instances
- Visual tests require WebGPU support (headful browser with GPU access)
- CI Test Exclusions:
@hyperscape/impostorexcluded from headless CI (requires WebGPU)
Streaming Issues
If RTMP streaming fails to start:- Verify stream keys are set:
TWITCH_STREAM_KEY,KICK_STREAM_KEY,YOUTUBE_STREAM_KEY - Check
STREAM_ENABLED_DESTINATIONSis set or auto-detected - Ensure FFmpeg is installed:
which ffmpegor setFFMPEG_PATH - Verify Playwright Chromium is installed:
bunx playwright install chromium - Check GPU display driver is active (Vast.ai:
gpu_display_active=true) - Verify Chrome Beta is installed:
google-chrome-beta --version - Check Xvfb is running:
ps aux | grep Xvfb - Verify DISPLAY environment variable:
echo $DISPLAY(should be:99) - Review logs:
bunx pm2 logs hyperscape-duel
Deployment Issues
SSH Timeout (Vast.ai):- Background processes (Xvfb, socat) must use
disownto detach from SSH session - Without
disown, SSH hangs for 30 minutes waiting for process file descriptors to close - Fixed in commit a65a308
- PM2
killmay fail to terminate orphaned bun child processes - These ghost processes hold database connections and deadlock deployments
- Solution: Explicit
pkillcommands inscripts/deploy-vast.shbefore starting new deployment - Fixed in commit 9e6f5bb
- Wait 5-30 seconds after killing processes to allow DB connections to drain
- Remote databases need longer drain time (30s) than local (5s)
- Increase
POSTGRES_POOL_MAXif seeing connection exhaustion (default: 20)
CDN Asset Loading Issues
If assets fail to load in production streaming deployments:- Verify
PUBLIC_CDN_URLis set to production CDN (not localhost) - Default:
https://assets.hyperscape.club - Check
ecosystem.config.cjshas correct CDN URL - Ensure CDN is accessible from deployment environment
- Note:
DUEL_PUBLIC_CDN_URLwas deprecated in March 2026 - usePUBLIC_CDN_URLinstead
Recent Changes (March 2026)
Deployment Process Cleanup (March 11, 2026)
Change (Commit 9e6f5bb): Kill orphaned bun processes to prevent ghost game servers from deadlocking deployments. Problem: PM2kill command was failing to terminate orphaned bun child processes (game server instances), causing them to hold database connections and deadlock subsequent deployments.
Solution: Added explicit pkill commands in scripts/deploy-vast.sh to kill orphaned bun server processes before starting new deployment:
- Eliminates database connection deadlocks from ghost game servers
- Deployments no longer hang waiting for stale DB connections to timeout
- More reliable CI/CD pipeline
- Faster deployment recovery from crashes
Streaming Frame Pacing Fix (March 11, 2026)
Change (Commits 522fe37, e2c9fbf): Enforced 30fps frame pacing to eliminate stream buffering. Problem: CDP screencast was delivering frames at ~60fps while FFmpeg expected 30fps input, causing buffer buildup and viewer lag. Initial fix (522fe37) seteveryNthFrame: 2 to halve compositor delivery, but this was incorrect - Xvfb compositor runs at 30fps (no vsync), not 60fps.
Fix:
- Reverted everyNthFrame to 1 (commit e2c9fbf) - Xvfb compositor delivers at 30fps, so no frame skipping needed
- Frame Pacing Guard: Skip frames arriving faster than 85% of the 33.3ms target interval (prevents burst-feeding FFmpeg)
- Output Resolution: Default changed from 1920x1080→1280x720 to match capture viewport and eliminate unnecessary upscaling
- Xvfb runs at 30fps without vsync (game is capped at 30fps)
everyNthFrame: 2would halve 30fps delivery to 15fps, causing FFmpeg underflow- Frame pacing guard handles edge cases where compositor exceeds TARGET_FPS
- 1280x720 matches capture viewport, eliminating upscaling overhead
- Eliminates stream buffering
- Smoother playback for viewers
- Reduced bandwidth usage
- Correct frame delivery rate (30fps)
Deployment SSH Timeout Fix (March 11, 2026)
Change (Commit a65a308): Fixed SSH session timeout during Vast.ai deployments. Problem: Background processes (Xvfb, socat) were keeping SSH session file descriptors open, causingappleboy/ssh-action to hang for 30 minutes until command_timeout killed it - even though deployment completed in ~1 minute.
Solution: Added disown after each background process in scripts/deploy-vast.sh to detach them from the shell’s job table, allowing SSH to exit cleanly.
Files Changed:
scripts/deploy-vast.sh- Addeddisownafter Xvfb and socat background processes
- Deployment completes in ~1 minute instead of hanging for 30 minutes
- CI/CD pipeline runs faster
- No more false timeout failures
- Cleaner SSH session management
Test Infrastructure Updates (March 11, 2026)
Change (Commits cd253d5, 97b7a4e, d7a7995): Fixed monorepo test failures and excluded WebGPU-dependent packages from CI. Key Changes:- CI Test Exclusions: Excluded
@hyperscape/impostorfrom headless CI test runs (requires WebGPU, unavailable on GitHub Actions runners) - Test Timeouts: Increased
sim-engineguarded MEV fee sweep test timeout from 60s to 120s to prevent flaky CI failures - Cyclic Dependencies: Resolved circular dependency issues in monorepo package structure
- Port Conflicts: Fixed port allocation conflicts between test suites
- Turbo Filter: Updated test filter to exclude deleted packages from main branch
- WebGPU-dependent packages (
impostor,client) require local testing with GPU-enabled browsers - Headless CI focuses on server-side logic, data processing, and non-rendering systems
- Full integration tests run locally or on GPU-enabled CI runners (not GitHub Actions)
- More reliable CI test runs
- Eliminates false negatives from WebGPU-unavailable environments
- Faster CI execution by skipping incompatible tests
- Better separation of GPU-dependent vs headless tests
BankTabBar Test Updates (March 11, 2026)
Change (Commits 297539f, be2503f): Fixed BankTabBar tests to be environment-agnostic for color formats. Problem: Tests were failing due to browser differences in CSS color representation (hex vs rgb). Solution: Updated test assertions to handle both hex and rgb color formats, matching the gradient background style. Impact: More reliable tests across different browser environments.Manifest File Loading Fix (March 10, 2026)
Change (Commit c0898fa): Fixed legacy manifest entries that 404 on CDN. Problem:DataManager was attempting to fetch items.json and resources.json as root-level files, but these never existed - items are stored as split category files (items/weapons.json, items/armor.json, etc.).
Solution:
- Removed legacy
items.jsonandresources.jsonfrom manifest fetch list - Added missing newer manifests to fetch list:
ammunition.jsoncombat-spells.jsonduel-arenas.jsonlod-settings.jsonquests.jsonrunes.json
packages/shared/src/data/DataManager.ts- Updated manifest loading logic
- Eliminates 404 errors during manifest loading
- Ensures all current manifests are properly fetched
- Better error handling for missing optional manifests
Three.js 0.183.2 Upgrade (March 10, 2026)
Change (Commit 8b93772): Upgraded Three.js from 0.182.0 to 0.183.2 across all packages. Breaking Changes:- TSL API Change:
atan2renamed toatanin TSL exports - Type Compatibility: Updated TSL typed node aliases (TSLNodeFloat/Vec2/Vec3/Vec4)
- InstancedBufferAttribute: Fixed type cast in HealthBars system
packages/procgen/src/geometry/LeafMaterialTSL.ts- Updatedatan2→atanpackages/shared/src/extras/three/three.ts- Added TSL typed node aliasespackages/shared/src/systems/client/HealthBars.ts- Fixed instancedBufferAttribute type cast- All
package.jsonfiles - Updated three to 0.183.2 and @types/three to 0.182.0
- Latest Three.js features and bug fixes
- Improved WebGPU performance and stability
- Better TSL shader compilation
- Required for future Three.js ecosystem compatibility
Streaming Pipeline Optimization (March 10, 2026)
Change (Commits c0e7313, 796b61f, d893fd4): Major streaming pipeline overhaul with CDP default, Vulkan ANGLE backend, and FFmpeg improvements. Key Changes:- Default Capture Mode: CDP (Chrome DevTools Protocol) everywhere for reliability
- Chrome Beta Channel: Switched from Chrome Unstable to Chrome Beta for better stability
- ANGLE Backend: Vulkan ANGLE backend (
--use-angle=vulkan) on Linux NVIDIA for WebGPU stability - FFmpeg Resolution: Prefer system ffmpeg (
/usr/bin,/usr/local/bin) over ffmpeg-static to avoid segfaults - x264 Tuning: Default to
zerolatencytune for live streaming (wasfilm) - GOP Size: Set to 30 frames (1s at 30fps) to match HLS segment boundaries
- MediaRecorder Chunks: Tighter chunking (100ms) for lower latency
- Dead Code Removal: Deleted
dev-final.mjs(875 lines), removedSERVER_DEV_LEAN_MODEsystem - Playwright Fix: Block
--enable-unsafe-swiftshaderinjection to prevent CPU software rendering
- ANGLE OpenGL ES (
--use-angle=gl) fails with “Invalid visual ID” on NVIDIA GPUs - Native Vulkan (
--use-vulkan) crashes - Only ANGLE’s Vulkan backend works reliably for WebGPU streaming on Linux NVIDIA hardware
packages/server/scripts/stream-to-rtmp.ts- ANGLE backend logic, FFmpeg resolutionscripts/duel-stack.mjs- Updated default capture mode and ANGLE backendecosystem.config.cjs- STREAM_CAPTURE_ANGLE=vulkanscripts/deploy-vast.sh- Chrome Beta installationpackages/client/playwright.config.ts- Updated DEFAULT_LINUX_WEBGPU_ARGSpackages/shared/src/utils/rendering/RendererFactory.ts- Prefer high-performance GPU adapter
- More reliable streaming across diverse GPU hardware
- Lower latency with zerolatency tune
- Eliminates FFmpeg segfaults
- Better HLS segment alignment
- Fewer crashes and rendering artifacts
Physics Optimization for Streaming (March 10, 2026)
Change (Commit c0e7313): Skip client-side PhysX initialization for streaming/spectator viewports. Rationale: Streaming and spectator clients don’t need physics simulation - they only render the world state. Skipping PhysX reduces memory usage and startup time. Detection Logic:packages/shared/src/runtime/createClientWorld.ts- Skip PhysX for streaming/spectator viewports
- Faster streaming client startup
- Reduced memory footprint for spectator views
- No physics overhead for non-interactive clients
Camera Fallback for Empty Streaming Worlds (March 10, 2026)
Change (Commit 93cac36): Added arena lobby fallback camera position when no entities exist in streaming mode. Problem: Streaming clients with empty world states showed a black void instead of the arena. Solution:ClientCameraSystem now defaults to arena lobby position when no entities are present in streaming mode.
Files Changed:
packages/shared/src/systems/client/ClientCameraSystem.ts- AddedpositionCameraAtArenaFallback()method
Service Worker Cache Strategy (March 10, 2026)
Change (Commit 796b61f): Switched Workbox caching fromCacheFirst to NetworkFirst for JS/CSS.
Problem: Stale service worker serving old HTML for JS chunks after rebuild, causing module loading errors.
Solution:
NetworkFirststrategy for JS/CSS - always fetch latest, fallback to cache- Aggressive cache clearing for local dev (clears
workbox-*andhyperscape-*caches) - Reload once after cleanup to ensure clean state
packages/client/vite.config.ts- Changed Workbox strategy to NetworkFirstpackages/client/src/index.html- Added aggressive service worker cleanup for dev
- Eliminates stale module errors after rebuilds
- Better dev experience with hot reload
- Production still benefits from cache fallback
WebGPU Feature Flags (March 10, 2026)
Change (Commits 796b61f, 93cac36, d893fd4): Updated Chrome WebGPU feature flags for better compatibility. Added Flags:UnsafeWebGPU- Enable WebGPU in non-secure contexts (dev/testing)WebGPUDeveloperFeatures- Enable developer features for debuggingDefaultANGLEVulkan- Enable ANGLE Vulkan backend by defaultVulkan- Enable Vulkan supportVulkanFromANGLE- Enable Vulkan via ANGLE
UseSkiaRenderer- Conflicts with WebGPU (causes “Instance dropped” errors)--disable-gpu-sandbox- Not needed for working Chrome--enable-webgl- Irrelevant for WebGPU-only rendering--disable-field-trial-config- Blocks GPU feature config propagation
- More reliable WebGPU initialization
- Better error messages for GPU issues
- Eliminates “Instance dropped” device-lost errors
- Proper ANGLE Vulkan backend selection on Linux
CDN URL Unification (March 10, 2026)
Change (Commits 2173086, 8660bca): ReplacedDUEL_PUBLIC_CDN_URL with unified PUBLIC_CDN_URL environment variable.
Rationale: Simplifies CDN configuration by using a single environment variable across all contexts instead of separate duel-specific and general CDN URLs.
Configuration:
scripts/deploy-vast.sh- Updated to usePUBLIC_CDN_URLecosystem.config.cjs- ReplacedDUEL_PUBLIC_CDN_URLwithPUBLIC_CDN_URLpackages/server/.env.example- Updated documentation- All deployment scripts and configurations
- Cleaner environment variable naming
- Consistent CDN URL across client, server, and streaming contexts
- Reduces configuration complexity
- Easier to understand and maintain
Chrome Swiftshader Rendering Block Fix (March 10, 2026)
Change (Commits 7c16937, 550a877): Fixed Playwright injecting--enable-unsafe-swiftshader flag which forces CPU software rendering and blocks WebGPU compositor pipeline.
Problem: Playwright’s default args include --enable-unsafe-swiftshader, forcing Chrome to use CPU-based software rendering instead of GPU acceleration. This sabotages the WebGPU compositor pipeline and causes rendering failures.
Solution: Use ignoreDefaultArgs: ['--enable-unsafe-swiftshader', '--hide-scrollbars'] in Playwright browser launch configuration to prevent Playwright from injecting these flags.
Additional Fix: Added explicit FFmpeg cleanup in script teardown to prevent stale ffmpeg processes from blocking Twitch/Kick RTMP connections between restarts.
Files Changed:
packages/server/scripts/stream-to-rtmp.ts- AddedignoreDefaultArgsto Playwright launch config, added FFmpeg cleanuppackages/server/src/streaming/rtmp-bridge.ts- Improved FFmpeg process cleanup
- Enables proper GPU-accelerated WebGPU rendering in Playwright-launched Chrome instances
- Prevents RTMP connection failures from zombie FFmpeg processes
- Critical for streaming capture on Vast.ai GPU instances
Dependency Updates (March 10, 2026)
Major Updates:- Three.js: 0.182.0 → 0.183.2 (WebGPU renderer, TSL shaders)
- Capacitor: 7.6.0 → 8.2.0 (Android, iOS, Core)
- lucide-react: → 0.577.0 (icon library)
- three-mesh-bvh: 0.8.3 → 0.9.9 (BVH acceleration)
- eslint: → 10.0.3 (linting)
- jsdom: → 28.1.0 (testing)
- @ai-sdk/openai: → 3.0.41 (AI SDK)
- hardhat: → 3.1.11 (smart contracts)
- @nomicfoundation/hardhat-chai-matchers: → 3.0.0 (testing)
- globals: → 17.4.0 (TypeScript globals)
- Latest Three.js WebGPU features and performance improvements
- Latest mobile platform features (Capacitor 8.2.0)
- Improved icon library with new icons
- Better BVH performance for collision detection
- Latest linting rules and TypeScript support
- Bug fixes and security updates
WebSocket Connection Stability (March 10, 2026)
Change (Commit 3b4dc66): Fixed WebSocket disconnects under load. Problem: WebSocket connections dropping under high load from concurrent agent queries and player actions. Solution:- Improved connection health monitoring in
Socket.ts - Set
alive = trueon any packet receipt (proof of life) - Better handling of proxy-dropped protocol pongs (e.g., Cloudflare)
packages/shared/src/platform/shared/Socket.ts- Addedalive = trueon message receipt
Additional Resources
- README.md - Full project documentation
- AGENTS.md - AI coding assistant instructions and feature documentation
- .cursor/rules/ - Detailed development rules
- packages/shared/ - Core engine source
- docs/duel-stack.md - Duel stack documentation
- docs/duel-arena-oracle-deploy.md - Oracle deployment guide
- HyperscapeAI/hyperbet - Betting stack (separate repository)
- Game Design Document: See
.cursor/rules/gdd.mdc