Migration Guide
This document outlines breaking changes and migration steps for recent Hyperscape updates.Table of Contents
- Bun v1.3.10 Update
- Safari 18+ Requirement
- Object Pooling System
- Movement System Changes
- TileMovementState Interface Changes
- Combat Event Payload Changes
- PostgreSQL Connection Pool Configuration
Bun v1.3.10 Update
Date: March 2026Severity: Medium
Impact: Development environment
What Changed
Minimum Bun version requirement updated from v1.1.38 to v1.3.10.Migration Steps
-
Update Bun:
-
Verify version:
-
Reinstall dependencies:
-
Rebuild project:
Why This Change
- Improved performance and stability
- Better TypeScript support
- Bug fixes in package resolution
Safari 18+ Requirement
Date: March 2026Severity: High
Impact: Browser compatibility
What Changed
Safari 17 support was removed. Safari 18+ (macOS 15+) is now required for WebGPU support.Migration Steps
For Users:- Update macOS to version 15 or later
- Update Safari to version 18 or later
- Alternatively, use Chrome 113+ or Edge 113+
- Update browser compatibility documentation
- Update user-facing error messages for unsupported browsers
- Test on Safari 18+ instead of Safari 17
Why This Change
- Safari 17 had incomplete WebGPU implementation
- Safari 18 provides full WebGPU support with Metal backend
- Aligns with Three.js TSL shader requirements
Object Pooling System
Date: March 2026Severity: High
Impact: Event handling, memory management
What Changed
Introduced comprehensive object pooling for event payloads to eliminate GC pressure. Event listeners must now release pooled payloads after processing.Migration Steps
1. Update Event Emitters
Before:2. Update Event Listeners
Before:3. Available Pools
All combat events now have pre-configured pools:CombatEventPools.damageDealtCombatEventPools.projectileLaunchedCombatEventPools.faceTargetCombatEventPools.clearFaceTargetCombatEventPools.attackFailedCombatEventPools.followTargetCombatEventPools.combatStartedCombatEventPools.combatEndedCombatEventPools.projectileHitCombatEventPools.combatKill
4. Position Pool Usage
Before:Why This Change
- Eliminates per-tick object allocations in combat hot paths
- Memory stays flat during 60s stress test with agents in combat
- Verified zero-allocation event emission in CombatSystem
Common Pitfalls
❌ Forgetting to release:Movement System Changes
Date: March 2026Severity: Medium
Impact: Movement handling, pathfinding
What Changed
- Move requests now bypass ActionQueue for immediate processing (0-latency response)
- Pathfinding rate limit raised from 5/sec to 15/sec
- BFS iterations increased from 2000 to 8000 (~44 tile radius)
- Added path continuation for seamless long-distance movement
Migration Steps
1. Remove ActionQueue Buffering
Before:2. Update Rate Limiting
Before:3. Handle Path Continuation
Path continuation is now automatic. No code changes required, but be aware:- Long-distance clicks (>44 tiles) now work seamlessly
- Movement continues across multiple BFS segments
tileMovementEndis suppressed while segments continue
Why This Change
- Eliminates 0-600ms latency between click and movement start
- Aligns with 30 Hz client input rate
- Provides “snappier modern feel” for movement
- Enables long-distance movement without premature stopping
TileMovementState Interface Changes
Date: March 2026Severity: Medium
Impact: Movement system, tile-based movement
What Changed
Added three new required fields toTileMovementState:
Migration Steps
1. Update State Initialization
Before:2. Clear on Teleport/Respawn
Why This Change
- Enables seamless long-distance movement
- Supports server-side path pre-computation
- Eliminates skating at segment boundaries
Combat Event Payload Changes
Date: March 2026Severity: Low
Impact: Combat projectile events
What Changed
COMBAT_PROJECTILE_LAUNCHED event payload property renamed:
travelDurationMs→flightTimeMs
Migration Steps
Before:Why This Change
- Consistent naming with other time-based properties
- Clearer semantic meaning
PostgreSQL Connection Pool Configuration
Date: March 2026Severity: Medium
Impact: Database connections, crash recovery
What Changed
Default PostgreSQL connection pool settings optimized for crash loop scenarios:POSTGRES_POOL_MAX: 6 → 3POSTGRES_POOL_MIN: 1 → 0- PM2
restart_delay: 5s → 10s - PM2
exp_backoff_restart_delay: 1s → 2s
Migration Steps
1. Update Environment Variables
Before (.env):
.env):
2. Update PM2 Configuration
Before (ecosystem.config.cjs):
ecosystem.config.cjs):
Why This Change
- Prevents PostgreSQL error 53300 (too many connections) during crash loops
- Allows connections to fully close before PM2 restart
- More gradual backoff on repeated failures
- Reduces connection exhaustion risk
When to Override
Increase pool size if you have:- High concurrent user load (>100 simultaneous players)
- Multiple server instances sharing same database
- Complex queries requiring long-held connections
New Environment Variables
Date: March 2026Severity: Low
Impact: Configuration, feature flags
New Variables
SPAWN_MODEL_AGENTS
Purpose: Enable automatic agent creation when database is empty
Default: false
Usage:
STREAM_CAPTURE_EXECUTABLE
Purpose: Explicit Chrome path for WebGPU streaming
Default: Auto-detected
Usage:
STREAM_LOW_LATENCY
Purpose: Use zerolatency tune for faster playback start
Default: false (uses film tune)
Usage:
STREAM_GOP_SIZE
Purpose: GOP size in frames
Default: 60
Usage:
Troubleshooting
Memory Leaks After Update
Symptom: Memory usage grows over time Cause: Event listeners not releasing pooled payloads Solution:Movement Feels Different
Symptom: Movement behavior changed Cause: Immediate move processing, path continuation Solution: This is expected. New behavior provides:- 0-latency response to clicks
- Seamless long-distance movement
- No skating at segment boundaries
Database Connection Errors
Symptom: PostgreSQL error 53300 (too many connections) Cause: Old connection pool settings Solution:Safari Not Working
Symptom: WebGPU not available in Safari Cause: Safari 17 no longer supported Solution: Update to Safari 18+ (macOS 15+) or use Chrome 113+Getting Help
If you encounter issues during migration:- Check the Troubleshooting section in README.md
- Review AGENTS.md for memory management patterns
- See CLAUDE.md for development guidelines
- Check API_OBJECT_POOLING.md for pooling API details
- Open an issue on GitHub with:
- Error messages
- Steps to reproduce
- Environment details (OS, Bun version, browser)
See Also
- README.md - Project documentation
- CLAUDE.md - Development guidelines
- AGENTS.md - AI coding assistant guidelines
- API_OBJECT_POOLING.md - Object pooling API reference