Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

fix: kill Club T-pose flashes and cap the render loop for lower heat

nirholas297a94a1a55e
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ed3d654fa..900d4ff29 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -18,6 +18,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
- **Brain Studio — build your agent’s mind as a visual circuit** — The Brain tab in Agent Studio is now a visual node editor: wire Persona, Model, Memory, Skills, and trading-reasoning nodes into a living graph that IS your agent’s personality. Pick from real LLMs (Claude, GPT, Granite and more) per branch, connect a memory port that recalls and writes real memories, and watch the active path light up as your agent thinks — tokens streaming, memory firing, the avatar reacting live. A built-in test chat runs your graph against the real models with real latency and token stats, and forkable templates (Sniper, Scalper, Researcher, Companion) get you started in one click. Your graph compiles straight to your agent’s persona so every existing chat surface picks up the change. (`/agent-studio`) `[feature]`
- **Cleaner Pole Club bass — no more speaker distortion** — Fixed the buzzy bass distortion some listeners heard at the Pole Club, especially on laptop and phone speakers. The club's low-end was being boosted hard enough to clip the audio output when several tracks overlapped; we've added a brick-wall limiter on the final mix, evened out the reverb so it adds a predictable amount of space, and dialed the bass boost back to a level that still hits hard without overdriving. The room now sounds full and clean at any volume. (`/club`) `[fix]`
- **Clearer IRL onboarding and copy** — Opening IRL for the first time now spells out the core loop in plain words: turn on Camera AR, aim at the spot you want, then tap Pin here to anchor your agent in real space. The on-screen guidance updates as you go — it points you to the next step before you've pinned, and confirms when your agent is anchored. We rewrote the status messages around pinning to be calm and literal instead of technical or alarming: waiting on a GPS fix now tells you it's quicker outdoors, pinning without location explains your agent is saved on this device until you turn location on, and a missing compass reads as a gentle note rather than a warning. The caption keyboard now opens reliably when the panel slides up on iPhone. (`/irl`) `[improvement]`
+- **Club dancers never flash a T-pose while the room loads in** — When you stepped onto the pole floor, the dancers used to stand stiff with their arms out — a frozen T-pose — for several seconds while their idle animation streamed in, and one of them could stay frozen even longer while her rig was swapped to a compatible one. Each dancer now has her idle and walk loaded and bound the instant she appears, so the first frame you see is her resting stance, and she steps to the pole with her legs moving. No more T-pose, no more sliding. (`/club`) `[fix]`
- **Corner helper cards no longer pile up and hide page content** — The small helper cards that live in the bottom-right corner — the "Getting started" guide, the "have you tried…" feature tips, and the "Your agent is ready" welcome card — each positioned themselves independently, so on many pages they stacked on the exact same spot and covered each other and the content behind them (most visibly the Deploy page's Live Preview). They now share a single tidy stack that flows them vertically, so they never overlap one another or the page. The welcome card also no longer follows you onto the Deploy and Explore pages, where it had nothing to do. (`/deploy`) `[fix, improvement]`
- **Creator royalty payouts protected against double-settlement** — Royalty payouts to skill authors now claim each pending amount atomically before sending funds on-chain, so two overlapping settlement runs can never pay the same balance twice. Creators are paid exactly once for what they've earned. `[fix]`
- **Discovery now shows only real creator avatars** — The Explore / discovery feed previously padded itself with a set of built-in sample avatars and counted them in the totals. The feed and its counts now reflect only real avatars created by the community — no filler. (`/explore`) `[improvement]`
@@ -59,7 +60,9 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
- **Shared agent links now unfurl with the agent's own avatar** — When you paste a link to an agent on X, Discord, Slack, Telegram or iMessage, the preview card now shows that agent's actual avatar, name and description instead of a generic three.ws image — so every shared link is visual proof of the collectible. Bots that don't run JavaScript get the right image and text rendered on the server, and agents without an avatar yet fall back to a clean branded card with their initial. We also fixed the canonical and share URLs on agent pages to point at the real /agents/<id> address. `[feature, improvement]`
- **Smart Money directory comes to Copy Trading** — The Copy Trading dashboard now has a Smart Money section: a ranked, searchable directory of over a thousand ecosystem-proven wallets drawn from gmgn.ai's smart-money taxonomy across both Solana and BSC. Filter by chain and by category — smart money, KOLs, launchpad specialists, snipers — and sort by 30-day realized profit, best multiple, win rate, or follower count. Each wallet shows its real 30-day performance and links straight to its live trade history, so you can vet a trader's track record before you decide to mirror them. (`/dashboard/copy`) `[feature]`
- **Smoother switch between camera AR and Place on floor** — On phones that can anchor an agent to your real floor, flipping between plain Camera AR and the Place on floor flow is now seamless. Before, tapping the two in quick succession could fight over the camera and leave you on a black screen with the camera light stuck on; now each switch waits for the previous one to finish releasing the camera, so it never double-grabs it. Leaving a floor session drops you straight back into the live camera view you came from — passthrough resumes instantly instead of flashing a dark frame — and taps on the screen behind the floor-anchor panel no longer slip through to open the wrong thing. If a floor session can't start, the scene keeps running and you get the calm "use Pin here instead" card rather than a frozen view. (`/irl`) `[fix]`
+- **Switching avatars in the Club never freezes you in a T-pose** — The Club's avatar switcher lists public gallery rigs alongside the built-in ones, and not every gallery model is a humanoid our dance and walk clips can drive. Picking one of those used to leave your character frozen stiff, arms out, sliding around without moving her legs. Now the Club checks that a chosen avatar can actually be animated before committing to it — if it can't, it instantly rolls back to the one you were already walking as and tells you why, so your character keeps idling and walking with her legs moving no matter what you pick. (`/club`) `[fix]`
- **Tapping an agent in AR now lands every time** — Inspecting an agent in IRL AR is a tap — and we made that tap far harder to miss. There's now a finger-sized catch zone around each agent's floating name, so a tap that lands just beside a small or distant agent still opens its card instead of doing nothing. When several agents overlap on screen, your tap resolves to the one in front of you, and it never selects an agent that's behind you or off-screen. We also kept agents from vanishing when you bring your phone right up to one to look closely. Inspecting works whether the agent is centered, near the edge of the frame, close, or far. (`/irl`) `[improvement]`
+- **The Club runs cooler — capped frame rate and adaptive quality** — Walking into the Club no longer spins your laptop's fans up. The walk-through now draws at a steady 60 fps instead of chasing high-refresh displays (which did up to 2.4× the GPU work for no visible gain), caps how many pixels it renders on retina screens, and pauses rendering entirely when the tab is in the background. If frames still run slow on a struggling machine, it automatically steps quality down a notch so the scene keeps moving smoothly instead of grinding. Big drop in heat and battery use, same neon-lit walk. (`/club`) `[fix, improvement]`
- **The Pole Club alley is easier to see** — The walk up to the Pole Club was lit so tightly that only a thin strip of pavement under your feet was visible while the walls fell away to black. The alley now carries a soft warm fill light that travels with you and a wider key, plus a gentle lift to the ambient glow — so the stretch you're actually walking through stays legible the whole way to the door, without losing the moody neon look. (`/club`) `[improvement]`
- **Token Oracle follow / unfollow is working again** — Subscribing an agent to a token's oracle alerts — and unsubscribing — was silently failing for everyone; only the status check worked. Both now go through correctly, so you can opt an agent into (and out of) score-based alerts as intended. `[fix]`
- **Unity & Unreal avatar loading documented with code that actually works** — The developer hub's Unity and Unreal cards used to show sample code for an SDK that doesn't exist yet. They now show the real, working way to load a three.ws avatar today — your avatar's GLB endpoint loaded at runtime with glTFast (Unity) or glTFRuntime (Unreal), both standard glTF importers — alongside an honest note that a native package is still on the roadmap. (`/dashboard/developers`) `[docs, improvement]`
diff --git a/data/changelog.json b/data/changelog.json
index fa9a7b063..d56b861f8 100644
--- a/data/changelog.json
+++ b/data/changelog.json
@@ -1,6 +1,34 @@
{
"$comment": "Curated changelog entries for three.ws — the editorial layer of the public changelog. New PAGE launches are tracked automatically via the `added` field in data/pages.json; this file is for everything else holders care about: improvements, fixes, SDK releases, trading/payments capabilities, security work. scripts/build-page-index.mjs merges both sources into CHANGELOG.md, public/changelog.json, and public/changelog.xml. Newest first. Allowed tags: feature, improvement, fix, sdk, infra, docs, security. `link` is optional and must be a live three.ws path.",
"entries": [
+ {
+ "date": "2026-06-19",
+ "title": "Club dancers never flash a T-pose while the room loads in",
+ "summary": "When you stepped onto the pole floor, the dancers used to stand stiff with their arms out — a frozen T-pose — for several seconds while their idle animation streamed in, and one of them could stay frozen even longer while her rig was swapped to a compatible one. Each dancer now has her idle and walk loaded and bound the instant she appears, so the first frame you see is her resting stance, and she steps to the pole with her legs moving. No more T-pose, no more sliding.",
+ "tags": [
+ "fix"
+ ],
+ "link": "/club"
+ },
+ {
+ "date": "2026-06-19",
+ "title": "Switching avatars in the Club never freezes you in a T-pose",
+ "summary": "The Club's avatar switcher lists public gallery rigs alongside the built-in ones, and not every gallery model is a humanoid our dance and walk clips can drive. Picking one of those used to leave your character frozen stiff, arms out, sliding around without moving her legs. Now the Club checks that a chosen avatar can actually be animated before committing to it — if it can't, it instantly rolls back to the one you were already walking as and tells you why, so your character keeps idling and walking with her legs moving no matter what you pick.",
+ "tags": [
+ "fix"
+ ],
+ "link": "/club"
+ },
+ {
+ "date": "2026-06-19",
+ "title": "The Club runs cooler — capped frame rate and adaptive quality",
+ "summary": "Walking into the Club no longer spins your laptop's fans up. The walk-through now draws at a steady 60 fps instead of chasing high-refresh displays (which did up to 2.4× the GPU work for no visible gain), caps how many pixels it renders on retina screens, and pauses rendering entirely when the tab is in the background. If frames still run slow on a struggling machine, it automatically steps quality down a notch so the scene keeps moving smoothly instead of grinding. Big drop in heat and battery use, same neon-lit walk.",
+ "tags": [
+ "fix",
+ "improvement"
+ ],
+ "link": "/club"
+ },
{
"date": "2026-06-19",
"title": "Corner helper cards no longer pile up and hide page content",
diff --git a/public/changelog.json b/public/changelog.json
index cb4bac9ab..1ffb9bc09 100644
--- a/public/changelog.json
+++ b/public/changelog.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-06-19T19:07:20.492Z",
+ "generated_at": "2026-06-19T20:23:06.913Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json",
"site": {
"name": "three.ws",
@@ -127,6 +127,16 @@
"improvement"
]
},
+ {
+ "date": "2026-06-19",
+ "type": "update",
+ "title": "Club dancers never flash a T-pose while the room loads in",
+ "summary": "When you stepped onto the pole floor, the dancers used to stand stiff with their arms out — a frozen T-pose — for several seconds while their idle animation streamed in, and one of them could stay frozen even longer while her rig was swapped to a compatible one. Each dancer now has her idle and walk loaded and bound the instant she appears, so the first frame you see is her resting stance, and she steps to the pole with her legs moving. No more T-pose, no more sliding.",
+ "link": "/club",
+ "tags": [
+ "fix"
+ ]
+ },
{
"date": "2026-06-19",
"type": "update",
@@ -548,6 +558,16 @@
"fix"
]
},
+ {
+ "date": "2026-06-19",
+ "type": "update",
+ "title": "Switching avatars in the Club never freezes you in a T-pose",
+ "summary": "The Club's avatar switcher lists public gallery rigs alongside the built-in ones, and not every gallery model is a humanoid our dance and walk clips can drive. Picking one of those used to leave your character frozen stiff, arms out, sliding around without moving her legs. Now the Club checks that a chosen avatar can actually be animated before committing to it — if it can't, it instantly rolls back to the one you were already walking as and tells you why, so your character keeps idling and walking with her legs moving no matter what you pick.",
+ "link": "/club",
+ "tags": [
+ "fix"
+ ]
+ },
{
"date": "2026-06-19",
"type": "update",
@@ -558,6 +578,17 @@
"improvement"
]
},
+ {
+ "date": "2026-06-19",
+ "type": "update",
+ "title": "The Club runs cooler — capped frame rate and adaptive quality",
+ "summary": "Walking into the Club no longer spins your laptop's fans up. The walk-through now draws at a steady 60 fps instead of chasing high-refresh displays (which did up to 2.4× the GPU work for no visible gain), caps how many pixels it renders on retina screens, and pauses rendering entirely when the tab is in the background. If frames still run slow on a struggling machine, it automatically steps quality down a notch so the scene keeps moving smoothly instead of grinding. Big drop in heat and battery use, same neon-lit walk.",
+ "link": "/club",
+ "tags": [
+ "fix",
+ "improvement"
+ ]
+ },
{
"date": "2026-06-19",
"type": "update",
diff --git a/public/changelog.xml b/public/changelog.xml
index 11a531bbb..9ed9f2fae 100644
--- a/public/changelog.xml
+++ b/public/changelog.xml
@@ -102,6 +102,14 @@
<category>improvement</category>
<description>Opening IRL for the first time now spells out the core loop in plain words: turn on Camera AR, aim at the spot you want, then tap Pin here to anchor your agent in real space. The on-screen guidance updates as you go — it points you to the next step before you've pinned, and confirms when your agent is anchored. We rewrote the status messages around pinning to be calm and literal instead of technical or alarming: waiting on a GPS fix now tells you it's quicker outdoors, pinning without location explains your agent is saved on this device until you turn location on, and a missing compass reads as a gentle note rather than a warning. The caption keyboard now opens reliably when the panel slides up on iPhone.</description>
</item>
+ <item>
+ <title>Club dancers never flash a T-pose while the room loads in</title>
+ <link>https://three.ws/club</link>
+ <guid isPermaLink="false">2026-06-19:Club dancers never flash a T-pose while the room loads in</guid>
+ <pubDate>Fri, 19 Jun 2026 12:00:00 GMT</pubDate>
+ <category>fix</category>
+ <description>When you stepped onto the pole floor, the dancers used to stand stiff with their arms out — a frozen T-pose — for several seconds while their idle animation streamed in, and one of them could stay frozen even longer while her rig was swapped to a compatible one. Each dancer now has her idle and walk loaded and bound the instant she appears, so the first frame you see is her resting stance, and she steps to the pole with her legs moving. No more T-pose, no more sliding.</description>
+ </item>
<item>
<title>Corner helper cards no longer pile up and hide page content</title>
<link>https://three.ws/deploy</link>
@@ -430,6 +438,14 @@
<category>fix</category>
<description>On phones that can anchor an agent to your real floor, flipping between plain Camera AR and the Place on floor flow is now seamless. Before, tapping the two in quick succession could fight over the camera and leave you on a black screen with the camera light stuck on; now each switch waits for the previous one to finish releasing the camera, so it never double-grabs it. Leaving a floor session drops you straight back into the live camera view you came from — passthrough resumes instantly instead of flashing a dark frame — and taps on the screen behind the floor-anchor panel no longer slip through to open the wrong thing. If a floor session can't start, the scene keeps running and you get the calm &quot;use Pin here instead&quot; card rather than a frozen view.</description>
</item>
+ <item>
+ <title>Switching avatars in the Club never freezes you in a T-pose</title>
+ <link>https://three.ws/club</link>
+ <guid isPermaLink="false">2026-06-19:Switching avatars in the Club never freezes you in a T-pose</guid>
+ <pubDate>Fri, 19 Jun 2026 12:00:00 GMT</pubDate>
+ <category>fix</category>
+ <description>The Club's avatar switcher lists public gallery rigs alongside the built-in ones, and not every gallery model is a humanoid our dance and walk clips can drive. Picking one of those used to leave your character frozen stiff, arms out, sliding around without moving her legs. Now the Club checks that a chosen avatar can actually be animated before committing to it — if it can't, it instantly rolls back to the one you were already walking as and tells you why, so your character keeps idling and walking with her legs moving no matter what you pick.</description>
+ </item>
<item>
<title>Tapping an agent in AR now lands every time</title>
<link>https://three.ws/irl</link>
@@ -438,6 +454,14 @@
<category>improvement</category>
<description>Inspecting an agent in IRL AR is a tap — and we made that tap far harder to miss. There's now a finger-sized catch zone around each agent's floating name, so a tap that lands just beside a small or distant agent still opens its card instead of doing nothing. When several agents overlap on screen, your tap resolves to the one in front of you, and it never selects an agent that's behind you or off-screen. We also kept agents from vanishing when you bring your phone right up to one to look closely. Inspecting works whether the agent is centered, near the edge of the frame, close, or far.</description>
</item>
+ <item>
+ <title>The Club runs cooler — capped frame rate and adaptive quality</title>
+ <link>https://three.ws/club</link>
+ <guid isPermaLink="false">2026-06-19:The Club runs cooler — capped frame rate and adaptive quality</guid>
+ <pubDate>Fri, 19 Jun 2026 12:00:00 GMT</pubDate>
+ <category>fix</category>
+ <description>Walking into the Club no longer spins your laptop's fans up. The walk-through now draws at a steady 60 fps instead of chasing high-refresh displays (which did up to 2.4× the GPU work for no visible gain), caps how many pixels it renders on retina screens, and pauses rendering entirely when the tab is in the background. If frames still run slow on a struggling machine, it automatically steps quality down a notch so the scene keeps moving smoothly instead of grinding. Big drop in heat and battery use, same neon-lit walk.</description>
+ </item>
<item>
<title>The Pole Club alley is easier to see</title>
<link>https://three.ws/club</link>
diff --git a/public/features.json b/public/features.json
index 9a763bb6c..89aeeb69e 100644
--- a/public/features.json
+++ b/public/features.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-06-19T19:07:20.478Z",
+ "generated_at": "2026-06-19T20:23:06.902Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json",
"site": {
"name": "three.ws",
diff --git a/src/club-entrance.js b/src/club-entrance.js
index 05a9fe0b8..21c3685d7 100644
--- a/src/club-entrance.js
+++ b/src/club-entrance.js
@@ -68,6 +68,15 @@ const PASS_KEY = 'club:pass:v1';
// GLB rig (not an instanced mesh), so we keep the floor light for load + perf.
const MAX_CROWD_PER_SCENE = 5;
const MOVE_CLIPS = new Set(['idle', 'walk']);
+// Canonical URLs for the player's locomotion clips, kept independent of the
+// manifest so they survive a failed/empty manifest fetch. These back the
+// guaranteed idle/walk defs below: even if both the prefetch AND the manifest
+// fetch fail, play('idle') can still lazy-load from here rather than leave the
+// avatar frozen in a bind/T-pose on entry. The url's match the prefetch URLs.
+const MOVE_CLIP_URLS = {
+ idle: '/animations/clips/idle.json',
+ walk: '/animations/clips/walk.json',
+};
// The dance the avatar breaks into the instant the cover charge settles — a
// twerk on the spot before it walks past the velvet rope. Lazy-loaded from the
// manifest on first admit (most visitors never pay a cover the same session as
@@ -77,9 +86,10 @@ const VENUE_NAMES = ['Alley', 'Gallery', 'Clubhouse']; // index-aligned with SEQ
// The agent switcher's catalog: bundled, known-good humanoid rigs that ship with
// the app (so the dropdown always has options offline — Hard rule 9), plus public
-// avatars pulled from the gallery at runtime. Deduped by URL. Any rig the clip
-// library can't drive falls back to its bind pose in the AnimationManager, so a
-// pick never freezes the walk.
+// avatars pulled from the gallery at runtime. Deduped by URL. A gallery rig the
+// clip library can't drive (a non-humanoid sample model, an odd skeleton) is
+// caught at swap time and rolled back to the working rig — see swapAvatarTo — so
+// a pick never leaves the player frozen in a bind/T-pose mid-walk.
const BUNDLED_AGENTS = [
{ key: 'default', name: 'Aria', url: AVATAR_URL },
{ key: 'michelle', name: 'Michelle', url: '/avatars/michelle.glb' },
@@ -304,8 +314,16 @@ async function start(canvasEl) {
const anim = new AnimationManager();
anim.attach(avatar, { avatarUrl: AVATAR_URL });
- const sceneDefs = (Array.isArray(manifest) ? manifest : [])
+ const manifestDefs = (Array.isArray(manifest) ? manifest : [])
.filter((d) => MOVE_CLIPS.has(d.name) || d.name === ADMIT_DANCE_CLIP);
+ // Guarantee an idle + walk def even if the manifest fetch failed or returned
+ // no locomotion entries — without a def, a null prefetch leaves play('idle')
+ // with nothing to load and the avatar enters the club in a T-pose. Manifest
+ // entries win (they may carry richer metadata); these only fill the gaps.
+ const sceneDefs = ['idle', 'walk']
+ .filter((name) => !manifestDefs.some((d) => d.name === name))
+ .map((name) => ({ name, url: MOVE_CLIP_URLS[name], loop: true }))
+ .concat(manifestDefs);
anim.setAnimationDefs(sceneDefs);
// Inject the pre-fetched clip data directly — no second network round-trip,
// animations are bound before the first render frame so there's no T-pose.
@@ -612,23 +630,56 @@ async function start(canvasEl) {
if (agentSelect) agentSelect.disabled = true;
if (agentBrowseBtn) agentBrowseBtn.disabled = true;
const movingNow = anim.currentName === 'walk';
+ const clip = movingNow ? 'walk' : 'idle';
+ const prevAvatar = avatar; // kept mounted until the new rig proves it can move
try {
const gltf = await loader.loadAsync(url);
const next = gltf.scene;
scaleToHeight(next, AVATAR_HEIGHT);
placeOnFloor(next);
- rig.remove(avatar);
- disposeObject(avatar);
+ // Verify the clip library can actually drive this rig BEFORE committing.
+ // The switcher lists public gallery rigs, not all of them humanoid — a
+ // non-canonical skeleton (Fox, CesiumMan, a robot…) can't be retargeted
+ // and would leave the player frozen in a bind/T-pose. Mount it, attach,
+ // and require the clip to play; if it can't, roll back to the working
+ // rig so her legs never stop moving (Hard rule 9: no errors without
+ // solutions). The dancers (src/club.js) use the same verified fallback.
+ rig.remove(prevAvatar);
+ rig.add(next);
+ anim.attach(next, { avatarUrl: url });
+ const drivable = anim.supportsCanonicalClips() && await anim.play(clip);
+ if (!drivable) {
+ rig.remove(next);
+ disposeObject(next);
+ rig.add(prevAvatar);
+ anim.attach(prevAvatar, { avatarUrl: currentAvatarUrl });
+ await anim.play(clip);
+ avatar = prevAvatar;
+ if (agentSelect) agentSelect.value = currentAvatarUrl;
+ log.warn(`[club-entrance] "${url}" can't be retargeted — keeping the current rig`);
+ flashHint("That avatar can't dance our moves — keeping your current one.");
+ return false;
+ }
+ // Committed: the new rig drives. Now it's safe to drop the old one.
+ disposeObject(prevAvatar);
avatar = next;
- rig.add(avatar);
- anim.attach(avatar, { avatarUrl: url });
- await anim.play(movingNow ? 'walk' : 'idle');
currentAvatarUrl = url;
if (agentSelect) agentSelect.value = url;
return true;
} catch (err) {
log.warn('[club-entrance] agent swap failed', err);
+ // A load/parse failure: make sure the working rig is still mounted and
+ // animating, never a blank/frozen stage.
+ if (avatar !== prevAvatar) {
+ try {
+ rig.add(prevAvatar);
+ anim.attach(prevAvatar, { avatarUrl: currentAvatarUrl });
+ await anim.play(clip);
+ avatar = prevAvatar;
+ } catch (e2) { log.warn('[club-entrance] rollback after swap failure also failed', e2); }
+ }
if (agentSelect) agentSelect.value = currentAvatarUrl; // keep the working rig selected
+ flashHint("Couldn't load that avatar — keeping your current one.");
return false;
} finally {
swappingAgent = false;
@@ -672,6 +723,17 @@ async function start(canvasEl) {
? `Drag to move and look · ${tail}`
: `WASD / arrows to move · drag to look · ${tail}`;
}
+ // Briefly override the controls hint with a transient message (e.g. a rejected
+ // avatar swap), then restore the normal movement hint. Self-cancelling so
+ // rapid messages don't leave a stale one pinned.
+ let hintFlashTimer = 0;
+ function flashHint(msg) {
+ if (!hintEl) return;
+ if (hintFlashTimer) clearTimeout(hintFlashTimer);
+ hintEl.textContent = msg;
+ showHint(true);
+ hintFlashTimer = setTimeout(() => { hintFlashTimer = 0; setHint(); }, 3200);
+ }
function setPromptLabel() {
if (!promptEl) return;
const label = doorLabel();
@@ -725,6 +787,27 @@ async function start(canvasEl) {
let phaseStart = performance.now();
let raf = 0;
let last = performance.now();
+ let lastDraw = 0;
+ // Cap the draw rate at ~60 fps. Without this the loop renders at the panel's
+ // native refresh (120/144 Hz on many laptops), doing 2–2.4× the GPU work for
+ // no visible benefit — the dominant cause of the fans spinning up. Simulation
+ // still steps every animation frame; only the expensive composer.render is
+ // gated, so movement stays smooth.
+ const FRAME_BUDGET_MS = 1000 / 60 - 1; // -1ms slack so a 60Hz panel never skips
+ // Sustained-slow-frame watchdog: drops pixel ratio one tier (and finally the
+ // SMAA pass) when frames stay above budget, so a struggling GPU cools off
+ // instead of grinding. Never upgrades — see club-perf.js.
+ const watchdog = createFrameWatchdog({
+ initialTier: profile.tier,
+ onDowngrade(tier) {
+ const next = PROFILES[tier];
+ if (!next) return;
+ renderer.setPixelRatio(next.pixelRatio);
+ composer.setSize(window.innerWidth, window.innerHeight);
+ smaaPass.enabled = next.tier !== 'low';
+ log.info('[club] render downgraded to', tier, 'profile');
+ },
+ });
// True only while the admission dance is playing. Freezes the movement clip
// so the per-frame idle/walk crossfade in stepAvatar can't stomp the twerk
// the instant it starts.
@@ -823,7 +906,17 @@ async function start(canvasEl) {
}
}
- composer.render(dt);
+ // Draw at most ~60 fps, and never while the tab is hidden — the GPU
+ // shouldn't keep rendering a club nobody is looking at. Simulation above
+ // already ran this frame; here we only decide whether to paint it.
+ if (!document.hidden && now - lastDraw >= FRAME_BUDGET_MS) {
+ // Clamp like the sim dt so the first draw after a hidden tab (interval
+ // of seconds) can't single-handedly trip the slow-frame watchdog.
+ const drawDt = Math.min((now - lastDraw) / 1000, 0.1);
+ lastDraw = now;
+ composer.render(dt);
+ watchdog.tick(drawDt);
+ }
raf = requestAnimationFrame(frame);
}
// Draw one frame so the alley is on screen, then lift the intro overlay.
diff --git a/src/club.js b/src/club.js
index 5d2c44778..a3be9983c 100644
--- a/src/club.js
+++ b/src/club.js
@@ -721,6 +721,22 @@ class PoleStation {
return root;
}
+ /**
+ * Bind the pre-fetched locomotion clips (idle + walk) into this dancer's
+ * mixer so the first `play('idle')` resolves from memory — no network fetch,
+ * no T-pose window. No-op until the boot pre-fetch has populated the shared
+ * `locomotionClips` map (e.g. an offline boot where it stayed empty); the
+ * AnimationManager then lazy-loads as before. Each call retargets the same
+ * raw clip onto whatever rig is currently attached, so it's correct on both
+ * the chosen rig and the fallback rig.
+ */
+ _injectLocomotion() {
+ if (!this.anim || !locomotionClips) return;
+ for (const [name, json] of Object.entries(locomotionClips)) {
+ this.anim.injectClip(name, json, { loop: true });
+ }
+ }
+
/**
* Attach this dancer's avatar. `template` is her chosen GLB; `fallback` is
* the known-good default rig. Every shipped avatar is verified drivable, but
@@ -749,9 +765,12 @@ class PoleStation {
this.skinned = root;
this.anim.setAnimationDefs(animationDefs);
+ this._injectLocomotion();
// Await idle so we can detect if the fallen-pose guard rejects the
// retarget — in which case swap to the fallback rig rather than leave
- // the dancer frozen in her bind pose.
+ // the dancer frozen in her bind pose. With the locomotion clips injected
+ // above, idle binds synchronously — the dancer's first rendered frame is
+ // her resting stance, never a T-pose.
this.anim.play('idle').then((ok) => {
if (ok || !fallback || fallback === template) return;
log.warn(`[club] dancer ${this.id} idle retarget rejected — falling back to default avatar`);
@@ -762,6 +781,7 @@ class PoleStation {
this.anim.attach(fbRoot);
this.skinned = fbRoot;
this.anim.setAnimationDefs(animationDefs);
+ this._injectLocomotion();
this.anim.play('idle').catch(() => {});
}).catch(() => {});
// Pre-load the walk clip so the first tip's walk starts immediately
@@ -1111,6 +1131,40 @@ function createAmbientParticles(count = 50) {
// ── Avatar template + manifest load ──────────────────────────────────────
let animationDefs = null;
+// Raw clip JSON for the two locomotion clips every dancer needs on the first
+// frame — idle (her resting stance) and the feminine walk (the step on/off the
+// pole). Pre-fetched once at boot and injected into each dancer's mixer before
+// the first render so a dancer is NEVER seen in a bind/T-pose while a 3 MB clip
+// streams in. Mirrors the entrance walk-through's inject-before-first-frame
+// pattern (src/club-entrance.js). Keyed by clip name.
+let locomotionClips = null;
+
+/**
+ * Fetch the raw JSON for the locomotion clips named in `names` from their
+ * manifest defs, in parallel. Returns a name→clipJSON map; a clip whose fetch
+ * fails is simply omitted (the dancer's AnimationManager then lazy-loads it as
+ * before, so a failed pre-fetch degrades to the old behaviour, never an error).
+ * @param {Array<{name:string,url:string}>} defs
+ * @param {string[]} names
+ * @returns {Promise<Record<string, object>>}
+ */
+async function loadLocomotionClips(defs, names) {
+ const entries = await Promise.all(
+ names.map(async (name) => {
+ const def = defs.find((d) => d.name === name);
+ if (!def?.url) return null;
+ try {
+ const res = await fetch(def.url, { cache: 'force-cache' });
+ if (!res.ok) return null;
+ return [name, await res.json()];
+ } catch {
+ return null;
+ }
+ }),
+ );
+ return Object.fromEntries(entries.filter(Boolean));
+}
+
/**
* Resolve a dancer's avatar GLB URL. A gallery `avatarId` is looked up through
* the same /api/avatars/:id endpoint the rest of the app uses (Vite dev proxies
@@ -1268,6 +1322,11 @@ async function bootstrap() {
animationDefs = manifest.filter((d) => REQUIRED_CLIPS.has(d.name));
+ // Pre-fetch idle + the feminine walk so every dancer binds them on the first
+ // frame — no T-pose flash while the clip streams in, no extra round-trip on
+ // the fallback rig when a gallery skeleton fails the fallen-pose guard.
+ locomotionClips = await loadLocomotionClips(animationDefs, ['idle', WALK_CLIP]);
+
for (const station of stations) {
station.attachProps({ poleTemplate, stageTemplate });
const wanted = dancerUrls[station.idx] || AVATAR_URL;