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.

feat: cloudrun GCS FUSE fix, WalkState schema, cosmetic preview pin

nirholas4d419d319daa
diff --git a/deploy/world/cloudrun.yaml b/deploy/world/cloudrun.yaml
index f2ff74355..8985a59f0 100644
--- a/deploy/world/cloudrun.yaml
+++ b/deploy/world/cloudrun.yaml
@@ -30,10 +30,8 @@ spec:
run.googleapis.com/cpu-throttling: "false"
# Gen2 execution environment is required for GCS FUSE volume mounts.
run.googleapis.com/execution-environment: gen2
- # GCS FUSE mount — the world/ persistence volume (SQLite + assets).
- run.googleapis.com/volumes: >-
- [{"name":"world-data","gcs":{"bucket":"world-three-ws-data","readonly":false}}]
spec:
+ serviceAccountName: hyperfy-world-sa@aerial-vehicle-466722-p5.iam.gserviceaccount.com
# One game-world process; many long-lived WebSocket connections per instance.
containerConcurrency: 1000
# WebSocket connections stay open for the session. Cloud Run supports long
@@ -47,16 +45,24 @@ spec:
env:
- name: NODE_ENV
value: production
- - name: PORT
- value: "3000"
+ # WORLD is the directory name joined onto the server's rootDir (/app/).
+ # Mounting the GCS bucket at /app/world makes WORLD=world resolve there.
+ - name: WORLD
+ value: world
- name: DOMAIN
value: world.three.ws
- name: PUBLIC_WS_URL
value: wss://world.three.ws
- name: PUBLIC_API_URL
value: https://world.three.ws
- - name: ASSETS_DIR
- value: /world/assets
+ # Save world state to disk every 30 seconds.
+ - name: SAVE_INTERVAL
+ value: "30000"
+ - name: PUBLIC_MAX_UPLOAD_SIZE
+ value: "100"
+ # Store assets locally (in the world dir, served via PUBLIC_API_URL).
+ - name: ASSETS
+ value: local
- name: ASSETS_BASE_URL
value: https://world.three.ws/assets
- name: JWT_SECRET
@@ -69,8 +75,9 @@ spec:
cpu: "2"
memory: 2Gi
volumeMounts:
+ # Mount the GCS bucket at /app/world so WORLD=world resolves correctly.
- name: world-data
- mountPath: /world
+ mountPath: /app/world
startupProbe:
httpGet:
path: /status
@@ -84,6 +91,13 @@ spec:
port: 3000
periodSeconds: 30
failureThreshold: 3
+ volumes:
+ - name: world-data
+ csi:
+ driver: gcsfuse.run.googleapis.com
+ readOnly: false
+ volumeAttributes:
+ bucketName: world-three-ws-data
traffic:
- percent: 100
latestRevision: true
diff --git a/src/game/community-net.js b/src/game/community-net.js
index 7b0c7d800..7a96be056 100644
--- a/src/game/community-net.js
+++ b/src/game/community-net.js
@@ -10,6 +10,7 @@
// untouched.
import { Client, getStateCallbacks } from 'colyseus.js';
+import { WalkState } from '../../multiplayer/src/schemas.js';
const ROOM_NAME = 'walk_world';
const RECONNECT_BASE_MS = 3000;
@@ -171,7 +172,7 @@ export class CommunityNet {
options.holderPass = this.holderPass;
options.holderMinUsd = this.holderMinUsd;
}
- const room = await this.client.joinOrCreate(ROOM_NAME, options);
+ const room = await this.client.joinOrCreate(ROOM_NAME, options, WalkState);
if (this._destroyed || gen !== this._connectGen) {
try { room.leave(); } catch {}
return;
diff --git a/src/game/iso-game.js b/src/game/iso-game.js
index d14949c65..c63604ba6 100644
--- a/src/game/iso-game.js
+++ b/src/game/iso-game.js
@@ -174,9 +174,21 @@ class GamePlayerView {
// rig. Both local player and peers render their equipped look.
this._cosmeticId = player.cosmeticId || '';
this._cosmeticHandle = null;
+ // Wardrobe try-before-equip (local player only): the server-authoritative
+ // equipped id, plus a non-null pin that overrides it while previewing a look
+ // before committing, so movement patches don't snap the preview back.
+ this._serverCosmeticId = this._cosmeticId;
+ this._cosmeticPin = null;
this.setAvatar(player.cosmetic || '');
}
+ // Preview a look locally with no server round-trip. `id` is a cosmetic id (or ''
+ // for the default look); null clears the preview and reverts to the equipped id.
+ previewCosmetic(id) {
+ this._cosmeticPin = id;
+ this.setCosmetic(id == null ? this._serverCosmeticId : id);
+ }
+
setAvatar(url) {
const next = url || AVATAR_DEFAULT;
if (next === this._avatarUrl) return;
@@ -243,7 +255,8 @@ class GamePlayerView {
// The equipped cosmetic is server-authoritative for everyone (including us,
// after an equip round-trips), so peers AND the local player track it here.
// setCosmetic self-guards, so it's a no-op until the equipped id changes.
- this.setCosmetic(player.cosmeticId || '');
+ this._serverCosmeticId = player.cosmeticId || '';
+ this.setCosmetic(this._cosmeticPin != null ? this._cosmeticPin : this._serverCosmeticId);
// Mark when the server says we moved so the loop can settle us to idle on
// arrival without waiting for a separate motion patch.
if (moved) this._movedAt = performance.now();
@@ -1490,7 +1503,7 @@ export class IsoGame {
// a cosmetic id or '' (default look); null clears the preview. Local-only —
// peers see nothing until the player actually equips (server-authoritative).
_previewLocalCosmetic(id) {
- this.players.get(this.myId)?.previewCosmetic(id);
+ this.players.get(this.myId)?.previewCosmetic?.(id);
}
// ---------------------------------------------------------------- marketplace (Task 20)
diff --git a/src/walk-net.js b/src/walk-net.js
index e653b9621..5c21af30d 100644
--- a/src/walk-net.js
+++ b/src/walk-net.js
@@ -13,6 +13,7 @@
// (handled in walk.js).
import { Client, getStateCallbacks } from 'colyseus.js';
+import { WalkState } from '../multiplayer/src/schemas.js';
const ROOM_NAME = 'walk_world';
const SEND_HZ = 15;
@@ -152,7 +153,7 @@ export class WalkNet {
coinSymbol: this.coinSymbol,
coinImage: this.coinImage,
...(presence ? { presence } : {}),
- });
+ }, WalkState);
if (this._destroyed || gen !== this._connectGen) {
try { room.leave(); } catch {}
return;