Change the level
Goal
The game renders your own gaussian-splat environment, collides with your own collision mesh, and spawns the player, the enemies and the pickups where you want them.
Files you will edit
src/assets.jsonsrc/arena.ts
Steps
Point the manifest at your world. Drop the files in
public/— Vite copies that directory verbatim — and give them ids. The id is the contract; game code never sees a path.diff// src/assets.json { "version": 1, "baseUrl": "/", "assets": [ { "id": "env.arena", "type": "splat", - "src": "@placeholder/arena.spz", + "src": "/levels/foundry.spz", "tags": ["world"], - "collider": { "shape": "mesh", "src": "@placeholder/arena.collider.bin", "layer": "static" } + "collider": { "shape": "mesh", "src": "/levels/foundry.collider.bin", "layer": "static" } },@placeholder/...is a template convention:src/main.tsmaps those onto the files inside@aosengine/assets-placeholder. Anything else is resolved againstbaseUrl, so/levels/foundry.spzmeanspublic/levels/foundry.spz.SPZ loads about four times faster than PLY; prefer it. The collider is a separate baked triangle mesh, because a splat has no geometry a solver can use —
parseColliderin@aosengine/assets-placeholderdocuments the format, andsrc/main.tsis where it is turned into a static body.Move the spawn points. Every
positionis on the floor, in metres, Y-up, withyawin radians about+Y(0looks down-Z); the prefab's own half-height is added when it spawns.diff// src/arena.ts export const arenaSpawns: ArenaSpawns = { - bounds: { min: [-12, 0, -12], max: [12, 3, 12] }, - player: { position: [0, 0, 9], yaw: 0 }, + bounds: { min: [-20, 0, -14], max: [20, 6, 14] }, + player: { position: [-17, 0, 0], yaw: 1.5708 }, enemies: [ - { position: [-9.5, 0, -9.5], yaw: -2.3562 }, + { position: [12, 0, -6], yaw: 3.1416 }, + { position: [12, 0, 6], yaw: 3.1416 }, + { position: [0, 0, 0], yaw: 3.1416 }, ], pickups: [ - { position: [0, 1, 0], yaw: 0 }, + { position: [-4, 1, 8], yaw: 0 }, ], };The loops in
src/game.ts'sinitwalk these lists, so adding or removing an entry changes how many things exist. Nothing else needs to know.
Verify
sh
npm testThe template ships one test asserting that src/arena.ts matches the placeholder pack's own spawn table; delete it once the level is yours, and replace it with one that matters — that every spawn point is inside bounds, for example. Then:
sh
npm run devWalk to each spawn point. You should land on the floor rather than falling through it or standing in the air: if you fall, the collider and the splat disagree about where the floor is, and the collider is what to fix.
See also
- Assets and the manifest
- Load a splat environment
- Use the placeholder assets
packages/splat/README.md— @aosengine/splat