Skip to main content

Home Teleport System Documentation

Comprehensive guide for the home teleport system (polished in PR #1095, March 26, 2026).

Overview

The home teleport system provides a visual, cooldown-based teleportation mechanic with:
  • 10-second interruptible cast time
  • 30-second cooldown (server-authoritative)
  • Dedicated portal visual effects
  • Minimap orb integration
  • Terrain-aware effect anchoring

Architecture

Components

Client:
  • HomeTeleportButton.tsx - Main teleport button in HUD
  • MinimapHomeTeleportOrb.tsx - Minimap orb with cooldown display
  • ClientTeleportEffectsSystem.ts - Portal visual effects
  • homeTeleportUi.ts - Shared UI utilities
Server:
  • home-teleport.ts - Server-side handler with cooldown enforcement
  • GameConstants.ts - Teleport timing constants
Shared:
  • Events.ts - Teleport event definitions
  • packets.ts - Network packet schemas

Event Flow

Constants

HOME_TELEPORT_CONSTANTS

Tuning:
  • COOLDOWN_MS: Time between teleports (reduced from 15 minutes to 30 seconds in PR #1095)
  • CAST_TIME_MS: Cast duration (interruptible by movement/combat)
  • CAST_TIME_TICKS: Tick-based cast duration for server validation

Client Implementation

HomeTeleportButton

MinimapHomeTeleportOrb

ClientTeleportEffectsSystem

Server Implementation

Cooldown Enforcement

Visual Effects

Portal Effect

Components:
  • Veil: Translucent cylinder with gradient shader
  • Orbital Rings: Rotating rings around player
  • Particles: Upward-flowing particles
  • Ground Anchor: Effect anchored to player’s lowest bone position
Shader (TSL):
Animation:

Terrain-Aware Anchoring

Problem: Portal effect floats above ground when player is on uneven terrain. Solution: Anchor to player’s lowest bone position (usually feet).
Result: Portal effect stays grounded even on slopes, stairs, or uneven terrain.

UI Integration

Cooldown Display

Progress Calculation:
Remaining Time Extraction:
Usage:

Cast Progress Bar

Network Protocol

Packets

Client → Server:
Server → Client:

Event Definitions

Configuration

Home Position

Default: Central Haven (starter town at origin)
Custom Home Position (future feature):

Cooldown Tuning

Reduce Cooldown (for testing):
Disable Cooldown (for testing):

Testing

Unit Tests

homeTeleportUi.test.ts:

Integration Tests

home-teleport.spec.ts:

Troubleshooting

Issue: Cooldown stuck at 0% (never refills)

Diagnosis:
Causes:
  1. PLAYER_TELEPORTED event not firing
  2. Cooldown animation not started
  3. setCooldownProgress(0) not called on teleport success
Fix:

Issue: Portal effect doesn’t appear

Diagnosis:
Causes:
  1. ClientTeleportEffectsSystem not registered
  2. HOME_TELEPORT_CAST_START event not emitted
  3. Portal mesh not added to stage
Fix:

Issue: Portal floats above ground

Diagnosis:
Causes:
  1. getLowestBonePosition() returning player.position instead of bone position
  2. VRM skeleton not loaded
  3. Terrain system not ready
Fix:

Issue: Server sends wrong remainingMs

Diagnosis:
Causes:
  1. lastHomeTeleport Map not updated on successful teleport
  2. Clock skew between server and client
  3. Cooldown constant mismatch
Fix:

Performance Considerations

Portal Effect Optimization

Geometry:
  • Veil: 32 segments (low-poly cylinder)
  • Rings: 64 segments each (smooth circles)
  • Particles: 50 instances (instanced rendering)
Materials:
  • TSL node materials (WebGPU-optimized)
  • Shared textures across all portals
  • No per-frame texture updates
Cleanup:

Cooldown Animation

RAF-Based (60 FPS):
Interval-Based (alternative):

Changelog

March 26, 2026 (PR #1095)

  • Polished cast effects with dedicated portal visuals
  • Reduced cooldown from 15 minutes to 30 seconds
  • Server sends remainingMs in cooldown rejection packets
  • Added minimap orb integration
  • Terrain-aware portal anchoring (lowest bone position)
  • Cast progress bar with smooth animation
  • Cooldown refill visual with radial progress
  • 8 files changed, 649 additions, 53 deletions

Pre-March 2026

  • Basic teleport functionality
  • 15-minute cooldown
  • No visual effects
  • No minimap integration