Development Commands
Core Commands
| Command | Description |
|---|---|
bun run dev | Start game (client + server + shared) |
bun run dev:elizaos | Game + ElizaOS AI agents |
bun run dev:all | Everything: game + AI + AssetForge |
bun run build | Build all packages |
bun start | Start production server |
Package-Specific
Build Pipeline
The server package includes automated tasks for collision footprint extraction:world/assets/models/**/*.glb and generates world/assets/manifests/model-bounds.json with bounding box data for automatic collision footprint calculation.
Turbo Caching:
- Only re-runs when GLB files or script changes
- Outputs cached between builds
- Configured in
packages/server/turbo.json
Circular Dependency Handling
The build system handles circular dependencies between packages using resilient build patterns:@hyperscape/shared↔@hyperscape/procgen(shared imports from procgen, procgen peer-depends on shared)@hyperscape/shared↔@hyperscape/plugin-hyperscape(similar circular dependency)
- When turbo runs a clean build, tsc fails because the other package’s
dist/doesn’t exist yet - The
|| echopattern allows the build to exit 0 even with circular dep errors - Packages still produce partial output which is sufficient for downstream consumers
- Shared package always uses
--skipLibCheckin declaration generation to handle circular dependencies
This is a known limitation of the current architecture. The packages produce working output despite TypeScript errors during clean builds.
Port Allocation
| Port | Service | Started By |
|---|---|---|
| 3333 | Game Client | bun run dev |
| 5555 | Game Server | bun run dev |
| 8080 | Asset CDN | bun run dev |
| 5432 | PostgreSQL | Docker (auto) |
| 4001 | ElizaOS API | bun run dev:elizaos |
| 3400 | AssetForge UI | bun run dev:forge |
| 3401 | AssetForge API | bun run dev:forge |
Hot Reload
The dev server provides:- Client: Vite HMR for instant updates
- Server: Auto-restart on file changes
- Shared: Watch mode with rebuild
Asset Management
Hyperscape uses a separate assets repository to keep the main codebase lightweight and prevent manifest divergence.Asset Repository Structure
- Main repo (
HyperscapeAI/hyperscape): Code only, no asset files - Assets repo (
HyperscapeAI/assets): All game content (manifests, models, textures, audio) (~200MB with Git LFS)
Change (Feb 2026): Manifests are now sourced exclusively from the assets repo. The main repo no longer tracks any asset files, including JSON manifests.
Local Development
Assets are automatically cloned duringbun install:
ensure-assets.mjs script:
- Checks if
packages/server/world/assets/exists - If missing, clones
HyperscapeAI/assetsrepository - Local dev: Full clone with LFS for models/textures/audio (~200MB)
- CI/Production: Shallow clone without LFS (manifests only, ~1MB)
CI/CD Asset Handling
In CI environments, assets are cloned without LFS (manifests only):Asset Updates
When assets are updated in the assets repository:- Pull latest assets:
bun run assets:sync - Manifests and models are automatically updated
- Restart server to reload manifests
- Single source of truth for all game content
- Prevents manifest divergence between repos
- Reduces main repo size (no binary commits)
- Cleaner git history
- Easier asset updates (PR to assets repo, not main repo)
- CI gets manifests without downloading large binary files
Manifest Files
All manifest JSON files are sourced from the assets repo:DataManager loads manifests from packages/server/world/assets/manifests/ which is populated by cloning the assets repo.
Docker Services
The CDN starts automatically with
bun run dev. Only run manually if using services separately.Testing
E2E Journey Tests (NEW - February 2026)
Comprehensive end-to-end tests validate the complete player journey from login to gameplay: Test File:packages/client/tests/e2e/complete-journey.spec.ts
Key Features:
- Real Browser Testing: Uses Playwright with actual WebGPU rendering (no mocks)
- Screenshot Comparison: Visual regression testing to verify rendering
- Loading Screen Detection: Reliable synchronization helpers
- Full Gameplay Flow: Tests complete user journey, not isolated features
Test Stability Improvements
Recent commits improved test reliability:- GoldClob Fuzz Tests: 120s timeout for randomized invariant tests (4 seeds × 140 operations)
- Precision Fixes: Use larger amounts (10000n) to avoid gas cost precision issues
- Dynamic Import Timeout: 60s timeout for EmbeddedHyperscapeService beforeEach hooks
- Anchor Test Configuration: Use localnet instead of devnet for free SOL in
anchor test - CI Build Order: Build impostors/procgen before shared (dependency fix)
Linting
GitHub Actions
The repository includes automated workflows for code quality and documentation:Claude Code Integration
.github/workflows/claude.yml- Responds to@claudementions in issues and PRs for automated assistance.github/workflows/claude-code-review.yml- Automated code review on pull requests.github/workflows/update-docs.yml- Automatically updates documentation when manifest files change
- Comment
@claudein any issue or PR - Claude will analyze the context and provide assistance
- For code reviews, Claude automatically reviews new PRs
Requires
CLAUDE_CODE_OAUTH_TOKEN and MINTLIFY_API_KEY secrets to be configured in repository settings.Code Quality Improvements (February 2026)
Type Safety Audit (commit d9113595)
Eliminated explicitany types in core game logic:
Files Updated:
tile-movement.ts- Removed 13 any casts by properly typing BuildingCollisionServiceproxy-routes.ts- Replaced any with proper types (unknown, Buffer | string, Error)ClientGraphics.ts- Added safe cast after WebGPU verification
- TSL shader code (ProceduralGrass.ts) - @types/three limitation
- Browser polyfills (polyfills.ts) - intentional mock implementations
- Test files - acceptable for test fixtures
Memory Leak Fix (commit 3bc59db)
Fixed memory leak in InventoryInteractionSystem using AbortController:Dead Code Removal (commit 7c3dc985)
Removed 3,098 lines of dead code:- Deleted
PacketHandlers.ts(never imported, completely unused) - Updated audit TODOs to reflect actual codebase state
- ServerNetwork is already decomposed into 30+ modules (not 116K lines)
- ClientNetwork handlers are intentional thin wrappers (not bloated)
Build System Fixes
TypeScript Override Conflict (commit 113a85a): Removed conflicting TypeScript overrides from rootpackage.json. The build system now relies on workspace protocol and Turbo’s dependency resolution.
Windows Environment Variables (commit 3b7665d):
Fixed native app builds on Windows by conditionally supplying secrets:
Common Workflows
Adding a New Feature
- Make changes in
packages/shared/src/ - Hot reload applies automatically
- Test in browser at localhost:3333
Updating Game Content
- Edit manifest files in
world/assets/manifests/ - Restart server to reload manifests
- Documentation updates automatically via GitHub Actions
Debugging Server
- Check terminal output for errors
- Server logs show WebSocket activity
- Database queries logged in dev mode