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.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
fix(play): honest lobby and HUD states for the live event
nirholas41807d614bec
diff --git a/src/game/ambient-crowd.js b/src/game/ambient-crowd.jsindex 3bdda778e..0204dca54 100644--- a/src/game/ambient-crowd.js+++ b/src/game/ambient-crowd.js@@ -188,7 +188,11 @@ class AmbientCrowd {this.active = false;this._names = [...NAMES];this._avatarBag = []; // shuffled gallery URLs, drained for distinct assignment- this._onChat = (n, t) => { try { this.cc.ui?.addChat?.({ name: n, text: t, mine: false }); } catch { /* ui not ready */ } };+ // Wanderers speak only through their overhead bubbles. They used to also+ // append lines into the real chat log as if they were players, which reads+ // as fabricated activity the moment anyone answers "gm" and gets silence.+ // The chat log carries real messages only.+ this._onChat = null;}_takeName() {if (!this._names.length) this._names = [...NAMES];@@ -207,8 +211,10 @@ class AmbientCrowd {const want = Math.max(0, AMBIENT_TARGET - (realCount | 0));while (this.list.length < want) this.list.push(new Wanderer(this.cc.scene, this._takeName(), this._takeAvatar()));while (this.list.length > want) this.list.pop().dispose();- // Reflect the livelier population in the HUD's online count.- try { this.cc.ui?.setOnline?.((realCount | 0) + this.list.length + 1); } catch { /* ignore */ }+ // The HUD's online count reports REAL players only (self + live peers).+ // Padding it with the decorative crowd was a lie a livestream can catch in+ // one screenshot; the wanderers are scenery, not population.+ try { this.cc.ui?.setOnline?.((realCount | 0) + 1); } catch { /* ignore */ }}update(dt) {const cam = this.cc.camera;@@ -232,9 +238,14 @@ class AmbientCrowd {}// ---- bootstrap: wait for the scene, then run an independent update loop -----async function attach() {+async function attach(attempt = 0) {const cc = window.__CC__;- if (!cc || !cc.scene || !cc.camera) { setTimeout(attach, 300); return; }+ if (!cc || !cc.scene || !cc.camera) {+ // The scene never appearing means boot failed (e.g. no WebGL, error card+ // up). Give up after ~90s instead of polling a dead page forever.+ if (attempt < 300) setTimeout(() => attach(attempt + 1), 300);+ return;+ }await Promise.all([loadManifest(), loadAvatarPool()]);const crowd = new AmbientCrowd(cc);let last = performance.now();diff --git a/src/game/coincommunities-ui.js b/src/game/coincommunities-ui.jsindex 5e3cad8ee..3394fcbb2 100644--- a/src/game/coincommunities-ui.js+++ b/src/game/coincommunities-ui.js@@ -222,7 +222,12 @@ export class CommunityUI {]),]),el('div', { class: 'cc-search' }, [el('span', { text: '🔎' }), this.searchInput]),- el('a', { class: 'cc-adventure', href: '/play', title: 'Isometric MMO — gather, fight, level up' }, [+ // A button into the home-town world, not a link: an <a href="/play">+ // here was a full page reload back to this same lobby.+ el('button', {+ type: 'button', class: 'cc-adventure', title: 'Drop into the home town: gather, fight, level up',+ onclick: () => this.h.onDropIn?.(),+ }, [el('span', { class: 'cc-adventure-ico', text: '⚔️' }),el('span', { html: 'Adventure mode<small>Gather · fight · level up</small>' }),]),@@ -809,12 +814,17 @@ export class CommunityUI {if (!this.h.onSearch) return;const seq = ++this._searchSeq;this.searching = true;+ this.searchError = false;this._renderGrid();let results = [];try {results = (await this.h.onSearch(query)) || [];} catch (err) {+ // A search outage is not "no matches": keep the states distinct so a+ // pump.fun blip renders as a retryable error, never as an empty result+ // that gaslights the player about the coin they just typed.log.warn('[coincommunities] search failed:', err?.message);+ if (seq === this._searchSeq) this.searchError = true;}if (seq !== this._searchSeq) return; // a newer query superseded this onethis.searchResults = results;@@ -840,6 +850,17 @@ export class CommunityUI {this.grid.textContent = '';if (!featured && !list.length) {if (this.searching) { this._renderSearching(); return; }+ if (this.searchError && q) {+ this.grid.appendChild(el('div', { class: 'cc-state' }, [+ el('span', { class: 'cc-state-ico', text: '📡' }),+ el('div', { text: 'Search is unavailable right now. Your coin may still exist; retry in a moment.' }),+ el('button', {+ text: 'Retry search',+ onclick: () => { this.searchError = false; this._remoteSearch(q); },+ }),+ ]));+ return;+ }this.grid.appendChild(el('div', { class: 'cc-state' }, [el('span', { class: 'cc-state-ico', text: '🪙' }),el('div', { text: q ? 'No coins match — try a different name, symbol, or mint.' : 'No communities yet — be the first in!' }),@@ -874,9 +895,18 @@ export class CommunityUI {'aria-label': `Enter the ${sym} holders-only world`,onclick: (e) => { e.stopPropagation(); this.h.onEnter(c, 'holders'); },}, [el('span', { class: 'cc-card-holders-ico', 'aria-hidden': 'true', text: '🔒' }), document.createTextNode('Holders')]);+ // A real interactive element for keyboard and assistive tech: the grid is+ // the lobby's primary action, and a bare div with onclick left it+ // unreachable by Tab and invisible to screen readers.+ const cardName = c.name || (c.symbol ? '$' + c.symbol : 'this coin');return el('div', {class: 'cc-card' + (featured ? ' cc-card-featured' : ''),+ role: 'button', tabindex: '0',+ 'aria-label': `Enter the ${cardName} community world`,onclick: () => this.h.onEnter(c, ''),+ onkeydown: (e) => {+ if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); this.h.onEnter(c, ''); }+ },}, [el('div', { class: 'cc-card-img', style: c.image ? `background-image:url("${c.image}")` : '' }, [liveBadge, holdersBadge]),el('div', { class: 'cc-card-body' }, [@@ -2384,10 +2414,15 @@ export class CommunityUI {this._renderGrid();}- setStatus(state) {- const labels = { connecting: 'connecting…', online: 'connected', offline: 'reconnecting…', unavailable: 'multiplayer unavailable', failed: 'offline — retry', idle: 'idle' };+ setStatus(state, error = null) {+ const labels = { connecting: 'connecting…', online: 'connected', offline: 'reconnecting…', unavailable: 'multiplayer unavailable', failed: 'offline, tap to retry', denied: 'sign-in required', idle: 'idle' };+ // 'offline' is two different truths: a transient drop mid-reconnect (no+ // error) vs the client having exhausted its retries (community-net attaches+ // an error string). Telling a player "reconnecting…" forever after the+ // client gave up is a lie; show the retryable offline label instead.+ const gaveUp = state === 'offline' && !!error;this.statusPill.setAttribute('data-state', state);- this.statusText.textContent = labels[state] || state;+ this.statusText.textContent = gaveUp ? labels.failed : (labels[state] || state);// The latency readout is only meaningful while the link is live.if (state !== 'online') this.pingText.hidden = true;// Only expose the pill to the keyboard / label it as actionable while a@@ -2396,7 +2431,7 @@ export class CommunityUI {if (retryable) {this.statusPill.setAttribute('tabindex', '0');this.statusPill.setAttribute('role', 'button');- this.statusPill.setAttribute('aria-label', `Connection ${labels[state]} — activate to reconnect`);+ this.statusPill.setAttribute('aria-label', `Connection ${this.statusText.textContent}. Activate to reconnect.`);this.statusPill.title = 'Reconnect';} else {this.statusPill.removeAttribute('tabindex');diff --git a/src/game/coincommunities.css b/src/game/coincommunities.cssindex 90c445c5d..eaf493a6c 100644--- a/src/game/coincommunities.css+++ b/src/game/coincommunities.css@@ -632,6 +632,7 @@ html[data-bg="transparent"] #cc-lobby {display: flex; flex-direction: column;}.cc-card:hover { transform: translateY(-3px); border-color: var(--cc-edge-hi); box-shadow: var(--cc-shadow); }+.cc-card:focus-visible { outline: none; transform: translateY(-3px); border-color: #fff; box-shadow: 0 0 0 1px #fff, var(--cc-shadow); }.cc-card-img { aspect-ratio: 16/10; background: var(--cc-bg2) center/cover no-repeat; position: relative; filter: saturate(0.96) contrast(1.03); transition: filter 0.25s ease; }.cc-card:hover .cc-card-img { filter: saturate(1.12) contrast(1.05); }.cc-card-img::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 45%, rgba(6, 6, 7, 0.92)); }@@ -1076,6 +1077,8 @@ html[data-bg="transparent"] #cc-lobby {background: var(--cc-panel); border: 1px solid var(--cc-edge);transition: background 0.15s, border-color 0.15s, transform 0.08s;white-space: nowrap;+ /* Rendered as a <button> now: neutralize the UA button font/cursor. */+ font: inherit; cursor: pointer; text-align: left;}.cc-adventure:hover { background: rgba(255, 255, 255, 0.06); border-color: var(--cc-edge-hi); transform: translateY(-1px); }.cc-adventure:active { transform: translateY(1px); }