Traverse infinite sectors folded across the faces of a rotating 3D hypercube.
Play online: ๐ฎ Launch Hyperfold Game โ โข ๐ ๏ธ Launch World Editor โ
The game combines classic 2D jump & run platforming mechanics with a pseudo-3D cube world that tumbles 90ยฐ whenever the player crosses any of the four screen edges. While physically appearing as a 3D cube tumbling in deep space, topologically the game world is an infinite non-Euclidean manifold featuring fixed, hand-crafted screens that never loop in circles (unless specifically designed) and always preserve round-trip navigation.
-
Higher-Dimensional Topology: Rooms exist on an open
$(X, Y)$ coordinate manifold. Traversing 6 consecutive screens yields unique sectors without looping back to old screens, while traveling backward deterministically returns to your exact origin. -
Seamless 3D Tumble Transitions: When crossing an edge boundary or jumping through an inter-sector portal, the cube executes a smooth 90ยฐ slerp rotation (
easeInOutCubic, ~420ms). -
Zero Pop-In Predictive Pre-Rendering: The destination face, the incoming trailing face (Face 5:
$-Z$ ), and all perpendicular adjacent faces are dynamically pre-rendered before the tumble begins, eliminating texture pop-in or mid-turn replacements. -
Canvas-to-WebGL Pipeline: Crisp 2D Canvas tilemaps and dynamic sprites rendered directly onto Three.js
CanvasTexturematerials with dynamic player point lighting.
- Fluid Movement: Snappy ground acceleration, crisp deceleration, and variable jump height (cutting vertical velocity on early jump release).
- Coyote Time (100ms): Jump gracefully even after walking off a platform ledge.
- Jump Buffering (120ms): Queue jumps immediately before touching down on solid ground.
- Ducking & Crawling (
Down/S): Crouch to reduce player hitbox height from 36px to 22px, allowing players to duck under high laser beams and crawl through 1-tile crawlspaces with ceiling clearance raycasting. - Moving Platforms & Passenger Physics: Floating hover cruisers and vertical elevators that carry players with horizontal momentum inheritance.
- Down + Jump Drop-Through: Press
Down + Jumpwhile standing on one-way or moving platforms to drop through, mirroring classic platformer conventions. - Dynamic Laser Barriers & Angled Turrets: Mobile laser barriers that patrol harmonic tracks cycling between idle, telegraph warning, and lethal states; stationary and auto-targeting turrets shooting high-velocity laser bolts or continuous raycast beams that dynamically clip against moving platforms (enabling platforms to act as moving shields).
- Multi-Directional Spikes: Hazard spikes mounted on floors, walls, ceilings/roofs, and solid floating platforms with forgiving apex-matched hitboxes and automatic geometric orientation detection.
- Interactive Elements: One-way ledges, crumble blocks with respawn timers, super bounce launch pads, and collectible Energy Prisms.
-
360ยฐ Particle Burst: On death, the player detonates with 72 high-velocity particles flying in all directionsโconcentric expanding shockwave rings, tumbling debris shards with aerodynamic drag physics (
$0.94^{\Delta t \cdot 60}$ ), and billowing plasma motes. - Sprite Hiding & Materialization: Player chassis and eyes are hidden during the explosion, reappearing with materialization sparks upon sector respawn.
-
Tap R to Die & Respawn: Pressing
R(or clickingReset [R]) triggers an immediate player death sequence and sector respawn. -
Hold R to Restart Entire Level: Long-pressing
R($\ge 0.8\text{s}$ ) renders an in-world holographic radial charging ring around the player avatar, converging particle motes, and a live HUD hold percentage banner. Holding to completion resets the entire level back to Genesis Core[0, 0], restores all collected Energy Prisms, resets discovered rooms, snaps 3D cube rotation back to identity, and detonates a dimensional reboot warp effect.
- Dynamic Entity Detection: Automatically categorizes rooms as static or dynamic; static chambers are rendered once and cached, bypassing redundant canvas re-renders.
- Merged Chassis Geometry: Merged internal Three.js player chassis meshes into unified geometries, reducing draw calls from 21 down to 3.
- Round-Robin Texture Throttling: Side-face texture uploading is throttled to at most 1 upload per tick, ensuring smooth 60 FPS transitions without frame spikes.
- Cosmic Starfield: Independent deep-space starfield and drifting wireframe octahedra that remain stationary relative to the camera to accentuate the cube's 3D rotation.
- Dynamic Particle Systems: Landing dust, jump bursts, collectible pickup sparks, motion trails, laser impact sparks, charging motes, muzzle flashes, 360ยฐ death explosions, expanding shockwaves, and screen-edge boundary luminescence.
-
Adaptive Procedurally Generated Synth Soundtrack: Zero-asset, multi-track generative Web Audio synthesizer engine (
ProceduralMusicEngine,SynthInstruments) creating real-time retro-futuristic synthwave and ambient soundscapes without any external audio files or bandwidth lag:- Synthesizer Layers: Warm dual-sawtooth cosmic pads, punchy 303-style resonant acid basslines with sub-bass sine weight, plucky 16th-note cyber arpeggiators, and synthesized percussion (pitch-sweeping kick, highpass noise hi-hats, dual-layer cyber snares).
-
Deterministic Sector Adaptation: Every sector in both fixed campaigns and procedural worlds hashes its coordinates
$(X, Y)$ and visual theme to select unique root keys, chord progressions, and harmonic modal scales (Dorian for cyan data matrices, Phrygian for thermal solar flares, Harmonic Minor for toxic conduits and cosmic void, Lydian for zero-g spires). -
Dynamic Hazard & Threat Reactivity: Calmer exploration sectors play spacious ambient pads and subtle pulses; chambers with high hazard density (lasers, turrets, spikes) dynamically ramp BPM (96
$\to$ 128 BPM), open filter brightness, engage rolling 16th basslines, and drop driving kick and snare backbeats. - Event-Driven Audio Modulation: Resonant 0.45s lowpass filter sweeps on 3D cube rotations, instant 220Hz low-pass filter choke ("underwater/system overload" effect) with ducking on player death, smooth restoration on respawn, and major scale transposition on stage clear.
-
Dedicated Music Controls: Independent multi-level music volume control (
Music: HIGH / MED / LOW / OFF) in the Settings Gear menu alongside the master sound mute toggle (U/โซ).
- Zero-Asset Web Audio API Sound Effects: Fully procedural sound effectsโresonant 3D rotation whooshes, synth jump arps, landing thuds, collectible chimes, blaster zaps, impact sizzles, warning telegraph chirps, portal warp chirps, locked gate buzzes, a 3-layer cyberpunk synth explosion (sub-bass drop + detuned dual sawtooth/square filter sweep + filtered noise burst), and an ascending 6-note level reboot fanfare.
- Free Orbit: Click and drag with the left mouse button to orbit around the cube from any angle.
- Zoom: Scroll the mouse wheel to inspect details up close or view the cosmic void.
- Camera Reset & Flat Mode: Hit
Vto reset the camera to the default dramatic angle, orCto toggle between 3D Depth View and Orthographic 2D Flat Face View.
- Built-In Profiler: Real-time FPS graph, average/min/max frame-time tracking, sample ring buffers, and memory telemetry.
- Movable Overlay: Drag and drop the telemetry card by its header to position it anywhere on screen (with automatic position persistence via
localStorageand viewport edge clamping). - Toggle Shortcut: Press
P,F3, or`anytime during gameplay to view diagnostic stats.
- Intra-Sector & Inter-Sector Travel: Wormholes linking points within the same chamber or bridging distant sectors across the non-Euclidean manifold.
-
Topological
$N \to 1$ Routing: Multiple source portals can target the same destination portal; each source portal binds to a single destination via globally unique IDs. - Cyberpunk Visuals: Multi-layer cyber glow with customizable neon palette, high-frequency vibrating outer containment borders with oscillating corner pylons, and a swirling vortex aperture reflecting the primary theme color of the destination sector.
- Fluid Chained Portal Jumping: Collision-box exit debouncing tracks arrival state until the player physically leaves the portal's bounding boxโeliminating artificial cooldown timers and enabling fluid, rapid portal chaining.
-
Reversed Outbound Velocity (
reverseVelocity): Optional kinematic inversion on destination portals that negates the player's velocity vector ($\vec{v}{\text{out}} = -\vec{v}{\text{in}}$, inverting both$v_x$ and$v_y$ ). Dropping into a portal from above launches the player upward toward the ceiling with automatic upward momentum preservation (isBouncePropelled). - Procedural Warp Audio: Custom zero-asset Web Audio synthesis featuring an FM phase-shift warp chirp, sub-bass dimensional drop, and crystalline rematerialization shimmer.
- Collectible Sector Keys: Themed keys placed throughout the world requiring exploration and puzzle-solving to acquire.
- Locked Boundary Forcefields: Sector exits gated by key requirements (
gateKeys), projecting impenetrable energy forcefields until the player collects the matching key. - Tactile Feedback: Audible lockout buzz and floating key requirement glyphs when touching a locked gate, accompanied by unlocked chime sound effects upon unlocking.
- HUD Key Inventory: Real-time inventory bar displaying all currently held keys with color-coded theme accents.
- Sector Map Markers: Discovered locked gates and key locations are plotted directly onto the 2D Sector Map with
๐indicators.
- Panoramic Manifold Minimap: Press
Manytime to open the full-screen interactive 2D coordinate grid overlay. - Fog-of-War Exploration: Tracks visited sectors, dynamically highlights undiscovered adjacent sectors, and marks current player coordinates.
- Live Sector Thumbnails: Renders accurate tilemap miniatures reflecting each room's custom theme colors, keys, locked gates, and portal connections.
- Pan, Zoom & Auto-Fit: Smooth drag panning, scroll zooming, and automatic fit-to-screen scaling accommodating sprawling custom worlds.
- Deterministic Infinite Manifold: Procedural world generator creating endless non-Euclidean sectors on demand based on a numeric seed.
- Difficulty Scaling: Mathematical threat curve that progressively ramps hazard density, laser speeds, and moving platform timing as the player traverses deeper into the manifold.
- Guaranteed Reachability & Safety: Rigorous doorway alignment, safe spawn threshold checks, and vertical chute reachability guarantees.
- Power Sanctuaries: Unique peaceful rest-stop chambers generated every 8 sectors with zero lethal hazards and bonus Energy Prisms.
- Difficulty Modes: Select from Easy, Normal, Hard, and Void Abyss modes directly from the in-game menu.
-
Dedicated Shortcut & Gear Menu Access: Press
F2or open the in-game Gear Menu (๐ Dev Tools [F2]) to summon the developer debug console. -
Movable / Draggable Overlays: Click and drag the console header to reposition it anywhere on your screen. Positions are safely constrained to viewport bounds and persist across browser reloads via
localStorage. -
Header Icon Controls & Top HUD Badges:
-
Dev Mode Master Toggle (
โก): Suspend or reactivate all configured modifiers on the fly without resetting preferences. -
Reset All Modifiers (
โบ): Instantly restore all cheats and kinematics to vanilla defaults. -
Top Menu Status Bar: Live modifier pills and master suspend toggle rendered directly in the center of the top HUD bar (
#hud-dev-badges).
-
Dev Mode Master Toggle (
-
Navigation & Sector Warping:
- Jump instantly to any sector via dropdown selector or coordinate inputs
$(X, Y)$ . - Cardinal Jumps: Move North, South, East, or West with automated doorway reachability validation.
-
Shift + Click Teleportation: Hold
Shiftand Left-Click anywhere in the active chamber to instantly relocate the player avatar. - Reveal Full Sector Map: Unveil all rooms in fixed world campaigns or iteratively discover unexplored frontier sectors in procedural void maps.
- Jump instantly to any sector via dropdown selector or coordinate inputs
-
Kinematics & Dynamic Hazard Controls:
- 3-Tier Hazard Lethality: Cycle between Normal (Lethal), Non-Lethal (lasers & turrets pass through player without damage), and Frozen (OFF) (all lasers/turrets halted and active projectiles despawned).
- God Mode & Spike Immunity: Total invulnerability to all hazards, falls, and spikes.
-
Fly Mode / No-Clip (
WASD): Free omnidirectional flight through solid terrain. - Infinite Air-Jump: Jump indefinitely mid-air without landing.
-
Diagnostics & Visual Overlays:
- Hitbox & Collision Visualizer: Render AABB hitboxes, turret raycast lines, and dynamic moving platform shielding points directly on the canvas.
- 20ร20 Tile Grid: Overlay coordinate tile grids to measure jump distances and inspect room layouts.
-
Live Telemetry: Real-time readouts of player coordinates, velocity vectors (
$V_x, V_y$ ), and kinematic states (grounded, ducking).
-
Inventory & Time Simulation Controls:
- Instantly unlock all key-gated exits, collect room or world Energy Prisms, respawn items, or trigger victory.
- Adjust game simulation speed (
0.25xto4.0x), pause physics (โธ PAUSE PHYSICS), and single-step through frames (โญ STEP).
-
Procedural VOID Controls:
- Quick-warp across deep procedural distances (Depth 10, 25, 50, 100) and jump directly to the nearest peaceful Power Sanctuary.
-
Browser Storage Persistence:
- All configured dev modifiers, hazard states, and panel coordinates are remembered in
localStorageacross page reloads while keeping the overlay unobtrusively closed on initial load until summoned.
- All configured dev modifiers, hazard states, and panel coordinates are remembered in
Hyperfold includes a visual web-based world editor built with React, TypeScript, Tailwind CSS, and Lucide Icons located in the editor/ directory. You can design levels directly in your browser using the online editor at vos.github.io/hyperfold/editor/ โ or run it locally.
-
Instant
F5Playtesting & Browser Tab Reuse:-
Dedicated Quick-Access Shortcut: Hit
F5anywhere in the editor (or click the prominent Test in Game [F5] button in the header) to instantly playtest your level. -
Accidental Reload Protection: Intercepts
F5withe.preventDefault(), safeguarding against browser page reloads and lost level edits. -
Smart Tab Reuse: Binds to a dedicated target window (
hyperfold_playtest_window) and usespostMessage(HYPERFOLD_LOAD_WORLD) to hot-reload levels inside the already open game instance without spawning redundant browser tabs.
-
Dedicated Quick-Access Shortcut: Hit
-
Sector World Graph View:
- Visual 2D coordinate grid showing all sectors in the manifold with coordinate badges, room titles, theme colors, and doorway links.
- Drag & Drop Sector Repositioning: Click and drag any sector to move it to a vacant coordinate.
-
Modifier-Key Sector Duplication: Hold
Alt/Optionwhile dragging a sector to clone it to a vacant coordinate slot. - Start sector indicator (
START [0,0]) and locked gate indicators.
-
Interactive Grid Canvas:
- Visual tile painter for solid blocks, one-way ledges, hazard spikes, crumble blocks, and bounce pads.
- Entity drag-and-drop handles for moving platforms, laser barriers, turrets, portals, collectibles, keys, and spawn points.
-
Ground-Aligned Snapping: Portals, bounce pads, and platforms automatically snap flush with ground tiles (
$y + 6$ portal alignment). - Doorway Obstruction Guides: Visual red warning indicators if solid blocks obstruct sector doorways.
-
Entity Inspector:
- Quantum Portals: Configure unique IDs, destination portal dropdowns with cross-sector lookup, neon glow color pickers with palette presets, and Reversed Velocity toggles.
- Laser Barriers & Turrets: Edit harmonic movement paths, cycle timings (idle/warning/active), projectile speeds, auto-targeting radius, and continuous beam mode.
- Moving Platforms: Configure start/end points, speeds, pause durations, and one-way platform toggles.
- Keys & Locked Gates: Assign key colors, labels, and bind keys to sector exit doorways.
-
Diagnostics & Linting Validator:
- Real-time validation flagging duplicate IDs, broken portal targets, self-targeting portals, missing keys, and solid obstructions.
-
Direct Export to Game & Custom World Loading:
-
One-Click / Hotkey Testing: Send levels directly to the game over the real-time cross-window
postMessage/localStoragebridge. -
Custom World File Loading: Download complete world bundles (
.json) or single room files from the editor, and load them directly into the game at any time using the in-game "+ Load Custom World (.json)..." menu dropdown.
-
One-Click / Hotkey Testing: Send levels directly to the game over the real-time cross-window
-
Import & Export:
- Direct export and import of complete world bundles or individual room JSON files conforming to
room.schema.json, with clipboard copying and local file downloads.
- Direct export and import of complete world bundles or individual room JSON files conforming to
| Action | Keyboard | Gamepad | Mouse / Touch |
|---|---|---|---|
| Move Left / Right | A / D or โ / โ |
D-Pad / Left Stick | โ |
| Jump | Space / W / โ |
Button A / Cross |
โ |
| Duck / Crouch / Crawl | S or โ |
Down on D-Pad / Stick |
โ |
| Drop Through Platform | S + Space or โ + Jump |
Down + Button A |
โ |
| Sector Map (2D Overlay) | M |
Button Y / Triangle |
HUD Map Button |
| Reset Sector / Die (Tap) | R (Tap) |
Button Select / Back (Tap) |
Reset [R] Button (Tap) |
| Restart Whole Level (Hold 0.8s) | Hold R |
Hold Select / Back |
Reset [R] Button (Hold) |
| Toggle Sound | U |
โ | HUD Sound Button |
| Music Volume (HIGH/MED/LOW/OFF) | โ | โ | Settings Gear Menu (โ) |
| Toggle 3D / Flat View | C |
โ | HUD View Button |
| Reset 3D Camera | V |
Button R3 (Stick Click) |
HUD Camera Button |
| Performance Telemetry | P / F3 / ` |
โ | HUD Profiler Button |
| Developer Console | F2 |
โ | Gear Menu โข Status Badges |
| Shift+Click Teleport (Dev Mode) | Shift + Left Click |
โ | Click anywhere in chamber |
| Orbit 3D Camera | I / J / K / L |
Right Thumbstick | Left Click + Drag |
| Zoom In / Out | โ | โ | Mouse Wheel |
The included demo campaign demonstrates the infinite hypercube topology and advanced mechanics:
-
Sectors
$(0,0) \rightarrow (6,0)$ : A continuous 7-screen horizontal voyage exceeding the 6 physical faces of a 3D cube. -
Sector
$(0,0)$ Genesis Core$\leftrightarrow$ $(2,2)$ Starlight Zenith: Features interconnected Quantum Portals bridging the starting room directly with the high-altitude zenith. -
Sector
$(2,1)$ The Spire &$(2,2)$ Starlight Zenith: Vertical climb chambers testing Up/Down 90ยฐ tumble rotations, laser barriers, and moving elevator lifts. -
Sector
$(4,-1)$ Sub-Zero Crypt: Secret subterranean vault accessed by falling through a chasm, containing hidden Energy Prisms and high-power launch pads. - Key-Gated Passages: The Warp Core Key chamber guarding the final sector doorway.
-
Sector
$(6,0)$ Prism Horizon: The Warp Core Goal Portal completing the stage.
- Node.js (version 22.0 or 24.0 recommended)
npm(bundled with Node.js)
# Clone the repository
git clone https://github.com/vos/hyperfold.git
cd hyperfold
# Install game dependencies
npm install
# Install editor dependencies
npm --prefix editor install# Start local game development server (HMR enabled)
npm run dev
# Or build and preview the optimized production game bundle
npm startOpen http://localhost:3000 in your browser.
# Start the visual World Editor
npm run editor
# Build the World Editor for production
npm run editor:build
# Preview the World Editor production build
npm run editor:previewOpen http://localhost:5174 in your browser.
To build both the game and the world editor together into dist/ (placing the editor in the dist/editor/ subfolder, exactly matching the GitHub Pages deployment structure):
# Build both game and editor into dist/
npm run build:all
# Preview the unified build locally (game at / and editor at /editor/)
npm run previewThe repository includes a GitHub Actions Workflow running on Node.js 24 that automatically builds and deploys both the game (/) and the editor (/editor/) to GitHub Pages upon pushing to main or triggering manually via workflow_dispatch.
๐ก Instant Playtesting: You can directly export and test your custom levels in the game with zero manual setup by pressing
F5or clicking Test in Game [F5] in the editor header, or by downloading the.jsonworld bundle and selecting "+ Load Custom World (.json)..." from the game's world selection dropdown. The editor automatically reuses your open game tab and hot-reloads the world instantaneously.
Run the comprehensive unit and integration test suite powered by Node.js's native test runner:
npm test196 automated tests passing across 19 test suites:
-
tests/procedural_music.test.mjsโ Procedural generative music engine: MIDI-to-frequency conversion math, deterministic sector harmonic seeding, modal scale mapping, dynamic hazard score & percussion scaling, death choke / rotation sweep filter modulation, volume & mute controls, and lookahead clock lifecycle. -
tests/shared-entities.test.mjsโ Single source of truth verification: canonical spatial constants, entity defaults, gate key palettes, turret base angles, turret sanitization, kinematics solvers, tile conversions, portal geometry, and coordinate navigation math. -
tests/dev-tools.test.mjsโ Developer manager singleton, dynamic hazard modes, god mode, fly mode, kinematics cheats, sector discovery, draggable overlay interaction, boundary clamping, and state persistence. -
tests/portals.test.mjsโ Quantum portal routing,$N \to 1$ topology, collision exit debouncing, intra/inter-sector kinematics, and reversed velocity vector inversion. -
tests/gate-keys.test.mjsโ Key pickups, locked exit forcefields, collision rejection, and sector map key markers. -
tests/danger-spikes.test.mjsโ Directional spikes (walls, roof, platform) collision & geometric orientation detection. -
tests/ducking.test.mjsโ Crouch kinematics, hitbox reduction, 1-tile crawlspaces, and laser avoidance. -
tests/laser-hazards.test.mjsโ Laser barrier timing cycles, harmonic motion, raycast beams, projectiles, and dynamic moving platform shielding. -
tests/moving-platforms.test.mjsโ Moving platform kinematics, passenger physics, momentum inheritance, and 3D pre-render face mapping. -
tests/procedural.test.mjsโ Seed determinism, exit symmetry, safe spawn guarantees, difficulty curves, and Power Sanctuary archetypes. -
tests/renderer-optimization.test.mjsโ Dynamic entity detection, chassis geometry merging, and round-robin texture upload throttling. -
tests/sector-map.test.mjsโ 2D Sector Map discovery, bounding box calculation, key markers, and locked gate symbols. -
tests/editor-integration.test.mjsโ World editor serialization, import/export, schema validation diagnostics, F5 playtest shortcut validation, and test in game window reuse. -
tests/floor.test.mjsโ Floor integrity and safe spawn points across all campaign sectors. -
tests/player-explosion.test.mjsโ 360ยฐ death explosion, synth sound, & R tap/hold reset logic. -
tests/navigation.test.mjsโ Infinite non-Euclidean topology invariants. -
tests/perf-tracker.test.mjsโ Telemetry statistics, FPS tracking, and sample ring buffers. -
tests/world-registry.test.mjsโ Dynamic world bundle loading and memory isolation. -
tests/declarative-level.test.mjsโ JSON level loading and schema compliance.
hyperfold/
โโโ index.html # WebGL viewport, HUD overlays, and styling
โโโ package.json # Project metadata and build scripts
โโโ tsconfig.json # Strict TypeScript configuration (with @shared paths)
โโโ vite.config.ts # Vite bundler configuration (with @shared alias)
โโโ screenshot.jpg # Gameplay showcase image
โโโ shared/ # Single source of truth shared between game and editor
โ โโโ index.ts # Central barrel export
โ โโโ constants.ts # Canonical spatial dimensions (ROOM_SIZE 800, TILE_SIZE 40, GRID 20x20)
โ โโโ types/ # Entity, world, and tile data contracts
โ โ โโโ entities.ts # MovingPlatformConfig, LaserBarrierConfig, Turret, Portal, Collectible
โ โ โโโ world.ts # RoomData, WorldData, WorldManifest, RoomExits, ExitGateConfig
โ โ โโโ tiles.ts # TileType (strip-compatible const), TileGlyph, TileDefinition
โ โโโ entities/ # Entity defaults, kinematics, turret, portal, & gate helpers
โ โ โโโ defaults.ts # Canonical entity defaults (DEFAULT_MOVING_PLATFORM, etc.)
โ โ โโโ platform.ts # Harmonic sinusoidal moving platform kinematic solver
โ โ โโโ barrier.ts # Laser barrier kinematics and 3-phase activation solver
โ โ โโโ turret.ts # Turret base angle calculations and mode sanitization
โ โ โโโ portal.ts # Portal bounding box and center point helpers
โ โ โโโ collectible.ts # GATE_KEY_PALETTE, getGateColor, and exit gate helpers
โ โโโ tiles/ # Tile definitions, hotkeys, and converters
โ โ โโโ tileRegistry.ts # TILE_DEFINITIONS, glyphToTileType, tileTypeToGlyph
โ โ โโโ spikes.ts # Surface-attached spike orientation resolver
โ โโโ navigation/ # Hypercube lattice navigation and adjacent sector math
โ โโโ coordinates.ts # getAdjacentCoords, getOppositeDirection, getAdjacentSectors
โโโ editor/ # Hyperfold World Editor (React + Vite + Tailwind)
โ โโโ index.html # Editor mount point
โ โโโ package.json # Editor dependencies
โ โโโ src/
โ โ โโโ App.tsx # Main editor shell and view coordinator
โ โ โโโ components/
โ โ โ โโโ GridCanvas.tsx # Interactive 2D room canvas with entity handles
โ โ โ โโโ InspectorPanel.tsx # Entity and sector property editor
โ โ โ โโโ WorldGraphView.tsx # 2D topological sector map with drag & drop
โ โ โ โโโ Toolbar.tsx # Tool selection, world/room actions
โ โ โโโ types/world.ts # Re-exports from @shared and declares editor UI states
โ โ โโโ utils/
โ โ โโโ navigation.ts # Re-exports navigation math from @shared
โ โ โโโ serialization.ts # World/room import, export, and cloning via @shared
โ โ โโโ tileDefinitions.ts # Re-exports tile registry from @shared
โ โ โโโ validator.ts # Diagnostics linting engine
โ โโโ vite.config.ts # Editor bundler configuration (with @shared alias)
โโโ src/
โ โโโ main.ts # Game loop, state coordinator, and transition manager
โ โโโ engine/
โ โ โโโ AudioManager.ts # Master audio facade, SFX synthesis, and music engine routing
โ โ โโโ DevManager.ts # Cheats, kinematics overrides, hazard modes, and persistence
โ โ โโโ InputManager.ts # Keyboard, mouse, and Gamepad API handlers
โ โ โโโ ParticleSystem.ts # 2D canvas particle emitter and trail effects
โ โ โโโ PerformanceTracker.ts # Frame time profiler and ring buffer
โ โ โโโ PhysicsEngine.ts # Kinematics, AABB collision, moving platforms, lasers, portals
โ โ โโโ ProceduralMusicEngine.ts # Generative synthesizer engine, lookahead clock, & sector adapter
โ โ โโโ SynthInstruments.ts # Pure Web Audio procedural instruments (pads, 303 bass, arps, drums)
โ โโโ entities/
โ โ โโโ LaserBarrier.ts # Laser barrier entity delegating kinematics to @shared
โ โ โโโ LaserTurret.ts # Wall/ceiling turrets with projectile and raycast beam collision
โ โ โโโ MovingPlatform.ts # Moving platform entity delegating kinematics to @shared
โ โ โโโ Player.ts # Player state, kinematics, ducking, and rendering
โ โโโ graphics/
โ โ โโโ CubeRenderer.ts # Three.js 3D beveled cube, orbit camera, and tumble slerp
โ โ โโโ FaceRenderer.ts # 2D Canvas tilemap, portals, and HUD compositor for cube faces
โ โ โโโ VoidBackground.ts # Deep space starfield and floating polyhedra
โ โโโ ui/
โ โ โโโ DevDebugOverlay.ts # Developer debug console, cheats, and diagnostics
โ โ โโโ Draggable.ts # Pointer-based draggable overlay controller with persistence
โ โ โโโ PerformanceDebugView.ts# Real-time telemetry, FPS graphing, and profiler
โ โ โโโ SectorMapView.ts # 2D panoramic sector map overlay
โ โโโ world/
โ โโโ LevelLoader.ts # ASCII grid parser and JSON loader via @shared
โ โโโ LevelMap.ts # Dynamic coordinate-based room map and portal indexing
โ โโโ ProceduralLevelMap.ts # On-demand infinite procedural sector generator
โ โโโ ProceduralWorldGenerator.ts # Seeded room generator with difficulty curve
โ โโโ ScreenData.ts # Re-exports @shared and defines runtime ScreenData
โ โโโ WorldRegistry.ts # Auto-discovery and registration of worlds
โโโ worlds/
โ โโโ demo/ # Built-in campaign sectors (Genesis Core, Spire, Zenith, etc.)
โ โโโ schemas/ # JSON schemas for room and world validation
โโโ tests/ # Node.js automated test suites (196 tests)
In Euclidean space, a cube has exactly 6 faces. If you walk across 4 faces in one direction, you return to where you started.
Hyperfold decouples the physical 3D representation from the logical room topology:
- The player always plays on the Front Face (
$+Z$ ) of a 3D cube. - The world is an open coordinate plane
$\mathbb{Z}^2$ . - When crossing an exit seam in direction
$\vec{d}$ (or stepping into a cross-sector portal), the target room is rendered onto the corresponding adjacent face. - The cube rotates 90ยฐ toward
$\vec{d}$ . - Once rotation completes, the coordinate state updates, the cube's rotation quaternion is instantaneously reset to identity
$(0, 0, 0, 1)$ , and all surrounding faces are immediately rebound to the new room's logical neighbors.
The visual illusion is a seamless tumble in 3D space; the mathematical reality is an infinite, navigable plane folded across a 6-sided die.
This project is licensed under the MIT License.
