@spawnite/assets
v0.1.0-beta.18
Published
The shared 3D models, motions, textures, sounds and particle effects.
Readme
@spawnite/assets
The shared models, avatars, animation clips, textures, sounds and particle effects of Spawnite. A game imports a file by name from its kind's entry, and the name holds the file's URL:
import { fris } from "@spawnite/assets/avatars";
import { idle, turnLeft } from "@spawnite/assets/animations";Install
A game that spawnite create writes from a template that names a shared file already depends on the package. To add it to another game:
pnpm add @spawnite/assetsEntries
Five entries cover the five kinds a game loads by URL:
| Entry | Files |
| ----------------------------- | ------------------------------------------------- |
| @spawnite/assets/avatars | VRM bodies (.vrm) |
| @spawnite/assets/animations | VRM animation clips (.vrma) |
| @spawnite/assets/models | glTF models (.glb) |
| @spawnite/assets/textures | textures and HDR skies (.webp, .ktx2, .hdr) |
| @spawnite/assets/sounds | sounds (.mp3) |
A file's name is the camelCase of its id, the file's name without its extension: boss.glb is boss, and turn-left.vrma is turnLeft. Each name is a string, so it goes wherever the engine or three.js takes a URL, beside a game's own ?url import. spawnite assets list prints each shared asset with its id, but for the .ktx2 and .hdr files, which no store page shows.
Where the files come from
The package holds no file. Each name is the file's URL on https://assets.spawnite.com, under the SHA-256 of its bytes, such as https://assets.spawnite.com/assets/9c1e….glb. The site serves each file for a year as immutable, so a game names the same bytes for as long as it pins a version of the package, and no game's deploy carries a copy.
A page that loads a shared file needs https://assets.spawnite.com reachable: a published game and a test that loads a file. A dev server, in pnpm dev and spawnite play, keeps each file in a cache on your disk after its first load, so a game loads offline once it has run online; the install page says where the cache lives. Allow the host in a sandbox that lists the hosts an agent may reach. A published game's page loads from it under the platform's content policy, and a game's own deploy allows it in the policy roomsContentPolicy writes.
Data
@spawnite/assets/avatars.jsonholds each body's record under its file's name: everything aVrmBodyholds but the URL, which the game adds.@spawnite/assets/models.jsonholds each model's measurements under its id: its bounds, its collider and, where it has one, its hull, withpaththe model's URL.@spawnite/assets/particles/<file>.jsonis a particle effect for the engine'sParticles, imported as JSON with its sprites inside it.
import records from "@spawnite/assets/avatars.json";
const body: VrmBody = {
...(records.fris as Omit<VrmBody, "model">),
model: fris,
};The cast is there because JSON types a bone name as a plain string.
Licences
This package's own files are under the Spawnite License in LICENSE.md. Each shared file keeps the licence spawnite assets list prints for it:
cc0: free for any use, with no attribution.platform: made for Spawnite; free in any game on the platform, and nowhere else.mixamo: an animation from Mixamo, under Adobe's terms: royalty-free in a game, with no right to redistribute the file itself.vroid: an avatar from VRoid Hub, under the terms its author set.unknown: a file whose licence nobody recorded.
