Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4.1.4
uses: actions/checkout@v6
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
uses: docker/metadata-action@v6
with:
images: ghcr.io/${{github.repository}}
tags: |
Expand All @@ -36,11 +36,11 @@ jobs:
type=ref,event=pr
type=sha,format=long
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
uses: docker/setup-qemu-action@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
uses: docker/setup-buildx-action@v4
- name: Build and push
uses: docker/build-push-action@v6
uses: docker/build-push-action@v7
with:
platforms: linux/amd64,linux/arm64
push: true
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/static-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- uses: actions/setup-node@v4
- uses: actions/setup-node@v6
with:
node-version: 22
cache: npm
Expand Down
25 changes: 15 additions & 10 deletions src/client/world-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,25 @@ export function Client({ wsUrl, onSetup }) {
wsUrl = wsUrl()
if (wsUrl instanceof Promise) wsUrl = await wsUrl
}
const config = { viewport, cssLayer, ui, wsUrl, baseEnvironment }

// For offline/static mode, compute an absolute base URL so assets
// resolve correctly on sub-paths (e.g. GitHub Pages at /hyperfy/).
// resolveURL() passes https:// URLs through unchanged; bare filenames
// and absolute paths both break at sub-paths.
const base = wsUrl ? null : new URL('./', location.href).href

if (base) {
baseEnvironment.model = `${base}base-environment.glb`
baseEnvironment.hdr = `${base}Clear_08_4pm_LDR.hdr`
}

const config = { viewport, cssLayer, ui, wsUrl, assetsUrl: base ? `${base}assets` : undefined, baseEnvironment }
onSetup?.(world, config)
await world.init(config)

// Offline bootstrap: deserialize empty defaults, spawn a local
// player, and load the base environment so the world is usable.
if (!wsUrl) {
// Set assetsUrl so asset:// protocol resolves (e.g. avatar.vrm)
world.assetsUrl = 'assets'
world.settings.deserialize({})
world.collections.deserialize([])
world.blueprints.deserialize([])
Expand All @@ -76,15 +86,10 @@ export function Client({ wsUrl, onSetup }) {
enteredAt: Date.now(),
},
])
// Load environment model and HDR sky in parallel
const [glb, hdr] = await Promise.all([
world.loader.load('model', 'base-environment.glb'),
world.loader.load('hdr', 'Clear_08_4pm_LDR.hdr'),
])
// Load ground model (sky/HDR handled by ClientEnvironment via baseEnvironment.hdr)
const glb = await world.loader.load('model', `${base}base-environment.glb`)
const root = glb.toNodes()
root.activate({ world })
hdr.mapping = THREE.EquirectangularReflectionMapping
world.stage.scene.background = hdr
}
}
init()
Expand Down