Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

feat(openworld): add Cyber Shards collectibles, speed boost pads, speedometer HUD, and procedural Web Audio SFX (#4702)

[._.]/ Adam Eivy42c0165cd711
diff --git a/client/src/components/openworld/OpenWorldCollectibles.jsx b/client/src/components/openworld/OpenWorldCollectibles.jsx
new file mode 100644
index 0000000000..ebbaab2a71
--- /dev/null
+++ b/client/src/components/openworld/OpenWorldCollectibles.jsx
@@ -0,0 +1,113 @@
+import { useMemo, useRef } from 'react';
+import { useFrame } from '@react-three/fiber';
+import * as THREE from 'three';
+import { getCollectiblesList } from '../../utils/openWorldCollectibles';
+
+function ShardMesh({ shard, animate }) {
+ const meshRef = useRef();
+ const ringRef = useRef();
+ const { color, x, y, z, pulsePhase } = shard;
+
+ useFrame(({ clock }) => {
+ if (!meshRef.current) return;
+ const t = clock.getElapsedTime();
+ if (animate) {
+ meshRef.current.rotation.y = t * 1.6 + pulsePhase * Math.PI;
+ meshRef.current.rotation.x = Math.sin(t * 1.2 + pulsePhase) * 0.15;
+ meshRef.current.position.y = y + Math.sin(t * 2.4 + pulsePhase * Math.PI * 2) * 0.22;
+ if (ringRef.current) {
+ ringRef.current.rotation.z = t * 0.8;
+ ringRef.current.scale.setScalar(1 + Math.sin(t * 3 + pulsePhase) * 0.1);
+ }
+ }
+ });
+
+ return (
+ <group position={[x, 0, z]}>
+ <mesh ref={meshRef} position={[0, y, 0]}>
+ <octahedronGeometry args={[0.55, 0]} />
+ <meshStandardMaterial
+ color={color}
+ emissive={color}
+ emissiveIntensity={1.4}
+ metalness={0.8}
+ roughness={0.15}
+ toneMapped={false}
+ />
+ </mesh>
+
+ <mesh ref={ringRef} rotation={[-Math.PI / 2, 0, 0]} position={[0, 0.04, 0]}>
+ <ringGeometry args={[0.6, 0.72, 16]} />
+ <meshBasicMaterial
+ color={color}
+ transparent
+ opacity={0.35}
+ blending={THREE.AdditiveBlending}
+ depthWrite={false}
+ side={THREE.DoubleSide}
+ />
+ </mesh>
+ </group>
+ );
+}
+
+function CollectionBurst({ burst }) {
+ const groupRef = useRef();
+
+ useFrame((_, delta) => {
+ if (!groupRef.current) return;
+ burst.age += delta;
+ const progress = Math.min(1, burst.age / 0.8);
+ const scale = 1 + progress * 2.8;
+ groupRef.current.scale.set(scale, scale, scale);
+ groupRef.current.position.y = burst.y + progress * 1.5;
+ if (groupRef.current.children[0]?.material) {
+ groupRef.current.children[0].material.opacity = Math.max(0, 1 - progress);
+ }
+ });
+
+ if (burst.age >= 0.8) return null;
+
+ return (
+ <group ref={groupRef} position={[burst.x, burst.y, burst.z]}>
+ <mesh>
+ <sphereGeometry args={[0.4, 8, 8]} />
+ <meshBasicMaterial
+ color={burst.color || '#06b6d4'}
+ transparent
+ opacity={0.9}
+ blending={THREE.AdditiveBlending}
+ depthWrite={false}
+ />
+ </mesh>
+ </group>
+ );
+}
+
+export default function OpenWorldCollectibles({
+ collectedShardIds = new Set(),
+ activeBursts = [],
+ settings,
+}) {
+ const shards = useMemo(() => getCollectiblesList(), []);
+ const animate = (settings?.particleDensity ?? 1) >= 0.5;
+ const visibleShards = useMemo(
+ () => shards.filter((s) => !collectedShardIds.has(s.id)),
+ [shards, collectedShardIds]
+ );
+
+ return (
+ <group>
+ {visibleShards.map((shard) => (
+ <ShardMesh
+ key={shard.id}
+ shard={shard}
+ animate={animate}
+ />
+ ))}
+ {activeBursts.map((burst) => (
+ <CollectionBurst key={burst.id} burst={burst} />
+ ))}
+ </group>
+ );
+}
diff --git a/client/src/components/openworld/OpenWorldHud.jsx b/client/src/components/openworld/OpenWorldHud.jsx
index 8c4fd8331c..27fc7e8f97 100644
--- a/client/src/components/openworld/OpenWorldHud.jsx
+++ b/client/src/components/openworld/OpenWorldHud.jsx
@@ -9,6 +9,7 @@ import OpenWorldXpBadge from './OpenWorldXpBadge';
import OpenWorldMiniMap from './OpenWorldMiniMap';
import OpenWorldHudCompact from './OpenWorldHudCompact';
import OpenWorldInteractionPrompt from './OpenWorldInteractionPrompt';
+import OpenWorldSpeedometer from './OpenWorldSpeedometer';
import { HealthBar, getHealthSentinel } from './openWorldHudBits';
import useOpenWorldViewport from '../../hooks/useOpenWorldViewport';
import { formatClockTime } from '../../utils/formatters';
@@ -75,7 +76,43 @@ function HudAction({ icon: Icon, label, hint, active, primary = false, onClick }
);
}
-export default function OpenWorldHud({ cosStatus, cosAgents, agentMap, eventLogs, connected, apps, reviewCounts, instances, productivityData, systemHealth, notificationCounts, character, filter, onFilterChange, onJumpToFirst, matchCount, onToggleExploration, explorationMode, onSelectApp, onEnterPhotoMode, onEnterPlayback, focusedAppId, focusedApp, focusNotFound, focusAgents, onCloseFocus, onFocusInWorld, onOpenFastTravel, onOpenDestination, onAttentionItem, activeRegion, proximityTarget }) {
+export default function OpenWorldHud({
+ cosStatus,
+ cosAgents,
+ agentMap,
+ eventLogs,
+ connected,
+ apps,
+ reviewCounts,
+ instances,
+ productivityData,
+ systemHealth,
+ notificationCounts,
+ character,
+ filter,
+ onFilterChange,
+ onJumpToFirst,
+ matchCount,
+ onToggleExploration,
+ explorationMode,
+ onSelectApp,
+ onEnterPhotoMode,
+ onEnterPlayback,
+ focusedAppId,
+ focusedApp,
+ focusNotFound,
+ focusAgents,
+ onCloseFocus,
+ onFocusInWorld,
+ onOpenFastTravel,
+ onOpenDestination,
+ onAttentionItem,
+ activeRegion,
+ proximityTarget,
+ playerPose = null,
+ collectedCount = 0,
+ totalShards = 18,
+}) {
const isFocused = Boolean(focusedApp || focusNotFound);
const navigate = useNavigate();
const location = useLocation();
@@ -218,8 +255,20 @@ export default function OpenWorldHud({ cosStatus, cosAgents, agentMap, eventLogs
<OpenWorldAgentBar cosAgents={cosAgents} agentMap={agentMap} />
<OpenWorldXpBadge character={character} onOpenDestination={onOpenDestination} />
- <div className="absolute bottom-4 left-4 pointer-events-auto">
- <OpenWorldMiniMap apps={apps} onSelectApp={onSelectApp} selectedAppId={focusedAppId} />
+ <div className="absolute bottom-4 left-4 pointer-events-auto flex flex-col gap-2 items-start">
+ <OpenWorldMiniMap
+ apps={apps}
+ onSelectApp={onSelectApp}
+ selectedAppId={focusedAppId}
+ playerPose={playerPose}
+ />
+ {explorationMode && (
+ <OpenWorldSpeedometer
+ playerPose={playerPose}
+ collectedCount={collectedCount}
+ totalShards={totalShards}
+ />
+ )}
<div className="openworld-hud-action-rail">
{onOpenFastTravel && <HudAction icon={MapIcon} label="World map" hint="M" onClick={onOpenFastTravel} />}
<HudAction
diff --git a/client/src/components/openworld/OpenWorldInteractionPrompt.jsx b/client/src/components/openworld/OpenWorldInteractionPrompt.jsx
index fdff22909d..fd12ab49e6 100644
--- a/client/src/components/openworld/OpenWorldInteractionPrompt.jsx
+++ b/client/src/components/openworld/OpenWorldInteractionPrompt.jsx
@@ -3,8 +3,8 @@ function targetCopy(target) {
const isWarpPad = target.type === 'warpPad';
const label = target.label || (isWarpPad ? 'REGION' : 'BUILDING');
return {
- eyebrow: isWarpPad ? 'WARP GATE' : 'NEARBY BUILDING',
- action: isWarpPad ? 'WARP TO' : 'OPEN',
+ eyebrow: target.eyebrow || (isWarpPad ? 'WARP GATE' : 'NEARBY BUILDING'),
+ action: target.action || (isWarpPad ? 'WARP TO' : 'OPEN'),
label,
};
}
diff --git a/client/src/components/openworld/OpenWorldMiniMap.jsx b/client/src/components/openworld/OpenWorldMiniMap.jsx
index bdd1a6301c..33bd6133ee 100644
--- a/client/src/components/openworld/OpenWorldMiniMap.jsx
+++ b/client/src/components/openworld/OpenWorldMiniMap.jsx
@@ -20,14 +20,22 @@ import { computeMiniMap } from '../../utils/openWorldMiniMap';
// Map box size in px. Fixed so the projection has a stable target on desktop.
const MAP_SIZE = 132;
-export default function OpenWorldMiniMap({ apps, onSelectApp, selectedAppId = null, alwaysShow = false }) {
- // Status colors track the theme accent for 'online' (the rest stay semantic), so a
- // dot matches its building exactly. Read from the palette the city page provides.
- const { getBuildingColor } = useOpenWorldPalette();
+export default function OpenWorldMiniMap({
+ apps,
+ onSelectApp,
+ selectedAppId = null,
+ alwaysShow = false,
+ playerPose = null,
+}) {
+ const { getBuildingColor, accent } = useOpenWorldPalette();
+ const positions = useMemo(() => computeOpenWorldLayout(Array.isArray(apps) ? apps : []), [apps]);
const view = useMemo(() => {
- const positions = computeOpenWorldLayout(Array.isArray(apps) ? apps : []);
- return computeMiniMap(apps, positions, { geography: true });
- }, [apps]);
+ return computeMiniMap(apps, positions, {
+ geography: true,
+ landmarks: true,
+ player: playerPose ? { position: playerPose, heading: playerPose.heading || 0 } : null,
+ });
+ }, [apps, positions, playerPose]);
if (view.empty) return null;
@@ -53,11 +61,11 @@ export default function OpenWorldMiniMap({ apps, onSelectApp, selectedAppId = nu
/>
{/* Data Harbor pier marker. */}
<div
- className="absolute w-1 h-1 rounded-[1px] bg-cyan-300/70 -translate-x-1/2 -translate-y-1/2 rotate-45"
+ className="absolute w-1.5 h-1.5 rounded-[1px] bg-cyan-300/70 -translate-x-1/2 -translate-y-1/2 rotate-45"
style={{
left: `${(view.geography.harbor.nx * 100).toFixed(2)}%`,
top: `${(view.geography.harbor.ny * 100).toFixed(2)}%`,
- boxShadow: '0 0 3px rgba(103, 232, 249, 0.8)',
+ boxShadow: '0 0 4px rgba(103, 232, 249, 0.8)',
}}
title={view.geography.harbor.label}
/>
@@ -70,6 +78,26 @@ export default function OpenWorldMiniMap({ apps, onSelectApp, selectedAppId = nu
<div className="absolute left-1/2 top-0 bottom-0 w-px bg-cyan-500/10" />
</div>
+ {/* District landmark indicators */}
+ {view.landmarks?.map((lm) => {
+ const left = `${(lm.nx * 100).toFixed(2)}%`;
+ const top = `${(lm.ny * 100).toFixed(2)}%`;
+ return (
+ <span
+ key={lm.id}
+ title={lm.label}
+ className="absolute w-1 h-1 rounded-xs -translate-x-1/2 -translate-y-1/2 opacity-70"
+ style={{
+ left,
+ top,
+ backgroundColor: lm.color,
+ boxShadow: `0 0 2px ${lm.color}`,
+ }}
+ />
+ );
+ })}
+
+ {/* App building dots */}
{view.dots.map((dot) => {
const color = getBuildingColor(dot.status, dot.archived);
const left = `${(dot.nx * 100).toFixed(2)}%`;
@@ -108,6 +136,25 @@ export default function OpenWorldMiniMap({ apps, onSelectApp, selectedAppId = nu
/>
);
})}
+
+ {/* Live Player Pose Blip & Heading Arrow */}
+ {view.player && (
+ <div
+ className="absolute pointer-events-none z-20 -translate-x-1/2 -translate-y-1/2"
+ style={{
+ left: `${(view.player.nx * 100).toFixed(2)}%`,
+ top: `${(view.player.ny * 100).toFixed(2)}%`,
+ }}
+ >
+ <div
+ className="w-0 h-0 border-l-[3.5px] border-l-transparent border-r-[3.5px] border-r-transparent border-b-[8px] filter drop-shadow-[0_0_4px_rgba(6,182,212,0.9)]"
+ style={{
+ borderBottomColor: accent || '#06b6d4',
+ transform: `rotate(${view.player.rotationDeg}deg)`,
+ }}
+ />
+ </div>
+ )}
</div>
</div>
</div>
diff --git a/client/src/components/openworld/OpenWorldScene.jsx b/client/src/components/openworld/OpenWorldScene.jsx
index f0a007b6f0..fa4bcff21d 100644
--- a/client/src/components/openworld/OpenWorldScene.jsx
+++ b/client/src/components/openworld/OpenWorldScene.jsx
@@ -44,6 +44,8 @@ import OpenWorldStreets from './OpenWorldStreets';
import OpenWorldStreetProps from './OpenWorldStreetProps';
import OpenWorldTransitLoop from './OpenWorldTransitLoop';
import OpenWorldEnergyOverlay from './OpenWorldEnergyOverlay';
+import OpenWorldSpeedPads from './OpenWorldSpeedPads';
+import OpenWorldCollectibles from './OpenWorldCollectibles';
import PlayerController from './PlayerController';
import CameraTransition from './CameraTransition';
import OpenWorldFocusCamera from './OpenWorldFocusCamera';
@@ -54,13 +56,63 @@ import { openWorldDayMix, getTimeOfDayPreset } from './openWorldConstants';
import { CITY_MAX_ORBIT_DISTANCE } from '../../utils/openWorldFocusCamera';
import { THIRD_PERSON } from '../../utils/openWorldPlayerRig';
import { listRegions } from '../../utils/openWorldRegions';
+import { computeEasterEggs } from '../../utils/openWorldEasterEggs';
import { OpenWorldPaletteProvider } from './OpenWorldPaletteContext';
import ErrorBoundary from '../ErrorBoundary';
import { useVisibilityEvent } from '../../hooks/useVisibilityEvent';
const STARTUP_PARTICLE_DENSITY = 0.49;
-export default function OpenWorldScene({ apps, agentMap, onBuildingClick, onToggleCameraView, cosStatus, reviewCounts, instances, backupStatus, cosTasks, healthMetrics, voiceState, aiActivity, productivityData, activityCalendar, goals, character, chronotype, memoryGraph, inboxDepth, jiraTickets, introspection, playback = false, photoMode, photoPresetId, photoDof, onPhotoCaptureReady, settings, playSfx, keysRef, mobileInputRef, playerActionRef, dimmedAppIds, focusedAppId, focusedRegion, playerTeleport, hudSafe, background, palette, onTravelToRegion, onProximityChange, autoQuality = false, autoStartTier = 'high', autoResetToken = 0, onAutoTierChange }) {
+export default function OpenWorldScene({
+ apps,
+ agentMap,
+ onBuildingClick,
+ onToggleCameraView,
+ cosStatus,
+ reviewCounts,
+ instances,
+ backupStatus,
+ cosTasks,
+ healthMetrics,
+ voiceState,
+ aiActivity,
+ productivityData,
+ activityCalendar,
+ goals,
+ character,
+ chronotype,
+ memoryGraph,
+ inboxDepth,
+ jiraTickets,
+ introspection,
+ playback = false,
+ photoMode,
+ photoPresetId,
+ photoDof,
+ onPhotoCaptureReady,
+ settings,
+ playSfx,
+ keysRef,
+ mobileInputRef,
+ playerActionRef,
+ dimmedAppIds,
+ focusedAppId,
+ focusedRegion,
+ playerTeleport,
+ hudSafe,
+ background,
+ palette,
+ onTravelToRegion,
+ onProximityChange,
+ autoQuality = false,
+ autoStartTier = 'high',
+ autoResetToken = 0,
+ onAutoTierChange,
+ collectedShardIds = new Set(),
+ onCollectShard,
+ activeBursts = [],
+ onPlayerPoseChange,
+}) {
const [positions, setPositions] = useState(null);
const [proximityApp, setProximityApp] = useState(null);
const [proximityWarpPad, setProximityWarpPad] = useState(null);
@@ -105,6 +157,10 @@ export default function OpenWorldScene({ apps, agentMap, onBuildingClick, onTogg
// read as haze and grain, so they don't mount at all rather than fading per-frame.
const neonLayers = Boolean(palette?.neonLayers);
const warpRegions = useMemo(() => listRegions(), []);
+ const easterEggsList = useMemo(
+ () => computeEasterEggs({ character, goals, productivityData }),
+ [character, goals, productivityData]
+ );
useEffect(() => {
if (photoMode) {
@@ -346,6 +402,12 @@ export default function OpenWorldScene({ apps, agentMap, onBuildingClick, onTogg
<WorldGround settings={renderSettings} />
<OpenWorldStreets settings={renderSettings} />
<OpenWorldStreetProps settings={renderSettings} />
+ <OpenWorldSpeedPads settings={renderSettings} />
+ <OpenWorldCollectibles
+ collectedShardIds={collectedShardIds}
+ activeBursts={activeBursts}
+ settings={renderSettings}
+ />
<OpenWorldTransitLoop settings={renderSettings} />
<BuildingCluster
@@ -390,6 +452,7 @@ export default function OpenWorldScene({ apps, agentMap, onBuildingClick, onTogg
positions={positions}
onBuildingProximity={handleBuildingProximity}
onWarpPadProximity={handleWarpPadProximity}
+ onProximityChange={onProximityChange}
onBuildingClick={onBuildingClick}
onToggleCameraView={onToggleCameraView}
apps={apps}
@@ -399,6 +462,11 @@ export default function OpenWorldScene({ apps, agentMap, onBuildingClick, onTogg
teleport={playerTeleport}
warpPads={warpRegions}
onWarpPadInteract={onTravelToRegion}
+ easterEggs={easterEggsList}
+ collectedShardIds={collectedShardIds}
+ onCollectShard={onCollectShard}
+ onPlayerPoseChange={onPlayerPoseChange}
+ playSfx={playSfx}
mobileInputRef={mobileInputRef}
playerActionRef={playerActionRef}
/>
diff --git a/client/src/components/openworld/OpenWorldSpeedPads.jsx b/client/src/components/openworld/OpenWorldSpeedPads.jsx
new file mode 100644
index 0000000000..acda1a1103
--- /dev/null
+++ b/client/src/components/openworld/OpenWorldSpeedPads.jsx
@@ -0,0 +1,72 @@
+import { useMemo, useRef } from 'react';
+import { useFrame } from '@react-three/fiber';
+import * as THREE from 'three';
+import { getSpeedPadsList } from '../../utils/openWorldSpeedPads';
+
+function SpeedPad({ pad, animate }) {
+ const { x, z, angle, width, length, color } = pad;
+ const chevronsRef = useRef();
+
+ useFrame(({ clock }) => {
+ if (!animate || !chevronsRef.current) return;
+ const t = clock.getElapsedTime();
+ // Pulse and animate chevron brightness
+ chevronsRef.current.children.forEach((mesh, index) => {
+ if (!mesh?.material) return;
+ const phase = (t * 3.5 - index * 0.4) % Math.PI;
+ const intensity = Math.sin(Math.max(0, phase));
+ mesh.material.opacity = 0.35 + intensity * 0.55;
+ });
+ });
+
+ return (
+ <group position={[x, 0.03, z]} rotation={[0, angle, 0]}>
+ {/* Base pad plate */}
+ <mesh rotation={[-Math.PI / 2, 0, 0]}>
+ <planeGeometry args={[length, width]} />
+ <meshStandardMaterial
+ color="#0f172a"
+ emissive={color}
+ emissiveIntensity={0.25}
+ roughness={0.8}
+ metalness={0.3}
+ />
+ </mesh>
+
+ {/* Outer border trim */}
+ <mesh rotation={[-Math.PI / 2, 0, 0]} position={[0, 0.005, 0]}>
+ <ringGeometry args={[width * 0.46, width * 0.49, 4]} />
+ <meshBasicMaterial color={color} transparent opacity={0.6} blending={THREE.AdditiveBlending} />
+ </mesh>
+
+ {/* Chevrons pointing forward (+X in local rotated space) */}
+ <group ref={chevronsRef} position={[0, 0.01, 0]}>
+ {[-1.3, 0, 1.3].map((offsetX, idx) => (
+ <mesh key={idx} position={[offsetX, 0, 0]} rotation={[-Math.PI / 2, 0, -Math.PI / 2]}>
+ <coneGeometry args={[0.7, 0.9, 3]} />
+ <meshBasicMaterial
+ color={color}
+ transparent
+ opacity={0.6}
+ blending={THREE.AdditiveBlending}
+ depthWrite={false}
+ />
+ </mesh>
+ ))}
+ </group>
+ </group>
+ );
+}
+
+export default function OpenWorldSpeedPads({ settings }) {
+ const pads = useMemo(() => getSpeedPadsList(), []);
+ const animate = (settings?.particleDensity ?? 1) >= 0.5;
+
+ return (
+ <group>
+ {pads.map((pad) => (
+ <SpeedPad key={pad.id} pad={pad} animate={animate} />
+ ))}
+ </group>
+ );
+}
diff --git a/client/src/components/openworld/OpenWorldSpeedometer.jsx b/client/src/components/openworld/OpenWorldSpeedometer.jsx
new file mode 100644
index 0000000000..96e8e5947c
--- /dev/null
+++ b/client/src/components/openworld/OpenWorldSpeedometer.jsx
@@ -0,0 +1,59 @@
+import { useMemo } from 'react';
+import { TOTAL_SHARDS } from '../../utils/openWorldCollectibles';
+
+export default function OpenWorldSpeedometer({
+ playerPose,
+ collectedCount = 0,
+ totalShards = TOTAL_SHARDS,
+}) {
+ const speed = playerPose?.speed || 0;
+ const kmh = Math.round(Math.abs(speed) * 3.6);
+ const speedRatio = Math.min(1, Math.abs(speed) / 38);
+
+ const modeBadge = useMemo(() => {
+ if (playerPose?.airborne) return { label: 'AIRBORNE', color: 'text-purple-400 border-purple-500/40 bg-purple-500/10' };
+ if (playerPose?.skid > 0.4 && Math.abs(speed) > 5) return { label: 'DRIFT', color: 'text-amber-400 border-amber-500/40 bg-amber-500/10' };
+ if (playerPose?.boosting || Math.abs(speed) > 26) return { label: 'BOOST', color: 'text-cyan-300 border-cyan-400/50 bg-cyan-400/20 animate-pulse' };
+ if (speed < -0.2) return { label: 'REVERSE', color: 'text-rose-400 border-rose-500/40 bg-rose-500/10' };
+ if (Math.abs(speed) > 0.2) return { label: 'DRIVE', color: 'text-emerald-400 border-emerald-500/40 bg-emerald-500/10' };
+ return { label: 'PARK', color: 'text-slate-400 border-slate-500/30 bg-slate-500/10' };
+ }, [playerPose, speed]);
+
+ return (
+ <div className="openworld-hud-panel px-3.5 py-2 flex items-center gap-3.5 select-none pointer-events-auto">
+ {/* Speedometer Digital Readout */}
+ <div className="flex flex-col items-start min-w-[3.6rem]">
+ <div className="flex items-baseline gap-1">
+ <span className="font-pixel text-lg font-bold tracking-tight text-[rgb(var(--port-text))]">
+ {kmh}
+ </span>
+ <span className="font-pixel text-[8px] text-[rgb(var(--port-text-muted))]">
+ KM/H
+ </span>
+ </div>
+ {/* Speed Bar Gauge */}
+ <div className="w-full h-1 bg-[rgb(var(--port-accent)/.15)] rounded-full overflow-hidden mt-0.5">
+ <div
+ className="h-full bg-[rgb(var(--port-accent))] transition-all duration-75 rounded-full"
+ style={{ width: `${Math.round(speedRatio * 100)}%` }}
+ />
+ </div>
+ </div>
+
+ {/* Drive Mode Pill */}
+ <span
+ className={`font-pixel text-[8px] px-2 py-0.5 rounded-md border tracking-wider uppercase ${modeBadge.color}`}
+ >
+ {modeBadge.label}
+ </span>
+
+ {/* Cyber Shards Counter */}
+ <div className="flex items-center gap-1.5 px-2 py-0.5 rounded-md bg-[rgb(var(--port-accent)/.08)] border border-[rgb(var(--port-accent)/.2)]">
+ <span className="font-pixel text-[10px] text-cyan-400">⯁</span>
+ <span className="font-pixel text-[8px] tracking-wider text-[rgb(var(--port-text))]">
+ {collectedCount}/{totalShards}
+ </span>
+ </div>
+ </div>
+ );
+}
diff --git a/client/src/components/openworld/OpenWorldSpeedometer.test.jsx b/client/src/components/openworld/OpenWorldSpeedometer.test.jsx
new file mode 100644
index 0000000000..9fa9067078
--- /dev/null
+++ b/client/src/components/openworld/OpenWorldSpeedometer.test.jsx
@@ -0,0 +1,35 @@
+import { describe, it, expect } from 'vitest';
+import { render, screen } from '@testing-library/react';
+import OpenWorldSpeedometer from './OpenWorldSpeedometer';
+
+describe('OpenWorldSpeedometer', () => {
+ it('renders stationary parked state by default', () => {
+ render(<OpenWorldSpeedometer playerPose={{ speed: 0 }} collectedCount={3} totalShards={18} />);
+ expect(screen.getByText('0')).toBeDefined();
+ expect(screen.getByText('KM/H')).toBeDefined();
+ expect(screen.getByText('PARK')).toBeDefined();
+ expect(screen.getByText('3/18')).toBeDefined();
+ });
+
+ it('renders driving speed and mode badge when moving forward', () => {
+ render(<OpenWorldSpeedometer playerPose={{ speed: 10 }} collectedCount={5} totalShards={18} />);
+ // 10 units/s * 3.6 = 36 km/h
+ expect(screen.getByText('36')).toBeDefined();
+ expect(screen.getByText('DRIVE')).toBeDefined();
+ });
+
+ it('renders BOOST mode when sprinting or high speed', () => {
+ render(<OpenWorldSpeedometer playerPose={{ speed: 30, boosting: true }} collectedCount={8} totalShards={18} />);
+ expect(screen.getByText('BOOST')).toBeDefined();
+ });
+
+ it('renders DRIFT badge when skidding', () => {
+ render(<OpenWorldSpeedometer playerPose={{ speed: 12, skid: 0.6 }} collectedCount={2} totalShards={18} />);
+ expect(screen.getByText('DRIFT')).toBeDefined();
+ });
+
+ it('renders AIRBORNE badge when in flight', () => {
+ render(<OpenWorldSpeedometer playerPose={{ speed: 10, airborne: true }} collectedCount={4} totalShards={18} />);
+ expect(screen.getByText('AIRBORNE')).toBeDefined();
+ });
+});
diff --git a/client/src/components/openworld/PlayerAvatar.jsx b/client/src/components/openworld/PlayerAvatar.jsx
index 4e9824fc8d..1bfabbab57 100644
--- a/client/src/components/openworld/PlayerAvatar.jsx
+++ b/client/src/components/openworld/PlayerAvatar.jsx
@@ -22,6 +22,9 @@ export default function PlayerAvatar({ rigRef }) {
const bodyRef = useRef();
const hoverRingRef = useRef();
const underglowRef = useRef();
+ const thrusterRef = useRef();
+ const brakeLightRef = useRef();
+ const skidSmokeRef = useRef();
const wheelRefs = useRef([]);
const bodyColor = mixHex('#ee8f68', accent, 0.16);
@@ -43,6 +46,8 @@ export default function PlayerAvatar({ rigRef }) {
const targetY = rig.position.y - EYE_HEIGHT + (hovering ? 0.25 : 0);
const speed = rig.speed || 0;
const speedRatio = Math.min(1, Math.abs(speed) / 38);
+ const isBoosting = Math.abs(speed) > 24 || (running && speedRatio > 0.6);
+ const isBraking = speed < -0.1 || (rig.skid > 0.5 && speedRatio > 0.2);
root.position.lerp(_rootTarget.set(rig.position.x, targetY, rig.position.z), follow);
root.rotation.y = rig.facing;
@@ -72,6 +77,25 @@ export default function PlayerAvatar({ rigRef }) {
if (underglowRef.current) {
underglowRef.current.material.opacity = (hovering ? 0.42 : moving ? 0.26 : 0.16) + Math.sin(t * 4) * 0.025;
}
+
+ if (thrusterRef.current) {
+ const flameScale = isBoosting ? 1 + Math.sin(t * 28) * 0.3 : 0.001;
+ thrusterRef.current.scale.set(flameScale, flameScale, isBoosting ? 1.4 + Math.sin(t * 32) * 0.4 : 0.001);
+ thrusterRef.current.visible = isBoosting;
+ }
+
+ if (brakeLightRef.current) {
+ brakeLightRef.current.material.emissiveIntensity = isBraking ? 1.2 : 0.28;
+ }
+
+ if (skidSmokeRef.current) {
+ const isSkidding = rig.skid > 0.35 && speedRatio > 0.3;
+ skidSmokeRef.current.visible = isSkidding;
+ if (isSkidding) {
+ skidSmokeRef.current.rotation.z = t * 4;
+ skidSmokeRef.current.scale.setScalar(0.8 + Math.sin(t * 16) * 0.25);
+ }
+ }
});
const setWheelRef = (index) => (node) => {
@@ -94,11 +118,20 @@ export default function PlayerAvatar({ rigRef }) {
<boxGeometry args={[CAR_WIDTH * 0.88, 0.08, 0.1]} />
<meshStandardMaterial color={accent} emissive={accent} emissiveIntensity={0.45} />
</mesh>
- <mesh position={[0, 0.4, CAR_LENGTH * 0.53]}>
+ <mesh ref={brakeLightRef} position={[0, 0.4, CAR_LENGTH * 0.53]}>
<boxGeometry args={[CAR_WIDTH * 0.82, 0.07, 0.08]} />
<meshStandardMaterial color="#ef5252" emissive="#ef5252" emissiveIntensity={0.28} />
</mesh>
+ <group ref={thrusterRef} position={[0, 0.38, CAR_LENGTH * 0.58]} visible={false}>
+ {[-CAR_WIDTH * 0.24, CAR_WIDTH * 0.24].map((offsetX, i) => (
+ <mesh key={`flame-${i}`} position={[offsetX, 0, 0]} rotation={[Math.PI / 2, 0, 0]}>
+ <coneGeometry args={[0.14, 0.65, 8]} />
+ <meshBasicMaterial color="#38bdf8" transparent opacity={0.88} blending={THREE.AdditiveBlending} />
+ </mesh>
+ ))}
+ </group>
+
{/* Front lamps and the small roof beacon make the vehicle readable in both views. */}
{[-1, 1].map((side) => (
<mesh key={`lamp-${side}`} position={[side * CAR_WIDTH * 0.3, 0.55, -CAR_LENGTH * 0.53]}>
@@ -131,6 +164,15 @@ export default function PlayerAvatar({ rigRef }) {
))}
</group>
+ <group ref={skidSmokeRef} position={[0, 0.08, WHEEL_Z]} visible={false}>
+ {[-WHEEL_X, WHEEL_X].map((wx, i) => (
+ <mesh key={`smoke-${i}`} position={[wx, 0, 0]}>
+ <sphereGeometry args={[0.22, 6, 6]} />
+ <meshBasicMaterial color="#94a3b8" transparent opacity={0.45} blending={THREE.AdditiveBlending} depthWrite={false} />
+ </mesh>
+ ))}
+ </group>
+
{/* Ground feedback is intentionally simpler than the old robot's large footprint. */}
<mesh ref={underglowRef} rotation={[-Math.PI / 2, 0, 0]} position={[0, 0.025, 0]}>
<circleGeometry args={[0.9, 24]} />
diff --git a/client/src/components/openworld/PlayerController.jsx b/client/src/components/openworld/PlayerController.jsx
index d4aef2d659..d035e3723d 100644
--- a/client/src/components/openworld/PlayerController.jsx
+++ b/client/src/components/openworld/PlayerController.jsx
@@ -11,14 +11,16 @@ import {
} from '../../utils/openWorldPlayerRig';
import { isWalkable, WORLD } from '../../utils/openWorldPlan';
import { BOROUGH_PARAMS, BUILDING_PARAMS, PROCESS_BUILDING_PARAMS } from './openWorldConstants';
-import { regionWarpPadPosition } from '../../utils/openWorldRegions';
+import { regionWarpPadPosition, getRegion } from '../../utils/openWorldRegions';
+import { checkSpeedPadOverlap } from '../../utils/openWorldSpeedPads';
+import { checkShardCollection } from '../../utils/openWorldCollectibles';
+import { detectProximity } from '../../utils/openWorldProximity';
const WALK_SPEED = 10;
const SPRINT_SPEED = 20;
const VERTICAL_SPEED = 8;
const JUMP_SPEED = 10; // initial upward velocity of a Space jump (units/s)
const GRAVITY = -26; // downward acceleration applied through the jump arc (units/s²)
-const PROXIMITY_DISTANCE = 6;
const MAX_CAMERA_HEIGHT = 160;
const BUILDING_FLYOVER_HEIGHT = 12; // above this the player clears rooftops, so skip collision
const AIRBORNE_HEIGHT = EYE_HEIGHT + 0.6; // above this the avatar reads as flying (hover state)
@@ -39,10 +41,8 @@ const _lookTarget = new THREE.Vector3();
// - 'third' (default): a damped follow camera behind a visible low-poly rover with
// arcade vehicle handling, building-aware boom shortening, and speed-weighted steering.
// - 'first' (V to toggle): the classic invisible first-person camera.
-// WASD/arrows, shift boost, E/Q vertical, F interact, R respawn, pointer-lock mouselook,
-// shape-aware building/pylon collision below flyover height, world bounds, and spawn
-// persistence remain available. Ground movement can't enter the bay (the harbor piers stay
-// walkable — see isWalkable in openWorldPlan.js).
+// WASD/arrows, shift boost, E/Q vertical, F interact, R respawn, H horn, pointer-lock mouselook,
+// speed boost pads, cyber shards collection, landmark discovery, and world boundaries.
export default function PlayerController({
keysRef,
positions,
@@ -57,6 +57,12 @@ export default function PlayerController({
warpPads = [],
onWarpPadInteract,
onWarpPadProximity,
+ onProximityChange,
+ easterEggs = [],
+ collectedShardIds = new Set(),
+ onCollectShard,
+ onPlayerPoseChange,
+ playSfx,
mobileInputRef = null,
playerActionRef = null,
}) {
@@ -114,10 +120,18 @@ export default function PlayerController({
() => warpPads.map((region) => ({ region, position: regionWarpPadPosition(region) })).filter((entry) => entry.position),
[warpPads],
);
+ const proximityTargetRef = useRef(null);
+ const lastBoostPadRef = useRef(null);
+ const boostOverrideTimerRef = useRef(0);
+ const localCollectedSetRef = useRef(new Set(collectedShardIds));
+ const poseTickRef = useRef(0);
const lastSpawnRef = useRef(null);
const pointerLockedRef = useRef(false);
- const proximityAppRef = useRef(null);
- const proximityWarpPadRef = useRef(null);
+
+ useEffect(() => {
+ localCollectedSetRef.current = new Set(collectedShardIds);
+ }, [collectedShardIds]);
+
// Damped third-person aim point — lags the true lookAt so the aim stays smooth.
const lookRef = useRef(new THREE.Vector3());
const lookInitRef = useRef(false);
@@ -243,16 +257,24 @@ export default function PlayerController({
};
}, [active, gl.domElement, handleClick, handlePointerLockChange, handleMouseMove]);
- // F interacts with the nearby building; V swaps first/third person; R returns to the
- // current drop-in point. (E is vertical-up in the free-look controls, so neither shadows movement.)
+ // F interacts with the nearby target; V swaps first/third person; H plays horn; R returns to drop-in.
const interact = useCallback(() => {
if (!active) return;
- if (proximityWarpPadRef.current) {
- onWarpPadInteract?.(proximityWarpPadRef.current);
- } else if (proximityAppRef.current) {
- onBuildingClick?.(proximityAppRef.current);
+ const target = proximityTargetRef.current;
+ if (!target) return;
+ if (target.type === 'warpPad') {
+ onWarpPadInteract?.(target.raw);
+ } else if (target.type === 'building') {
+ onBuildingClick?.(target.raw);
+ } else if (target.type === 'landmark') {
+ if (target.regionId) {
+ const region = getRegion(target.regionId);
+ if (region) onWarpPadInteract?.(region);
+ }
+ } else if (target.type === 'easterEgg') {
+ playSfx?.('eggDiscover');
}
- }, [active, onBuildingClick, onWarpPadInteract]);
+ }, [active, onBuildingClick, onWarpPadInteract, playSfx]);
useEffect(() => {
if (!active) return;
@@ -262,6 +284,8 @@ export default function PlayerController({
interact();
} else if (key === 'v') {
onToggleCameraView?.();
+ } else if (key === 'h') {
+ playSfx?.('horn');
} else if (key === 'r' && lastSpawnRef.current) {
rigRef.current.position.copy(lastSpawnRef.current);
rigRef.current.yaw = THIRD_PERSON.isometricYaw;
@@ -278,7 +302,7 @@ export default function PlayerController({
};
window.addEventListener('keydown', handleKeyDown);
return () => window.removeEventListener('keydown', handleKeyDown);
- }, [active, interact, onToggleCameraView]);
+ }, [active, interact, onToggleCameraView, playSfx]);
useEffect(() => {
if (!playerActionRef) return undefined;
@@ -290,11 +314,6 @@ export default function PlayerController({
// In exploration mode, Space is the jump key — capture it before it bubbles to the
// global voice push-to-talk hotkey (VoiceWidget listens for the same key on `window`).
- // A CAPTURE-phase listener runs ahead of that bubble listener, so stopImmediatePropagation
- // suppresses the voice toggle (and the page's default space-scroll). Because that also
- // stops useKeyboardControls' own keydown, we record Space into keysRef here ourselves so
- // the jump still reads it in the frame loop. Skipped while typing so a focused field keeps
- // its spaces (matches VoiceWidget's own guard).
useEffect(() => {
if (!active) return undefined;
const isTypingTarget = (el) => {
@@ -351,8 +370,7 @@ export default function PlayerController({
const moveDir = _moveDir.set(0, 0, 0);
if (isVehicle) {
// Third-person is a rover: left/right steer the nose, while the analog stick's
- // horizontal axis remains the same steering input on touch devices. The camera yaw
- // stays independent so a player can look around while carrying speed.
+ // horizontal axis remains the same steering input on touch devices.
const drive = stepVehicle({
speed: rig.speed,
heading: rig.heading,
@@ -369,8 +387,7 @@ export default function PlayerController({
rig.skid = drive.skid;
moveDir.set(drive.displacement.x, 0, drive.displacement.z);
} else {
- // First person remains the useful free-roam inspection mode: movement stays relative
- // to the mouse aim and keeps the original walk/fly behavior.
+ // First person remains the useful free-roam inspection mode.
const forward = _forward.set(-Math.sin(rig.yaw), 0, -Math.cos(rig.yaw));
const right = _right.set(-forward.z, 0, forward.x);
moveDir
@@ -386,9 +403,7 @@ export default function PlayerController({
// Vertical: E/Q is direct free-fly and takes precedence — it cancels any jump and
// holds altitude when released (no gravity). Gravity applies ONLY during an active
- // Space jump arc (rig.jumping), so releasing E mid-air keeps the free-fly hover intact
- // instead of dropping the player. A jump launches only from the ground; the arc
- // integrates rig.vy until the landing/ceiling clamp below clears rig.jumping.
+ // Space jump arc.
const flyDir = (keys.has('e') ? 1 : 0) - (keys.has('q') ? 1 : 0);
const grounded = rig.position.y <= EYE_HEIGHT + 1e-3;
let dy = 0;
@@ -397,7 +412,11 @@ export default function PlayerController({
rig.vy = 0;
dy = flyDir * verticalSpeed;
} else {
- if ((keys.has(' ') || mobileInput?.jump) && grounded && !rig.jumping) { rig.vy = JUMP_SPEED; rig.jumping = true; } // launch
+ if ((keys.has(' ') || mobileInput?.jump) && grounded && !rig.jumping) {
+ rig.vy = JUMP_SPEED;
+ rig.jumping = true;
+ playSfx?.('jump');
+ }
if (rig.jumping) {
rig.vy += GRAVITY * delta; // gravity through the arc
dy = rig.vy * delta;
@@ -413,8 +432,7 @@ export default function PlayerController({
nextPos.y += dy;
// Collision detection is skipped above rooftop height so the player can fly over
- // the city. The resolver stops at the actual facade/pylon contact and preserves
- // the free axis for a stable wall slide.
+ // the city.
let blocked = false;
if (hasHorizontal && nextPos.y < BUILDING_FLYOVER_HEIGHT) {
const collision = moveWithCollisions({
@@ -428,22 +446,13 @@ export default function PlayerController({
nextPos.x = collision.x;
nextPos.z = collision.z;
blocked = collision.blocked;
- // The bay is not walkable (the harbor piers are) — a grounded player stops
- // at the shoreline instead of strolling onto open water.
if (!isWalkable(nextPos.x, nextPos.z)) {
blocked = true;
- // Water is a hard terrain boundary rather than a wall: undo the whole
- // attempted move so the player cannot slide diagonally onto the bay.
nextPos.x = rig.position.x;
nextPos.z = rig.position.z;
}
}
- // Vertical (jump/gravity) is independent of horizontal collision: a wall only
- // stops horizontal progress, never the jump arc. The resolver has already placed
- // the player at the contact point (and kept any tangent slide); terrain boundaries
- // were reset above. In either case the hop still rises, falls, and lands rather
- // than freezing mid-air while vy keeps integrating downward.
if (blocked) {
if (isVehicle) rig.speed = 0;
}
@@ -451,9 +460,12 @@ export default function PlayerController({
nextPos.x = Math.max(-WORLD.bound, Math.min(WORLD.bound, nextPos.x));
nextPos.y = Math.max(EYE_HEIGHT, Math.min(MAX_CAMERA_HEIGHT, nextPos.y));
nextPos.z = Math.max(-WORLD.bound, Math.min(WORLD.bound, nextPos.z));
- // Landed (or hit the ceiling): end the jump arc so gravity stops and Space can
- // launch again (and so releasing E above ground doesn't inherit a stale arc).
+
+ // Landed
if (nextPos.y <= EYE_HEIGHT + 1e-3 || nextPos.y >= MAX_CAMERA_HEIGHT) {
+ if (rig.jumping && nextPos.y <= EYE_HEIGHT + 1e-3) {
+ playSfx?.('land');
+ }
rig.vy = 0;
rig.jumping = false;
}
@@ -461,6 +473,33 @@ export default function PlayerController({
rig.position.copy(nextPos);
}
+ // Speed boost pads detection and duration handling
+ const activeBoostPad = checkSpeedPadOverlap(rig.position);
+ if (activeBoostPad && lastBoostPadRef.current !== activeBoostPad.id) {
+ lastBoostPadRef.current = activeBoostPad.id;
+ boostOverrideTimerRef.current = 1.4;
+ if (isVehicle) {
+ rig.speed = Math.max(rig.speed, activeBoostPad.boostSpeed);
+ }
+ playSfx?.('boostPad');
+ } else if (!activeBoostPad) {
+ lastBoostPadRef.current = null;
+ }
+
+ if (boostOverrideTimerRef.current > 0) {
+ boostOverrideTimerRef.current -= delta;
+ }
+
+ // Cyber Shards collectible detection
+ const collectedShards = checkShardCollection(rig.position, undefined, localCollectedSetRef.current);
+ if (collectedShards.length > 0) {
+ collectedShards.forEach((shard) => {
+ localCollectedSetRef.current.add(shard.id);
+ onCollectShard?.(shard);
+ playSfx?.('collect');
+ });
+ }
+
// Pose classification for the avatar + facing/banking toward movement.
const moving = movedHorizontally || dy !== 0;
rig.state = avatarState({
@@ -474,8 +513,6 @@ export default function PlayerController({
const headingStep = delta > 0 ? (dampAngle(previousHeading, rig.heading, 1) - previousHeading) / delta : 0;
const turnBank = bankAngle(headingStep, 0.24, 0.045) + rig.wheelAngle * rig.skid * 0.08;
rig.bank += (turnBank - rig.bank) * dampFactor(8, delta);
- // Keep the facing value live even while coasting to a stop; the visual rover should
- // settle into the same heading as the steering math rather than snap at zero speed.
if (!movedHorizontally && Math.abs(prevFacing - rig.heading) < 0.001) rig.facing = rig.heading;
} else if (movedHorizontally) {
const target = moveFacing(rig.yaw, { forward: forwardInput, strafe: strafeInput });
@@ -487,46 +524,42 @@ export default function PlayerController({
rig.bank += (0 - rig.bank) * dampFactor(6, delta);
}
- // Building proximity detection
- let nearestApp = null;
- let nearestDist = PROXIMITY_DISTANCE;
- positions?.forEach((pos, appId) => {
- const dx = rig.position.x - pos.x;
- const dy = rig.position.y - ((pos.height ?? 4) * 0.5);
- const dz = rig.position.z - pos.z;
- const dist = Math.sqrt(dx * dx + dy * dy + dz * dz);
- if (dist < nearestDist) {
- nearestDist = dist;
- const app = apps?.find(a => a.id === appId);
- if (app) nearestApp = app;
- }
+ const proxTarget = detectProximity({
+ playerPos: rig.position,
+ apps,
+ positions,
+ warpPads: warpPadList,
+ easterEggs,
});
- if (nearestApp !== proximityAppRef.current) {
- proximityAppRef.current = nearestApp;
- onBuildingProximity?.(nearestApp);
+ if (proxTarget?.id !== proximityTargetRef.current?.id || proxTarget?.type !== proximityTargetRef.current?.type) {
+ proximityTargetRef.current = proxTarget;
+ onBuildingProximity?.(proxTarget?.type === 'building' ? proxTarget.raw : null);
+ onWarpPadProximity?.(proxTarget?.type === 'warpPad' ? proxTarget.raw : null);
+ onProximityChange?.(proxTarget);
}
- let nearestWarpPad = null;
- let nearestWarpDistance = 3.6;
- for (const { region, position } of warpPadList) {
- const [x, y, z] = position;
- const dx = rig.position.x - x;
- const dy = rig.position.y - y;
- const dz = rig.position.z - z;
- const distance = Math.sqrt(dx * dx + dy * dy + dz * dz);
- if (distance < nearestWarpDistance) {
- nearestWarpDistance = distance;
- nearestWarpPad = region;
- }
- }
- if (nearestWarpPad !== proximityWarpPadRef.current) {
- proximityWarpPadRef.current = nearestWarpPad;
- onWarpPadProximity?.(nearestWarpPad);
+ const reportingSpeed = isVehicle
+ ? rig.speed
+ : (hasHorizontal ? (isSprinting ? SPRINT_SPEED : WALK_SPEED) * (forwardInput < 0 ? -1 : 1) : 0);
+
+ poseTickRef.current = (poseTickRef.current || 0) + 1;
+ if (poseTickRef.current % 3 === 0) {
+ onPlayerPoseChange?.({
+ x: rig.position.x,
+ y: rig.position.y,
+ z: rig.position.z,
+ heading: rig.heading,
+ speed: reportingSpeed,
+ skid: rig.skid,
+ state: rig.state,
+ jumping: rig.jumping,
+ airborne: rig.position.y > AIRBORNE_HEIGHT,
+ boosting: isSprinting,
+ });
}
- // Camera application. While CameraTransition flies the camera (exploration toggle),
- // it is the sole camera writer — explicit gate instead of relying on mount order.
+ // Camera application
if (transitioning) return;
if (cameraView === 'first') {
@@ -540,8 +573,7 @@ export default function PlayerController({
return;
}
- // Third person: boom behind the camera yaw, shortened when it would clip a building,
- // damped so the camera glides while the aim stays tight.
+ // Third person: boom behind camera yaw
const desired = thirdPersonCamera({
pos: rig.position,
yaw: rig.yaw,
@@ -552,8 +584,6 @@ export default function PlayerController({
const { point: resolvedCam } = resolveBoom({ anchor, camera: desired.camera, buildings: buildingList });
if (!lookInitRef.current) {
- // First third-person frame (mode entry): aim snaps so the camera doesn't swing
- // through the scene; position still eases in from wherever the camera was.
lookRef.current.set(desired.lookAt.x, desired.lookAt.y, desired.lookAt.z);
lookInitRef.current = true;
}
@@ -566,9 +596,6 @@ export default function PlayerController({
if (!active) return null;
- // The visible vehicle exists only in third person — first person stays the classic
- // invisible camera (and can't self-clip). The procedural actor is still wrapped by the
- // existing boundaries so the scene keeps its defensive mount contract.
if (cameraView !== 'third') return null;
return (
<ErrorBoundary fallback={null}>
diff --git a/client/src/components/openworld/audio/openWorldSoundEffects.js b/client/src/components/openworld/audio/openWorldSoundEffects.js
index 40272bce89..63d06378a4 100644
--- a/client/src/components/openworld/audio/openWorldSoundEffects.js
+++ b/client/src/components/openworld/audio/openWorldSoundEffects.js
@@ -142,6 +142,144 @@ const playTaskComplete = (ctx, output) => {
});
};
+// Horn: dual-tone retro-futuristic synth horn
+const playHorn = (ctx, output) => {
+ const now = ctx.currentTime;
+ const freqs = [440, 554.37]; // A4 + C#5 major third interval
+ freqs.forEach((freq) => {
+ const osc = ctx.createOscillator();
+ osc.type = 'sawtooth';
+ osc.frequency.setValueAtTime(freq, now);
+ const filter = ctx.createBiquadFilter();
+ filter.type = 'lowpass';
+ filter.frequency.setValueAtTime(1400, now);
+ const gain = ctx.createGain();
+ gain.gain.setValueAtTime(0.001, now);
+ gain.gain.exponentialRampToValueAtTime(0.14, now + 0.02);
+ gain.gain.setValueAtTime(0.12, now + 0.22);
+ gain.gain.exponentialRampToValueAtTime(0.001, now + 0.35);
+ osc.connect(filter);
+ filter.connect(gain);
+ gain.connect(output);
+ osc.start(now);
+ osc.stop(now + 0.38);
+ });
+};
+
+// Boost: high-energy rising whoosh + resonance sweep
+const playBoost = (ctx, output) => {
+ const now = ctx.currentTime;
+ const noise = ctx.createBufferSource();
+ noise.buffer = createNoiseBuffer(ctx, 0.45);
+ const filter = ctx.createBiquadFilter();
+ filter.type = 'bandpass';
+ filter.Q.value = 3;
+ filter.frequency.setValueAtTime(300, now);
+ filter.frequency.exponentialRampToValueAtTime(1800, now + 0.4);
+ const gain = ctx.createGain();
+ gain.gain.setValueAtTime(0.001, now);
+ gain.gain.exponentialRampToValueAtTime(0.15, now + 0.04);
+ gain.gain.exponentialRampToValueAtTime(0.001, now + 0.45);
+ noise.connect(filter);
+ filter.connect(gain);
+ gain.connect(output);
+ noise.start(now);
+};
+
+// Boost pad: turbo charged surge
+const playBoostPad = (ctx, output) => {
+ const now = ctx.currentTime;
+ const osc = ctx.createOscillator();
+ osc.type = 'sawtooth';
+ osc.frequency.setValueAtTime(220, now);
+ osc.frequency.exponentialRampToValueAtTime(880, now + 0.25);
+ const filter = ctx.createBiquadFilter();
+ filter.type = 'lowpass';
+ filter.frequency.setValueAtTime(600, now);
+ filter.frequency.exponentialRampToValueAtTime(3200, now + 0.25);
+ const gain = ctx.createGain();
+ gain.gain.setValueAtTime(0.001, now);
+ gain.gain.exponentialRampToValueAtTime(0.2, now + 0.03);
+ gain.gain.exponentialRampToValueAtTime(0.001, now + 0.3);
+ osc.connect(filter);
+ filter.connect(gain);
+ gain.connect(output);
+ osc.start(now);
+ osc.stop(now + 0.32);
+};
+
+// Jump: springy upward chirp
+const playJump = (ctx, output) => {
+ const now = ctx.currentTime;
+ const osc = ctx.createOscillator();
+ osc.type = 'sine';
+ osc.frequency.setValueAtTime(260, now);
+ osc.frequency.exponentialRampToValueAtTime(620, now + 0.12);
+ const gain = ctx.createGain();
+ gain.gain.setValueAtTime(0.15, now);
+ gain.gain.exponentialRampToValueAtTime(0.001, now + 0.16);
+ osc.connect(gain);
+ gain.connect(output);
+ osc.start(now);
+ osc.stop(now + 0.18);
+};
+
+// Land: solid low-end damping thud
+const playLand = (ctx, output) => {
+ const now = ctx.currentTime;
+ const osc = ctx.createOscillator();
+ osc.type = 'sine';
+ osc.frequency.setValueAtTime(110, now);
+ osc.frequency.exponentialRampToValueAtTime(40, now + 0.14);
+ const gain = ctx.createGain();
+ gain.gain.setValueAtTime(0.22, now);
+ gain.gain.exponentialRampToValueAtTime(0.001, now + 0.15);
+ osc.connect(gain);
+ gain.connect(output);
+ osc.start(now);
+ osc.stop(now + 0.18);
+};
+
+// Collectible shard: sparkling 4-note ascending crystalline arpeggio
+const playCollect = (ctx, output) => {
+ const now = ctx.currentTime;
+ const notes = [1046.5, 1318.51, 1567.98, 2093.0]; // C6, E6, G6, C7
+ notes.forEach((freq, i) => {
+ const t = now + i * 0.055;
+ const osc = ctx.createOscillator();
+ osc.type = 'sine';
+ osc.frequency.value = freq;
+ const gain = ctx.createGain();
+ gain.gain.setValueAtTime(0.001, t);
+ gain.gain.exponentialRampToValueAtTime(0.16, t + 0.01);
+ gain.gain.exponentialRampToValueAtTime(0.001, t + 0.38);
+ osc.connect(gain);
+ gain.connect(output);
+ osc.start(t);
+ osc.stop(t + 0.4);
+ });
+};
+
+// Easter egg discovery: shimmering mystical chord
+const playEggDiscover = (ctx, output) => {
+ const now = ctx.currentTime;
+ const freqs = [739.99, 932.33, 1108.73, 1396.91]; // F#5, A#5, C#6, F6 (Major 7th sparkle)
+ freqs.forEach((freq, i) => {
+ const t = now + i * 0.04;
+ const osc = ctx.createOscillator();
+ osc.type = 'triangle';
+ osc.frequency.value = freq;
+ const gain = ctx.createGain();
+ gain.gain.setValueAtTime(0.001, t);
+ gain.gain.exponentialRampToValueAtTime(0.12, t + 0.08);
+ gain.gain.exponentialRampToValueAtTime(0.001, t + 0.7);
+ osc.connect(gain);
+ gain.connect(output);
+ osc.start(t);
+ osc.stop(t + 0.75);
+ });
+};
+
const SFX_MAP = {
buildingHover: playBuildingHover,
buildingClick: playBuildingClick,
@@ -149,6 +287,13 @@ const SFX_MAP = {
shootingStar: playShootingStar,
dataPulse: playDataPulse,
taskComplete: playTaskComplete,
+ horn: playHorn,
+ boost: playBoost,
+ boostPad: playBoostPad,
+ jump: playJump,
+ land: playLand,
+ collect: playCollect,
+ eggDiscover: playEggDiscover,
};
export const playSfx = (name) => {
diff --git a/client/src/pages/OpenWorld.jsx b/client/src/pages/OpenWorld.jsx
index 3cb7e1f18d..c7b72c3fa9 100644
--- a/client/src/pages/OpenWorld.jsx
+++ b/client/src/pages/OpenWorld.jsx
@@ -23,6 +23,7 @@ import { computeSoundscape } from '../utils/openWorldSoundscape';
import { deriveOpenWorldPalette, getTimeOfDayPreset, resolveOpenWorldTimeOfDay, resolveWorldStyle } from '../components/openworld/openWorldConstants';
import OpenWorldFastTravel from '../components/openworld/OpenWorldFastTravel';
import { getRegion, regionArrivalPoint, regionPath } from '../utils/openWorldRegions';
+import { loadCollectedShardIds, saveCollectedShardIds, TOTAL_SHARDS } from '../utils/openWorldCollectibles';
import { OpenWorldPaletteProvider } from '../components/openworld/OpenWorldPaletteContext';
import { useThemeContext } from '../components/ThemeContext';
@@ -188,6 +189,28 @@ function OpenWorldInner() {
const playerActionRef = useRef(null);
const [proximityTarget, setProximityTarget] = useState(null);
+ // Cyber Shards collectible state + live player pose
+ const [collectedShardIds, setCollectedShardIds] = useState(() => loadCollectedShardIds());
+ const [activeBursts, setActiveBursts] = useState([]);
+ const [playerPose, setPlayerPose] = useState(null);
+
+ const handleCollectShard = useCallback((shard) => {
+ setCollectedShardIds((prev) => {
+ const next = new Set(prev);
+ next.add(shard.id);
+ saveCollectedShardIds(next);
+ return next;
+ });
+ const burstId = `${shard.id}-${Date.now()}`;
+ setActiveBursts((prev) => [
+ ...prev.slice(-4),
+ { id: burstId, x: shard.x, y: shard.y, z: shard.z, color: shard.color, age: 0 },
+ ]);
+ setTimeout(() => {
+ setActiveBursts((prev) => prev.filter((b) => b.id !== burstId));
+ }, 850);
+ }, []);
+
// --- World map / fast travel ----------------------------------------------
// Warping stays under `/openworld/region/:regionId`; the route param drives the orbital
// camera and, on foot, the player rig. The destination is still shareable, but it never
@@ -553,6 +576,10 @@ function OpenWorldInner() {
hudSafe={focusHudSafe}
onTravelToRegion={handleTravelToRegion}
onProximityChange={setProximityTarget}
+ collectedShardIds={collectedShardIds}
+ onCollectShard={handleCollectShard}
+ activeBursts={activeBursts}
+ onPlayerPoseChange={setPlayerPose}
/>
{/* The full HUD hides in photo + playback mode so the view is clean; each
mode's overlay replaces it. */}
@@ -590,6 +617,9 @@ function OpenWorldInner() {
onAttentionItem={handleAttentionItem}
activeRegion={focusedRegion}
proximityTarget={proximityTarget}
+ playerPose={playerPose}
+ collectedCount={collectedShardIds.size}
+ totalShards={TOTAL_SHARDS}
/>
)}
{!photoMode && !playback.active && !isDesktop && settings?.explorationMode && !showSettings && !fastTravelOpen && (
diff --git a/client/src/utils/README.md b/client/src/utils/README.md
index f9b3e68dab..3ff32c6a69 100644
--- a/client/src/utils/README.md
+++ b/client/src/utils/README.md
@@ -77,6 +77,7 @@ its tunable constants and placement helpers.
| `openWorldArtifacts` | Earned-artifact milestones (level/goal/streak) → placed artifact descriptors (`computeArtifacts`). |
| `openWorldBackupVault` | Backup-vault health/alerting state and color (`computeBackupVault`, `vaultHealth`). |
| `openWorldChronotype` | Chronotype energy curve by hour → brightness/tempo modifiers (`computeChronotypeEnergy`). |
+| `openWorldCollectibles` | Deterministic Cyber Shards collectible placement, collection overlap math, and progress tracking (`getCollectiblesList`, `checkShardCollection`, `getCollectionStats`, `CYBER_SHARDS`). |
| `openWorldDataHarbor` | Data Harbor pier district: DB table silos + data/ domain racks from /api/openworld/introspection (`computeDataHarbor`). |
| `openWorldDistrictLayout` | Shared district layout math: auto-columns, grid placement, tallying, metric→height scaling. |
| `openWorldEasterEggs` | Unlockable easter eggs from context (date/character/goals) → placements (`computeEasterEggs`). |
@@ -93,12 +94,14 @@ its tunable constants and placement helpers.
| `openWorldMiniMap` | Mini-map projection of building positions into 2D bounds, plus opt-in waterfront geography (bay/shoreline/harbor) read from `openWorldPlan` (`computeMiniMap`, `projectPoint`, `geographyWorldPoints`, `projectGeography`). |
| `openWorldPhotoMode` | Photo-mode camera presets, the demand-loop fly stepper, postcard stats, and screenshot filename (`getPreset`, `cyclePreset`, `stepFly`). |
| `openWorldPlan` | Master town plan: district parcels, shoreline/bay, plaza, transit loop, street network (`PARCELS`, `WORLD`, `computeStreets`, `computeStreetProps`, `isInWater`). |
+| `openWorldProximity` | Unified player proximity detection across warp pads, buildings, easter eggs, and district landmarks (`detectProximity`, `getResolvedLandmarks`, `WORLD_LANDMARKS`). |
| `openWorldRegions` | OpenWorld fast-travel registry: named regions over the `openWorldPlan` parcels, each mapped to the PortOS page it visualizes (`OPEN_WORLD_REGIONS`, `getRegion`, `listRegions`, `searchRegions`, `regionArrivalPoint`, `regionPath`). |
| `openWorldPlayerRig` | Exploration player-rig math: third-person follow camera, boom collision, damping, facing, avatar state (`thirdPersonCamera`, `resolveBoom`, `dampAngle`, `moveFacing`, `avatarState`). |
| `openWorldRenderBudget` | Pure Auto-quality render-budget state machine: p75 frame-time windows, hysteresis, cooldown, warm-up/gap rejection (`createRenderBudget`, `recordFrame`, `restartWarmup`, `resetRenderBudget`, `getEffectiveTier`, `QUALITY_TIERS`, `DEFAULT_RENDER_BUDGET_CONFIG`). |
| `openWorldRooftops` | Deterministic rooftop fixture kits (antenna/tank/AC/dish) per app name (`computeRooftopKit`). |
| `openWorldProductivity` | Productivity monument from streak/velocity tiers (`computeProductivityMonument`). |
| `openWorldSoundscape` | Ambient soundscape: mood/energy classification, chord selection (`computeSoundscape`), and the manual mood override (`applyMoodOverride`). |
+| `openWorldSpeedPads` | Luminous road speed boost pads placement and geometric local-coordinate overlap detection (`getSpeedPadsList`, `checkSpeedPadOverlap`, `SPEED_PADS`). |
| `openWorldTaskFlowRiver` | Task-flow river width/speed from backlog & throughput (`computeTaskFlowRiver`). |
| `openWorldTaskQueue` | Task-queue state/color from status counts (`computeTaskQueue`). |
| `openWorldTimeline` | Activity-log density bins and timeline buckets (`computeActivityDensity`, `buildTimelineBuckets`). |
diff --git a/client/src/utils/index.js b/client/src/utils/index.js
index d5480c3413..06a893cc0c 100644
--- a/client/src/utils/index.js
+++ b/client/src/utils/index.js
@@ -67,6 +67,9 @@ export * from './openWorldRenderBudget.js';
export * from './openWorldRooftops.js';
export * from './openWorldProductivity.js';
export * from './openWorldSoundscape.js';
+export * from './openWorldCollectibles.js';
+export * from './openWorldProximity.js';
+export * from './openWorldSpeedPads.js';
export * from './openWorldTaskFlowRiver.js';
export * from './openWorldTaskQueue.js';
export * from './openWorldTimeline.js';
diff --git a/client/src/utils/openWorldCollectibles.js b/client/src/utils/openWorldCollectibles.js
new file mode 100644
index 0000000000..00487ee8e5
--- /dev/null
+++ b/client/src/utils/openWorldCollectibles.js
@@ -0,0 +1,111 @@
+// Pure deterministic helpers for OpenWorld's collectible Cyber Shards system.
+// Shards are floating, glowing crystal pickups scattered along roads, plazas, and
+// landmarks. Driving or walking over a shard collects it with particle + audio feedback,
+// increments the session score, and unlocks discovery recognition.
+// No three.js / React imports — pure, testable in node.
+
+import { WORLD } from './openWorldPlan';
+
+export const SHARD_COLLECTION_RADIUS = 2.4;
+export const DEFAULT_SHARD_Y = 1.0;
+
+// Curated deterministic list of collectible Cyber Shards across all major quarters.
+export const CYBER_SHARDS = [
+ // Plaza & Central Spine
+ { id: 'shard-plaza-n', label: 'Plaza Zenith', x: 0, y: DEFAULT_SHARD_Y, z: -12, color: '#06b6d4', value: 10 },
+ { id: 'shard-plaza-s', label: 'Plaza Gateway', x: 0, y: DEFAULT_SHARD_Y, z: 14, color: '#06b6d4', value: 10 },
+ { id: 'shard-plaza-e', label: 'Plaza East Wing', x: 13, y: DEFAULT_SHARD_Y, z: 0, color: '#06b6d4', value: 10 },
+ { id: 'shard-plaza-w', label: 'Plaza West Wing', x: -13, y: DEFAULT_SHARD_Y, z: 0, color: '#06b6d4', value: 10 },
+
+ // Harbor Avenue (Northbound)
+ { id: 'shard-avenue-mid', label: 'Avenue Walk', x: 0, y: DEFAULT_SHARD_Y, z: -28, color: '#38bdf8', value: 15 },
+ { id: 'shard-avenue-shore', label: 'Shoreline Overlook', x: 0, y: DEFAULT_SHARD_Y, z: WORLD.shorelineZ + 2, color: '#38bdf8', value: 15 },
+ { id: 'shard-harbor-pier', label: 'Harbor Pier Head', x: 0, y: DEFAULT_SHARD_Y, z: -68, color: '#0ea5e9', value: 25 },
+
+ // Western Districts (Memory, Backup, Jira, Productivity)
+ { id: 'shard-memory-steps', label: 'Memory Crystal Shard', x: -38, y: DEFAULT_SHARD_Y, z: -24, color: '#a855f7', value: 20 },
+ { id: 'shard-backup-vault', label: 'Vault Crypt Cache', x: -30, y: DEFAULT_SHARD_Y, z: -8, color: '#f59e0b', value: 20 },
+ { id: 'shard-jira-yard', label: 'Sprint Yard Crate', x: -16, y: DEFAULT_SHARD_Y, z: -38, color: '#ec4899', value: 20 },
+ { id: 'shard-productivity', label: 'Focus Terrace Spark', x: -44, y: DEFAULT_SHARD_Y, z: 24, color: '#22c55e', value: 20 },
+ { id: 'shard-quiet-corner', label: 'Secret Shard', x: -44, y: DEFAULT_SHARD_Y, z: 38, color: '#e879f9', value: 30 },
+
+ // Eastern Districts (Task Queue, Health, Goals, Artifacts)
+ { id: 'shard-task-queue', label: 'Queue Stream Shard', x: 30, y: DEFAULT_SHARD_Y, z: -8, color: '#f97316', value: 20 },
+ { id: 'shard-health-tower', label: 'Wellness Pulse', x: 44, y: DEFAULT_SHARD_Y, z: 24, color: '#10b981', value: 20 },
+ { id: 'shard-goal-monuments', label: 'Goal Milestone Shard', x: 26, y: DEFAULT_SHARD_Y, z: -36, color: '#eab308', value: 25 },
+ { id: 'shard-artifacts-hall', label: 'Hall of Trophies Shard', x: 40, y: DEFAULT_SHARD_Y, z: -24, color: '#facc15', value: 25 },
+
+ // Downtown Ring Road Corners
+ { id: 'shard-ring-ne', label: 'Boulevard North-East', x: 21, y: DEFAULT_SHARD_Y, z: -21, color: '#06b6d4', value: 15 },
+ { id: 'shard-ring-sw', label: 'Boulevard South-West', x: -21, y: DEFAULT_SHARD_Y, z: 21, color: '#06b6d4', value: 15 },
+];
+
+export const TOTAL_SHARDS = CYBER_SHARDS.length;
+
+// Return all shards with placement metadata and individual animation phase offsets.
+export function getCollectiblesList() {
+ return CYBER_SHARDS.map((shard, index) => ({
+ ...shard,
+ pulsePhase: (index * 0.13) % 1,
+ }));
+}
+
+// Check which uncollected shards are within range of the player position.
+// Returns array of newly collected shard objects.
+export function checkShardCollection(playerPos, shards = CYBER_SHARDS, collectedSet = new Set(), radius = SHARD_COLLECTION_RADIUS) {
+ if (!playerPos || typeof playerPos.x !== 'number' || typeof playerPos.z !== 'number') {
+ return [];
+ }
+ const rSq = radius * radius;
+ const newlyCollected = [];
+
+ for (const shard of shards) {
+ if (!shard || collectedSet.has(shard.id)) continue;
+ const dx = playerPos.x - shard.x;
+ const dz = playerPos.z - shard.z;
+ const distSq = dx * dx + dz * dz;
+ if (distSq <= rSq) {
+ newlyCollected.push(shard);
+ }
+ }
+
+ return newlyCollected;
+}
+
+// Compute progress summary from collected set
+export function getCollectionStats(collectedSet = new Set(), totalCount = TOTAL_SHARDS) {
+ const count = collectedSet instanceof Set ? collectedSet.size : Array.isArray(collectedSet) ? collectedSet.length : 0;
+ const clampedCount = Math.min(totalCount, Math.max(0, count));
+ const percentage = totalCount > 0 ? Math.round((clampedCount / totalCount) * 100) : 0;
+ return {
+ collectedCount: clampedCount,
+ totalCount,
+ percentage,
+ allCollected: clampedCount >= totalCount && totalCount > 0,
+ };
+}
+
+// Session storage persistence helpers
+const STORAGE_KEY = 'openworld.shards';
+
+export function loadCollectedShardIds() {
+ try {
+ if (typeof sessionStorage === 'undefined') return new Set();
+ const raw = sessionStorage.getItem(STORAGE_KEY);
+ if (!raw) return new Set();
+ const parsed = JSON.parse(raw);
+ return Array.isArray(parsed) ? new Set(parsed) : new Set();
+ } catch {
+ return new Set();
+ }
+}
+
+export function saveCollectedShardIds(set) {
+ try {
+ if (typeof sessionStorage === 'undefined') return;
+ const list = Array.from(set || []);
+ sessionStorage.setItem(STORAGE_KEY, JSON.stringify(list));
+ } catch {
+ // Swallow storage exceptions safely
+ }
+}
diff --git a/client/src/utils/openWorldCollectibles.test.js b/client/src/utils/openWorldCollectibles.test.js
new file mode 100644
index 0000000000..e6139dd201
--- /dev/null
+++ b/client/src/utils/openWorldCollectibles.test.js
@@ -0,0 +1,86 @@
+import { describe, it, expect } from 'vitest';
+import {
+ CYBER_SHARDS,
+ TOTAL_SHARDS,
+ getCollectiblesList,
+ checkShardCollection,
+ getCollectionStats,
+ SHARD_COLLECTION_RADIUS,
+} from './openWorldCollectibles';
+
+describe('openWorldCollectibles', () => {
+ it('defines a non-empty array of valid collectible shards with unique ids', () => {
+ expect(CYBER_SHARDS.length).toBeGreaterThanOrEqual(10);
+ expect(TOTAL_SHARDS).toBe(CYBER_SHARDS.length);
+
+ const ids = new Set();
+ CYBER_SHARDS.forEach((shard) => {
+ expect(typeof shard.id).toBe('string');
+ expect(typeof shard.label).toBe('string');
+ expect(typeof shard.x).toBe('number');
+ expect(typeof shard.y).toBe('number');
+ expect(typeof shard.z).toBe('number');
+ expect(typeof shard.color).toBe('string');
+ expect(typeof shard.value).toBe('number');
+ expect(ids.has(shard.id)).toBe(false);
+ ids.add(shard.id);
+ });
+ });
+
+ it('getCollectiblesList returns copies with pulse phases', () => {
+ const list = getCollectiblesList();
+ expect(list.length).toBe(CYBER_SHARDS.length);
+ list.forEach((s) => {
+ expect(s.pulsePhase).toBeGreaterThanOrEqual(0);
+ expect(s.pulsePhase).toBeLessThanOrEqual(1);
+ });
+ });
+
+ it('checkShardCollection detects uncollected shards within radius', () => {
+ const shard = CYBER_SHARDS[0];
+ const playerPos = { x: shard.x + 0.5, z: shard.z + 0.5 };
+ const collectedSet = new Set();
+
+ const result = checkShardCollection(playerPos, CYBER_SHARDS, collectedSet, SHARD_COLLECTION_RADIUS);
+ expect(result.some((s) => s.id === shard.id)).toBe(true);
+
+ // If already in collectedSet, does not return again
+ collectedSet.add(shard.id);
+ const resultAfter = checkShardCollection(playerPos, CYBER_SHARDS, collectedSet, SHARD_COLLECTION_RADIUS);
+ expect(resultAfter.some((s) => s.id === shard.id)).toBe(false);
+ });
+
+ it('checkShardCollection ignores far player positions or invalid inputs', () => {
+ expect(checkShardCollection(null)).toEqual([]);
+ expect(checkShardCollection({ x: 'invalid', z: 0 })).toEqual([]);
+ expect(checkShardCollection({ x: 9999, z: 9999 }, CYBER_SHARDS, new Set())).toEqual([]);
+ });
+
+ it('getCollectionStats calculates accurate percentages and completion flags', () => {
+ const emptyStats = getCollectionStats(new Set(), 10);
+ expect(emptyStats).toEqual({
+ collectedCount: 0,
+ totalCount: 10,
+ percentage: 0,
+ allCollected: false,
+ });
+
+ const halfSet = new Set(['s1', 's2', 's3', 's4', 's5']);
+ const halfStats = getCollectionStats(halfSet, 10);
+ expect(halfStats).toEqual({
+ collectedCount: 5,
+ totalCount: 10,
+ percentage: 50,
+ allCollected: false,
+ });
+
+ const fullSet = new Set(['s1', 's2', 's3', 's4']);
+ const fullStats = getCollectionStats(fullSet, 4);
+ expect(fullStats).toEqual({
+ collectedCount: 4,
+ totalCount: 4,
+ percentage: 100,
+ allCollected: true,
+ });
+ });
+});
diff --git a/client/src/utils/openWorldMiniMap.js b/client/src/utils/openWorldMiniMap.js
index 0b825489b4..0114b01872 100644
--- a/client/src/utils/openWorldMiniMap.js
+++ b/client/src/utils/openWorldMiniMap.js
@@ -140,6 +140,49 @@ export function projectGeography(bounds, padding = MINI_MAP_PADDING) {
};
}
+// Project the live player pose (position + heading) into normalized mini-map coordinates.
+// Returns null when bounds or player position are absent/invalid.
+export function projectPlayer(playerPos, heading = 0, bounds = null, padding = MINI_MAP_PADDING) {
+ if (!playerPos || typeof playerPos.x !== 'number' || typeof playerPos.z !== 'number' || !bounds) {
+ return null;
+ }
+ const { nx, ny } = projectPoint({ x: playerPos.x, z: playerPos.z }, bounds, padding);
+ // Three.js / rover heading increases counter-clockwise (0 faces north / -Z; -π/2 faces east / +X).
+ // CSS rotation is clockwise in screen space, so we negate the angle to align the blip's pointer.
+ const rotationDeg = -(heading * 180) / Math.PI;
+ return { nx, ny, rotationDeg };
+}
+
+// Project major district landmarks onto the mini-map
+const MAP_LANDMARKS = [
+ { id: 'ai-core', parcel: 'aiCore', label: 'AI Core', color: '#06b6d4' },
+ { id: 'backup-vault', parcel: 'backupVault', label: 'Vault', color: '#f59e0b' },
+ { id: 'task-queue', parcel: 'taskQueue', label: 'Queue', color: '#f97316' },
+ { id: 'wellness', parcel: 'health', label: 'Health', color: '#10b981' },
+ { id: 'memory', parcel: 'memory', label: 'Memory', color: '#a855f7' },
+ { id: 'goals', parcel: 'goals', label: 'Goals', color: '#eab308' },
+ { id: 'artifacts', parcel: 'artifacts', label: 'Artifacts', color: '#facc15' },
+ { id: 'productivity', parcel: 'productivity', label: 'Productivity', color: '#22c55e' },
+];
+
+export function projectLandmarks(bounds, padding = MINI_MAP_PADDING) {
+ if (!bounds) return [];
+ const results = [];
+ for (const lm of MAP_LANDMARKS) {
+ const parcel = PARCELS[lm.parcel];
+ if (!parcel) continue;
+ const { nx, ny } = projectPoint({ x: parcel.anchor[0], z: parcel.anchor[2] }, bounds, padding);
+ results.push({
+ id: lm.id,
+ label: lm.label,
+ color: lm.color,
+ nx,
+ ny,
+ });
+ }
+ return results;
+}
+
// Full derived view-model for the mini-map component. Takes the layout `positions` Map (the
// return value of `computeOpenWorldLayout(apps)`, keyed by app id) plus the `apps` array (for
// status/name/archived metadata), and produces a flat list of plotted dots with normalized
@@ -153,6 +196,7 @@ export function projectGeography(bounds, padding = MINI_MAP_PADDING) {
export function computeMiniMap(apps, positions, opts = {}) {
const padding = opts.padding ?? MINI_MAP_PADDING;
const includeGeography = opts.geography === true;
+ const includeLandmarks = opts.landmarks === true;
const appList = Array.isArray(apps) ? apps : [];
const posMap = positions instanceof Map ? positions : new Map();
@@ -181,11 +225,16 @@ export function computeMiniMap(apps, positions, opts = {}) {
};
});
+ const player = opts.player ? projectPlayer(opts.player.position, opts.player.heading, bounds, padding) : null;
+ const landmarks = includeLandmarks ? projectLandmarks(bounds, padding) : [];
+
return {
dots,
bounds,
count: dots.length,
empty: dots.length === 0,
geography: includeGeography ? projectGeography(bounds, padding) : null,
+ player,
+ landmarks,
};
}
diff --git a/client/src/utils/openWorldMiniMap.test.js b/client/src/utils/openWorldMiniMap.test.js
index 956efa5c42..e74d40ae48 100644
--- a/client/src/utils/openWorldMiniMap.test.js
+++ b/client/src/utils/openWorldMiniMap.test.js
@@ -7,6 +7,8 @@ import {
computeMiniMap,
geographyWorldPoints,
projectGeography,
+ projectPlayer,
+ projectLandmarks,
spreadProjectedPoints,
} from './openWorldMiniMap';
import { WORLD, PARCELS } from './openWorldPlan';
@@ -264,8 +266,49 @@ describe('projectGeography', () => {
expect(geo.shorelineY).toBeGreaterThanOrEqual(0);
expect(geo.shorelineY).toBeLessThanOrEqual(1);
expect(geo.harbor.label).toBe(PARCELS.dataHarbor.label);
- // Harbor anchor (z=-64) is north of the shoreline (z=-56) → projects higher (smaller ny).
expect(geo.harbor.ny).toBeLessThan(geo.shorelineY);
});
});
+
+describe('projectPlayer', () => {
+ const bounds = { minX: -60, maxX: 60, minZ: -70, maxZ: 60 };
+
+ it('projects player position and converts heading to degrees for clockwise CSS rotation', () => {
+ const player = projectPlayer({ x: 0, z: 0 }, 0, bounds);
+ expect(player).not.toBeNull();
+ expect(player.nx).toBeCloseTo(0.5);
+ expect(player.rotationDeg).toBeCloseTo(0);
+
+ // Rover heading -π/2 (turning right / east / +X) corresponds to +90° clockwise CSS rotation:
+ const playerEast = projectPlayer({ x: 10, z: -10 }, -Math.PI / 2, bounds);
+ expect(playerEast.rotationDeg).toBeCloseTo(90);
+ });
+
+ it('returns null on invalid / absent inputs', () => {
+ expect(projectPlayer(null, 0, bounds)).toBeNull();
+ expect(projectPlayer({ x: 0, z: 0 }, 0, null)).toBeNull();
+ });
+});
+
+describe('projectLandmarks', () => {
+ const bounds = { minX: -60, maxX: 60, minZ: -70, maxZ: 60 };
+
+ it('projects landmarks onto normalized coordinates', () => {
+ const landmarks = projectLandmarks(bounds);
+ expect(landmarks.length).toBeGreaterThanOrEqual(5);
+ landmarks.forEach((lm) => {
+ expect(typeof lm.id).toBe('string');
+ expect(typeof lm.label).toBe('string');
+ expect(lm.nx).toBeGreaterThanOrEqual(0);
+ expect(lm.nx).toBeLessThanOrEqual(1);
+ expect(lm.ny).toBeGreaterThanOrEqual(0);
+ expect(lm.ny).toBeLessThanOrEqual(1);
+ });
+ });
+
+ it('returns empty array when bounds are null', () => {
+ expect(projectLandmarks(null)).toEqual([]);
+ });
+});
+
// @vitest-environment node
diff --git a/client/src/utils/openWorldProximity.js b/client/src/utils/openWorldProximity.js
new file mode 100644
index 0000000000..66edce73e2
--- /dev/null
+++ b/client/src/utils/openWorldProximity.js
@@ -0,0 +1,147 @@
+// Pure deterministic proximity detection for OpenWorld exploration mode.
+// Unifies detection across buildings, warp pads, landmarks, and easter eggs.
+// No three.js / React imports — pure, testable in node.
+
+import { PARCELS } from './openWorldPlan';
+
+export const PROXIMITY_DISTANCES = {
+ warpPad: 3.6,
+ building: 6.0,
+ landmark: 8.5,
+ easterEgg: 4.5,
+ shard: 3.0,
+};
+
+// Curated list of recognizable world landmarks derived from the master town plan
+export const WORLD_LANDMARKS = [
+ { id: 'ai-core', regionId: 'ai-core', parcel: 'aiCore', label: 'AI Core Plaza', eyebrow: 'LANDMARK REACTOR', action: 'INSPECT AI RUNS' },
+ { id: 'backup-vault', regionId: 'backup-vault', parcel: 'backupVault', label: 'Backup Vault', eyebrow: 'LANDMARK VAULT', action: 'INSPECT BACKUPS' },
+ { id: 'task-queue', regionId: 'task-queue', parcel: 'taskQueue', label: 'Task Queue Depot', eyebrow: 'LANDMARK DEPOT', action: 'VIEW TASKS' },
+ { id: 'wellness', regionId: 'wellness', parcel: 'health', label: 'Wellness Tower', eyebrow: 'LANDMARK TOWER', action: 'VIEW VITALS' },
+ { id: 'memory', regionId: 'memory', parcel: 'memory', label: 'Memory Quarter', eyebrow: 'LANDMARK DISTRICT', action: 'VIEW MEMORY GRAPH' },
+ { id: 'sprint-yard', regionId: 'sprint-yard', parcel: 'jira', label: 'Sprint Yard', eyebrow: 'LANDMARK SPRINT', action: 'VIEW SPRINT TICKETS' },
+ { id: 'goals', regionId: 'goals', parcel: 'goals', label: 'Goal Monuments', eyebrow: 'LANDMARK MONUMENT', action: 'VIEW LIFE GOALS' },
+ { id: 'artifacts', regionId: 'artifacts', parcel: 'artifacts', label: 'Hall of Achievements', eyebrow: 'LANDMARK HALL', action: 'VIEW ACHIEVEMENTS' },
+ { id: 'voice', regionId: 'voice', parcel: 'voice', label: 'Voice Beacon', eyebrow: 'LANDMARK BEACON', action: 'VIEW VOICE AGENT' },
+ { id: 'data-harbor', regionId: 'data-harbor', parcel: 'dataHarbor', label: 'Data Harbor Piers', eyebrow: 'LANDMARK HARBOR', action: 'VIEW DATA HARBOR' },
+];
+
+export function getResolvedLandmarks() {
+ return WORLD_LANDMARKS.map((lm) => {
+ const parcel = PARCELS[lm.parcel];
+ if (!parcel) return null;
+ return {
+ ...lm,
+ x: parcel.anchor[0],
+ y: 0,
+ z: parcel.anchor[2],
+ };
+ }).filter(Boolean);
+}
+
+// Compute the closest interactable target to the player
+export function detectProximity({
+ playerPos,
+ apps = [],
+ positions = null,
+ warpPads = [],
+ easterEggs = [],
+ landmarks = getResolvedLandmarks(),
+} = {}) {
+ if (!playerPos || typeof playerPos.x !== 'number' || typeof playerPos.z !== 'number') {
+ return null;
+ }
+
+ const px = playerPos.x;
+ const pz = playerPos.z;
+
+ let closestTarget = null;
+ let closestDist = Infinity;
+
+ // 1. Warp pads (highest priority for fast travel nodes)
+ for (const pad of warpPads) {
+ if (!pad) continue;
+ const pos = pad.position || (pad.region ? [pad.region.anchor[0], 0, pad.region.anchor[2]] : null);
+ if (!pos) continue;
+ const dx = px - pos[0];
+ const dz = pz - pos[2];
+ const dist = Math.hypot(dx, dz);
+ if (dist < PROXIMITY_DISTANCES.warpPad && dist < closestDist) {
+ closestDist = dist;
+ const region = pad.region || pad;
+ closestTarget = {
+ type: 'warpPad',
+ id: region.id,
+ label: region.label || 'WARP GATE',
+ eyebrow: 'WARP GATE',
+ action: 'WARP TO',
+ raw: region,
+ };
+ }
+ }
+
+ // 2. Apps / Buildings
+ if (positions && typeof positions.forEach === 'function') {
+ positions.forEach((pos, appId) => {
+ const dx = px - pos.x;
+ const dz = pz - pos.z;
+ const dist = Math.hypot(dx, dz);
+ if (dist < PROXIMITY_DISTANCES.building && dist < closestDist) {
+ closestDist = dist;
+ const app = apps.find((a) => a.id === appId);
+ const name = app?.name || appId;
+ closestTarget = {
+ type: 'building',
+ id: appId,
+ label: name,
+ eyebrow: 'NEARBY BUILDING',
+ action: 'OPEN APP STATUS',
+ raw: app || { id: appId, name },
+ };
+ }
+ });
+ }
+
+ // 3. Easter eggs
+ for (const egg of easterEggs) {
+ if (!egg || !egg.position) continue;
+ const dx = px - egg.position[0];
+ const dz = pz - egg.position[2];
+ const dist = Math.hypot(dx, dz);
+ if (dist < PROXIMITY_DISTANCES.easterEgg && dist < closestDist) {
+ closestDist = dist;
+ closestTarget = {
+ type: 'easterEgg',
+ id: egg.id,
+ label: `${egg.label || '?!'} — ${egg.hint || 'SECRET'}`,
+ eyebrow: 'EASTER EGG FOUND',
+ action: 'DISCOVER',
+ raw: egg,
+ };
+ }
+ }
+
+ // 4. District landmarks (only if no closer specific target was matched)
+ if (!closestTarget) {
+ for (const lm of landmarks) {
+ if (!lm) continue;
+ const dx = px - lm.x;
+ const dz = pz - lm.z;
+ const dist = Math.hypot(dx, dz);
+ if (dist < PROXIMITY_DISTANCES.landmark && dist < closestDist) {
+ closestDist = dist;
+ closestTarget = {
+ type: 'landmark',
+ id: lm.id,
+ regionId: lm.regionId,
+ label: lm.label,
+ eyebrow: lm.eyebrow,
+ action: lm.action,
+ raw: lm,
+ };
+ }
+ }
+ }
+
+ return closestTarget;
+}
diff --git a/client/src/utils/openWorldProximity.test.js b/client/src/utils/openWorldProximity.test.js
new file mode 100644
index 0000000000..2dff967267
--- /dev/null
+++ b/client/src/utils/openWorldProximity.test.js
@@ -0,0 +1,86 @@
+import { describe, it, expect } from 'vitest';
+import {
+ detectProximity,
+ getResolvedLandmarks,
+ WORLD_LANDMARKS,
+} from './openWorldProximity';
+
+describe('openWorldProximity', () => {
+ it('resolves all world landmarks against plan parcels', () => {
+ const list = getResolvedLandmarks();
+ expect(list.length).toBe(WORLD_LANDMARKS.length);
+ list.forEach((lm) => {
+ expect(typeof lm.x).toBe('number');
+ expect(typeof lm.z).toBe('number');
+ expect(typeof lm.label).toBe('string');
+ expect(typeof lm.eyebrow).toBe('string');
+ expect(typeof lm.action).toBe('string');
+ });
+ });
+
+ it('detects landmark when player is close', () => {
+ const aiCore = getResolvedLandmarks().find((l) => l.id === 'ai-core');
+ expect(aiCore).toBeDefined();
+
+ const target = detectProximity({
+ playerPos: { x: aiCore.x + 1, y: 1.6, z: aiCore.z + 1 },
+ landmarks: [aiCore],
+ });
+
+ expect(target).toBeDefined();
+ expect(target?.type).toBe('landmark');
+ expect(target?.id).toBe('ai-core');
+ expect(target?.action).toBe('INSPECT AI RUNS');
+ });
+
+ it('detects warp pad with higher priority when close to warp pad', () => {
+ const warpPad = {
+ id: 'downtown',
+ region: { id: 'downtown', label: 'Downtown' },
+ position: [10, 0, 10],
+ };
+ const landmark = {
+ id: 'downtown-landmark',
+ x: 10,
+ z: 10,
+ label: 'Downtown Hub',
+ eyebrow: 'LANDMARK',
+ action: 'VIEW',
+ };
+
+ const target = detectProximity({
+ playerPos: { x: 10.5, y: 1.6, z: 10.5 },
+ warpPads: [warpPad],
+ landmarks: [landmark],
+ });
+
+ expect(target?.type).toBe('warpPad');
+ expect(target?.id).toBe('downtown');
+ });
+
+ it('detects easter egg when near its position', () => {
+ const egg = {
+ id: 'leet',
+ label: '1337',
+ hint: 'LEET',
+ position: [-45, 1.2, 40],
+ };
+
+ const target = detectProximity({
+ playerPos: { x: -45.5, y: 1.6, z: 40.5 },
+ easterEggs: [egg],
+ });
+
+ expect(target?.type).toBe('easterEgg');
+ expect(target?.id).toBe('leet');
+ expect(target?.eyebrow).toBe('EASTER EGG FOUND');
+ });
+
+ it('returns null when player is far from all targets', () => {
+ const target = detectProximity({
+ playerPos: { x: 999, y: 1.6, z: 999 },
+ landmarks: getResolvedLandmarks(),
+ });
+ expect(target).toBeNull();
+ });
+});
diff --git a/client/src/utils/openWorldSpeedPads.js b/client/src/utils/openWorldSpeedPads.js
new file mode 100644
index 0000000000..52ad4bb4ab
--- /dev/null
+++ b/client/src/utils/openWorldSpeedPads.js
@@ -0,0 +1,128 @@
+// Pure deterministic helpers for OpenWorld speed boost pads.
+// Boost pads are luminous road markings with animated forward chevron arrows.
+// Driving onto a boost pad gives an instant surge of acceleration and plays a turbo SFX.
+// No three.js / React imports — pure, testable in node.
+
+export const DEFAULT_PAD_BOOST_SPEED = 48; // Peak surge velocity in units/s
+export const PAD_TRIGGER_RADIUS = 2.4;
+
+export const SPEED_PADS = [
+ // Harbor Grand Avenue (accelerating north toward the water)
+ {
+ id: 'pad-avenue-north',
+ label: 'Harbor Sprint (North)',
+ x: 0,
+ z: -20,
+ angle: -Math.PI / 2, // Facing north (-Z)
+ width: 3.8,
+ length: 5.5,
+ boostSpeed: DEFAULT_PAD_BOOST_SPEED,
+ color: '#06b6d4',
+ },
+ // Harbor Grand Avenue (accelerating south back toward downtown)
+ {
+ id: 'pad-avenue-south',
+ label: 'Plaza Approach (South)',
+ x: 0,
+ z: -42,
+ angle: Math.PI / 2, // Facing south (+Z)
+ width: 3.8,
+ length: 5.5,
+ boostSpeed: DEFAULT_PAD_BOOST_SPEED,
+ color: '#06b6d4',
+ },
+ // Southern Arrival Lane (heading into downtown)
+ {
+ id: 'pad-arrival-north',
+ label: 'Downtown Gateway',
+ x: 0,
+ z: 42,
+ angle: -Math.PI / 2, // Facing north (-Z)
+ width: 3.8,
+ length: 5.5,
+ boostSpeed: DEFAULT_PAD_BOOST_SPEED,
+ color: '#38bdf8',
+ },
+ // Western Avenue to Memory Quarter & Backup Vault
+ {
+ id: 'pad-west-spoke',
+ label: 'Memory Quarter Express',
+ x: -24,
+ z: -14,
+ angle: Math.PI * 0.85,
+ width: 3.0,
+ length: 4.8,
+ boostSpeed: DEFAULT_PAD_BOOST_SPEED,
+ color: '#a855f7',
+ },
+ // Eastern Avenue to Goal Monuments & Artifacts Hall
+ {
+ id: 'pad-east-spoke',
+ label: 'Achievements Boulevard',
+ x: 24,
+ z: -14,
+ angle: -Math.PI * 0.85,
+ width: 3.0,
+ length: 4.8,
+ boostSpeed: DEFAULT_PAD_BOOST_SPEED,
+ color: '#facc15',
+ },
+ // South-West Spoke to Productivity District
+ {
+ id: 'pad-sw-spoke',
+ label: 'Productivity Turnpike',
+ x: -28,
+ z: 20,
+ angle: Math.PI * 0.35,
+ width: 3.0,
+ length: 4.8,
+ boostSpeed: DEFAULT_PAD_BOOST_SPEED,
+ color: '#22c55e',
+ },
+ // South-East Spoke to Wellness District
+ {
+ id: 'pad-se-spoke',
+ label: 'Wellness Expressway',
+ x: 28,
+ z: 20,
+ angle: -Math.PI * 0.35,
+ width: 3.0,
+ length: 4.8,
+ boostSpeed: DEFAULT_PAD_BOOST_SPEED,
+ color: '#10b981',
+ },
+];
+
+// Return list of speed boost pads with geometric bounding envelopes
+export function getSpeedPadsList() {
+ return SPEED_PADS.map((pad) => ({
+ ...pad,
+ halfWidth: pad.width / 2,
+ halfLength: pad.length / 2,
+ }));
+}
+
+// Check if player position is currently overlapping a speed boost pad using oriented box bounds
+export function checkSpeedPadOverlap(playerPos, pads = SPEED_PADS, padding = 0.4) {
+ if (!playerPos || typeof playerPos.x !== 'number' || typeof playerPos.z !== 'number') {
+ return null;
+ }
+
+ for (const pad of pads) {
+ const dx = playerPos.x - pad.x;
+ const dz = playerPos.z - pad.z;
+ const cos = Math.cos(-pad.angle);
+ const sin = Math.sin(-pad.angle);
+ const localX = cos * dx - sin * dz;
+ const localZ = sin * dx + cos * dz;
+
+ const halfL = (pad.length / 2) + padding;
+ const halfW = (pad.width / 2) + padding;
+
+ if (Math.abs(localX) <= halfL && Math.abs(localZ) <= halfW) {
+ return pad;
+ }
+ }
+
+ return null;
+}
diff --git a/client/src/utils/openWorldSpeedPads.test.js b/client/src/utils/openWorldSpeedPads.test.js
new file mode 100644
index 0000000000..5b1681a9f7
--- /dev/null
+++ b/client/src/utils/openWorldSpeedPads.test.js
@@ -0,0 +1,56 @@
+import { describe, it, expect } from 'vitest';
+import {
+ SPEED_PADS,
+ getSpeedPadsList,
+ checkSpeedPadOverlap,
+ PAD_TRIGGER_RADIUS,
+} from './openWorldSpeedPads';
+
+describe('openWorldSpeedPads', () => {
+ it('defines a valid set of speed pads with positions and angles', () => {
+ expect(SPEED_PADS.length).toBeGreaterThanOrEqual(4);
+ const ids = new Set();
+ SPEED_PADS.forEach((pad) => {
+ expect(typeof pad.id).toBe('string');
+ expect(typeof pad.x).toBe('number');
+ expect(typeof pad.z).toBe('number');
+ expect(typeof pad.angle).toBe('number');
+ expect(typeof pad.width).toBe('number');
+ expect(typeof pad.length).toBe('number');
+ expect(pad.boostSpeed).toBeGreaterThan(30);
+ expect(ids.has(pad.id)).toBe(false);
+ ids.add(pad.id);
+ });
+ });
+
+ it('getSpeedPadsList returns pads with half dimensions', () => {
+ const list = getSpeedPadsList();
+ list.forEach((pad) => {
+ expect(pad.halfWidth).toBe(pad.width / 2);
+ expect(pad.halfLength).toBe(pad.length / 2);
+ });
+ });
+
+ it('checkSpeedPadOverlap returns pad when player is directly on it', () => {
+ const pad = SPEED_PADS[0];
+ const playerPos = { x: pad.x + 0.2, z: pad.z + 0.2 };
+ const matched = checkSpeedPadOverlap(playerPos, SPEED_PADS, PAD_TRIGGER_RADIUS);
+ expect(matched).toBeDefined();
+ expect(matched?.id).toBe(pad.id);
+ });
+
+ it('checkSpeedPadOverlap returns pad when player is on the rectangular edge', () => {
+ // Pad 0 has length 5.5 (half 2.75). Point at pad.z - 2.5 along the facing direction (-Z)
+ const pad = SPEED_PADS[0]; // angle: -Math.PI / 2 (length extends along -Z / +Z in world space)
+ const playerPos = { x: pad.x, z: pad.z - 2.5 };
+ const matched = checkSpeedPadOverlap(playerPos, SPEED_PADS);
+ expect(matched).toBeDefined();
+ expect(matched?.id).toBe(pad.id);
+ });
+
+ it('checkSpeedPadOverlap returns null when player is far away or invalid', () => {
+ expect(checkSpeedPadOverlap(null)).toBeNull();
+ expect(checkSpeedPadOverlap({ x: 999, z: 999 })).toBeNull();
+ expect(checkSpeedPadOverlap({ x: 'invalid', z: 0 })).toBeNull();
+ });
+});