Skip to content
Work in progress. These docs describe Spawnite at launch, and some parts are still being built.

Assets

The platform keeps a library of shared assets on its CDN. spawnite add asset <id> adds one to a game. A model is measured as it lands: the command bakes the game’s public/assets/ folder into src/models.json and registers the model from it through the game’s src/models.ts, with no size to type. Entity says how a walker reads that manifest. Each entry also keeps the corners of the model’s convex hull, and the collider the model stands as on the page and in a room alike, which Entity describes. A manifest that no page registers from, such as the kit’s, sets hullPoints: false there to leave them out. A particle effect lands in src/particles/<id>.json instead, with its sprites inside it, and the command prints the import and the call that plays it, as Particles says.

A sprite sheet lands in src/sprites/<id>.png with its .json data, and its .px.js pxl source where it has one. A tile set lands in src/tiles/<id>.png with its .tsj. For either, the command prints the defineSpriteSheet or defineTileSet lines to paste, as Sprites says. The MCP’s add_asset tool does the same for an agent.

spawnite add asset also writes the file’s license, author and credit into the catalog.json beside it: public/assets/catalog.json, or the catalog.json in src/particles/, src/sprites/ or src/tiles/ for an effect, a sheet or a tile set. The file keeps the rows already in it, and its rows have the shape Publish an asset shows, so a game records where each of its files came from.

A template copies cc0 and platform files into a new game, such as the arena’s rocks. A platform file keeps its terms in the new game, as The platform license says, and the template’s catalog carries its row. A file whose row names any other license, in the game’s catalog.json or in the library’s for a copy of a library file, stays in the game it belongs to, and the template’s catalog drops its row.

Every file a template carries as bytes needs a row: a model, a picture, a sound, a data file under public/, and a particle effect. The registry’s build refuses a template file with no row, and names the catalog to add it to. A file’s row sits in a catalog.json in any folder above it, and the nearest one that records the file wins. A new row goes where spawnite add asset writes, else in the nearest catalog above the file, else in one beside it, so public/favicon.ico takes its row in public/catalog.json. Source and Markdown files need no row.

A game can also name a shared file without copying it. @spawnite/assets exports each of the team’s files by name from its kind’s entry: @spawnite/assets/avatars, animations, models, textures and sounds, such as treeTall from models for tree-tall.glb. Each name is the file’s URL on the CDN, under the SHA-256 of its bytes, so it goes wherever the engine or three.js takes a URL, and no game’s deploy carries a copy. The engine loads its own defaults the same way: its clips, its ground textures and the models it scatters. A published page and a test that loads a shared file need https://assets.spawnite.com reachable.

A dev server, in pnpm dev and spawnite play, serves each shared file from a cache on your disk under its own path, /__spawnite/assets/<sha256>.<ext>, and fetches it from the site only the first time: a game loads offline once it has run online, apart from the URLs listed two sentences on. Install says where the cache lives and how to move it. The dev server points each whole shared URL written in a module, a stylesheet or the page at that path; a URL your code builds at run time, one in a file under public/, and one that arrives in fetched JSON or from a room still load from the site. Treat a shared URL as something to load, never as a key or data you send, since the page holds the local path while a room holds the real one. The package’s README lists the entries and each license.

The manifest at the CDN’s assets/index.json carries, for each asset, its id, kind (model, avatar, clip, texture, sound, particle, sprite-sheet or tile-set), size, sha256 and URL. It also carries its name, category (characters, animals, nature, buildings, props, vehicles, textures, skies, sounds, animations, effects, sprites or tiles), tags and style (low-poly, stylized, realistic or pixel), and the pack it belongs to, where its file sits in a folder under its kind’s. Then comes what the file itself tells: a model’s or an avatar’s triangles, clip names, whether it is rigged and its bounds in metres, a clip’s names, a texture’s resolution in pixels and, where recorded, the width in metres its tile covers, a sound’s length in seconds, and whether a particle effect loops.

A sheet or a tile set carries its image’s size, a sheet its clip names, and both the pixels per metre its row sets, as pixelsPerMetre. Each also lists its companions: each file that lands beside its image, by its suffix, with its own URL and sha256.

Each asset also carries the following fields, which say where you may use it and whom to credit:

  • licence: the field’s name keeps the British spelling. Its value is a lowercase id, cc0, cc-by, cc-by-sa, cc-by-nc, royalty-free, platform, custom or unknown, never an SPDX name such as CC0-1.0.
  • terms: the https URL of the license’s text, such as the Creative Commons deed and its version. A cc-by license, royalty-free and custom carry it.
  • author: who made the asset, a person or a studio, with a link where there is one. A cc-by license carries it.
  • page: the page the file was taken from, kept after it is copied.
  • credit: the one line a game shows for the asset, such as “Wooden Crate 01 by James Ray Cock from Poly Haven, CC0”. A game’s credits screen reads each row’s credit from its catalog.json.

A particle effect’s entry also carries a thumbnail URL: a picture of the effect playing, which the publish renders. A sheet’s thumbnail is its first frame, and a tile set’s its whole image, each scaled up by whole pixels. The hand-written fields come from a catalog.json, one row per file, and the publish refuses a file with no row.

Search the store, your game and Poly Haven

Section titled “Search the store, your game and Poly Haven”

spawnite assets list [query] searches three sources in one list: the store’s manifest, your game’s own public/assets/, src/particles/, src/sprites/ and src/tiles/ folders, and Poly Haven’s CC0 models and textures. Each line starts with its source, store, game or poly-haven, then the address spawnite add asset takes, and ends with the credit line and the command that adds the asset. list_assets in the MCP takes the same query and filters.

$ spawnite assets list "treasure chest"
store treasure-chest model Treasure chest props platform 4787 triangles Treasure chest by Spawnite, free on Spawnite spawnite add asset treasure-chest
poly-haven poly-haven/treasure_chest model Treasure Chest props cc0 103330 triangles Treasure Chest by Rico Cilliers from Poly Haven, CC0 spawnite add asset poly-haven/treasure_chest

The list holds the following, in this order:

  1. The store’s rows, the best matches first: a word that starts the name ranks over one that starts a word of the name, over a tag, over the category, pack, author or id, and every word of the query must match.
  2. Your game’s rows, ranked the same way. A file with no row in its folder’s catalog.json lists under its file name with the license unknown.
  3. Poly Haven’s rows, in Poly Haven’s own order, which matches by meaning. Poly Haven joins only a search with words.

A team account has the first ten rows, taken in turn from each source, reordered by meaning; every other search keeps this order. The filters --kind, --category, --pack, --style, --licence, --author, --rigged and --animated narrow the list, --source searches one source, and --assets names another manifest. A source that does not answer is named with its reason, and the rest still list. When nothing in the store or your game fits, the reply says so above Poly Haven’s rows: bring one in from Poly Haven, or make one with spawnite model make.

The asset store shows the same manifest: search, the category and filter chips, and each asset’s page with a live viewer, its facts, its credit line and the command that adds it. The asset store design page holds its rules. An agent reading this page through read_wiki calls list_assets in the MCP for the same list, with a query and filters.

The manifest holds every published asset: the team’s, and each one a creator published with spawnite assets publish. Search it before you fetch, model or draw anything, because a game that names a library asset needs no manual download. Check the license spawnite assets list prints for each file before you use it: cc0 is free for any use, and platform is free in a game that runs on the Spawnite engine and never shared on its own, as The platform license says. A few carry other terms, which their terms link names: 7 animations are royalty-free under Mixamo’s terms, and 2 avatars are custom under their maker’s.

A platform file is one its owner offers to every game that includes or requires the Spawnite engine to be played. The owner is the licensor the Spawnite License names, for the team’s files, and the account that published the file, for a creator’s. Anyone who gets a copy, from anywhere, gets it from the owner on these terms and no others:

  • Use. You may use the file and change it to make, test and run a game, as the Spawnite License defines the word, that includes or requires the Spawnite engine to be played. The people and services working for you may do the same, and you may give them copies for that work. The game may be free or paid, and the file is free, with no royalty and no credit required.
  • Where it goes. The file goes with the game wherever the Spawnite License lets the game go: through Spawnite, under a written license from the licensor, or anywhere once the license’s If Spawnite Stops Hosting Games takes effect. It goes nowhere else, so a port that no longer includes or requires the engine leaves it behind.
  • Copies. A copy, changed or not, may travel in the game’s source, in a public repository too, and in a template a new game starts from. Whoever passes a copy on in source or in a template keeps its catalog.json row with it. The game’s own license, such as MIT-0, does not reach the file.
  • Changed copies. A changed copy stays under these terms, whoever changed it. You keep the rights in what you add, such as a texture you painted.
  • Pictures and video. Screenshots, recordings, trailers and store pages that show the file in the game are free to share.
  • Not allowed. No one but the owner may sell, license or share the file, or a changed copy, on its own or in anything that is not a game, such as an asset pack or an asset store. A template whose main value is platform files counts as an asset pack.
  • How long. These terms, version 1.0, never end or narrow for a copy you already have. A breach ends them only when it is not put right within 32 days of notice. The owner keeps whatever rights it has in the file. As far as the law allows, the file comes as is, without any warranty.

@spawnite/assets exports each of the team’s files by name. 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.

The package also exports the following data:

  • @spawnite/assets/avatars.json holds each body’s record under its file’s name: everything a VrmBody holds but the URL, which the game adds.
  • @spawnite/assets/models.json holds each model’s measurements under its id: its bounds, its collider and, where it has one, its hull, with path the model’s URL.
  • @spawnite/assets/particles/<file>.json is a particle effect for the engine’s Particles, imported as JSON with its sprites inside it.
// Excerpt of src/avatars.ts
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.

The engine names its grounds and its skies. You change either one by name, before you fetch any file.

The map sets the ground. A <Landscape> with no map stands on grid, a grey floor 8 m across. <Landscape map="meadow"> stands on hills of textured grass. Landscape describes both.

A map paints its ground from 14 named materials, such as grass, dirt, sand, snow and stone. Use the following commands to lay and change them:

To do this Run this
Paint one dab spawnite map terrain paint --map meadow --material sand --at 0,0 --radius 6
Fill a region spawnite map terrain fill --map meadow --material stone --where "region=rollingField"
Change how a material looks everywhere spawnite map material grass --tint '#8fbf5a' --tile 3
Make a new material from an existing one spawnite map material lava --from rock

To swap the hand-painted textures for photographed ones, set "set": "photographed" in the game’s src/maps/materials.json. snow and ice keep their hand-painted textures.

To use a texture you fetched, put the file in public/assets/ and name it in a material’s texture field:

"moss": { "from": "grass", "texture": "/assets/moss.webp" }

The texture field takes the colour image only, so the material draws without bumps of its own. The map editor lists every field.

The look sets the sky. The engine has five: noon, morning, dusk, night and overcast. Import one from @spawnite/engine/looks/<name> and pass it to the Landscape, as <Landscape look={dusk}>. Each look brings its own fog.

Each look lights the scene from the engine’s own sky, so it adds nothing to the download. To light the scene from an HDRI you fetched instead, name it as the look’s environment image, as look={{ base: noon, environment: { image: { file: "/assets/sky.hdr", sunU: 0.25 } } }}. sunU is the column of the image where the sun stands, from 0 to 1. Looks describes the image.

When the store has nothing that fits, bring a model or a texture in from Poly Haven with spawnite add asset, or take an asset from another CC0 source by hand.

spawnite add asset poly-haven/<slug> brings in the Poly Haven asset whose address spawnite assets list printed, at 1K. The MCP’s add_asset takes the same address. It writes the following into your game:

  • A model: its glTF and every file it loads, each checked against the md5 Poly Haven lists, packed into one public/assets/<id>.glb, then baked and registered as a store model is.
  • A texture: its colour map as public/assets/<id>.webp, and its normal and height packed into public/assets/<id>-detail.webp, in the format of the engine’s own ground detail textures. A map material’s texture field takes the colour image, as Change the ground says. No material field names the detail image yet, so the game keeps it for when one does.
  • A row for each file in public/assets/catalog.json: the license cc0, the author, the Poly Haven page and the credit line.

The id is the slug in kebab-case, such as wooden-crate-01. Nothing is written until every file has downloaded and checked out. Poly Haven’s skies are not in the search yet: take one by hand from the table below.

Take the asset from a source whose files are CC0, free for any use with no attribution required. The following sources serve CC0 files, most of them to a terminal with no browser and no sign-in; the table names each that needs a browser:

Source What it has How to fetch with curl
Poly Haven HDRI skies https://api.polyhaven.com/assets?t=hdris lists the skies. https://api.polyhaven.com/files/<asset> lists each file of one with its URL; take the URL from that list, since file names vary.
ambientCG PBR ground and surface materials, HDRI skies https://ambientcg.com/api/v2/full_json?type=Material&include=downloadData lists the materials and their zips, such as https://ambientcg.com/get?file=Bricks097_1K-JPG.zip. The zip link redirects, so pass curl -L.
Kenney Low-poly model kits, textures, UI art, sounds No API: each pack’s page holds one zip link. curl -s https://kenney.nl/assets/<pack> | grep -oE 'https://kenney.nl/media/[^"]+\.zip' prints it.
Poly Pizza Low-poly models as GLB, CC0 and CC-BY mixed Each model’s page holds its license, as "Licence":"CC0 1.0", and its GLB link on static.poly.pizza. Take a model only when its page says CC0. The API needs a key from an account, and the terms forbid scraping.
Quaternius Low-poly model packs: nature, characters, monsters Each pack’s download is a Google Drive folder, which needs a browser, so ask your user to fetch the pack, or take a model from another source.

Take the following steps to bring an asset in:

  1. Fetch the file at the smallest size that looks right: a 1K texture or a 1K HDRI. The library’s ground textures are 1024 pixels square, from 12 KB to 557 KB as WebP, and its five skies are 1K HDRIs of 1.4 to 1.9 MB.
  2. Convert it to a format the platform takes: a model to .glb with its textures inside, a texture to .webp, and a sound to a mono .mp3, such as ffmpeg -i hit.ogg -ac 1 -codec:a libmp3lame -b:a 96k hit.mp3. The library’s short sounds weigh 1.5 to 40 KB as mono MP3s. A sky stays an .hdr, which the publish does not take: put it in the game’s public/ folder, and a look’s environment.image names it, as Looks says.
  3. Check it: a model with spawnite model check, as Models says, and a sound with spawnite sound check, as Check a sound for hiss says.
  4. Write its row in the folder’s catalog.json with the license cc0, the author who made it and the page you took it from, as Publish an asset shows.
  5. Publish it with spawnite assets publish, so the next game finds it in the library rather than on the web. A sky stays in the game.

A recording can carry a constant noise under it, such as a microphone’s hiss, or be nothing but noise, such as a wind recording that turns out to be a hiss. spawnite sound check <files...> reads sound files with the installed ffmpeg, in any format a source ships, and prints each one’s length, peak, loudness, and the level and spectral flatness of its quietest tenth. It measures each channel on its own and reports the noisiest. The MCP’s check_sound tool does the same:

$ spawnite sound check fire-crackle.mp3
fire-crackle.mp3: 60.06 s, peak 0.1 dBFS, loudness -50.1 dBFS, quietest tenth -57.7 dBFS at flatness 0.77.
It carries a constant noise: its quietest tenth is louder than -65.0 dBFS and as flat as broadband noise, at 0.6 or more. Take another recording, or clean this one with ffmpeg's afftdn filter and check it again.

Flatness runs from 0 for a pure tone to 1 for white noise. The check measures it below 11 kHz, under the cut an MP3 encoder makes, where white noise reads 0.80, pink noise 0.71, brown noise 0.47, and the quiet of crickets or steam 0.33. A sound of 1 s or more carries a constant noise when its quietest tenth is both louder than −65 dBFS and at a flatness of 0.6 or more. The check does not judge a shorter sound, because the quietest tenth of a hit or a step is its own decay.

ffmpeg -i fire-crackle.mp3 -af afftdn fire-clean.mp3 takes the fire above to a quietest tenth of −68.0 dBFS, which passes. A sound that is all noise stays noise after cleaning, so take another recording. With no ffmpeg on the PATH, the check prints the command that installs it.

You can add your own model, avatar, animation clip, texture, sound or particle effect to the shared assets, so any game on the platform adds it with spawnite add asset. Publishing needs a sign-in: run spawnite login first.

Take the following steps:

  1. Put the file in a folder. A model is a .glb, an avatar a .vrm, a clip a .vrma, a texture a .webp, a sound an .mp3 and a particle effect the .json the three.quarks editor exports. A .glb or .vrm is at most 50 MB, an effect at most 5 MB, and the other types at most 20 MB. An effect that names its sprite by a file name, such as spark.png, takes that file beside it in the folder: the publish carries it inside the effect.

  2. Write the file’s row in a catalog.json in that folder, under the file’s path from the folder:

    {
    "rock-flat.glb": {
    "name": "Flat rock",
    "category": "nature",
    "tags": ["rock", "stone"],
    "style": "low-poly",
    "licence": "cc0",
    "author": { "name": "Max" }
    }
    }

    The name, category and license are required. The license is one of the following ids:

    • cc0: free for any use.
    • cc-by, cc-by-sa or cc-by-nc: a Creative Commons license that credits its author. The row names the author and terms, the https URL of the license’s deed, such as https://creativecommons.org/licenses/by/4.0/.
    • royalty-free: free in a game, not for resale on its own, under the conditions terms links.
    • platform: free to use, change and ship in a game that runs on the Spawnite engine, wherever the Spawnite License lets that game go, and never sold or shared on its own. Publishing a file as platform offers it to every such game, for good, on the terms The platform license gives.
    • custom: the maker’s own conditions, which terms links.
    • unknown: nobody recorded the license.

    author names who made the asset, with an optional https url, and page the page you took the file from. The publish writes the credit line from the name, the author and the license, such as “Flat rock by Max, CC0”; set credit in the row to write your own.

  3. Run spawnite assets publish rock-flat.glb, or name the folder to publish every file in it. The MCP’s publish_assets tool does the same for an agent.

The command prints the asset’s id, such as flat-rock-48201973: its name as a slug, then a number the platform draws, so two assets never share an id. The store and spawnite assets list show the asset within a minute.

The platform checks each file before it is public, and refuses one that fails with the reason:

  • A model, an avatar or a clip must be a glTF Binary file that holds everything it uses. A file that loads a buffer or an image from another address is refused, so export with every texture embedded.
  • A texture must be a WebP image that decodes, every frame of it. The platform removes its EXIF and XMP, which can hold a name or a place.
  • A sound must be an MP3. The platform removes its ID3 tags, which can hold a name or a picture.
  • A particle effect must be three.quarks JSON whose sprites decode. Before it sends anything, the command plays the effect in headless Chromium, which refuses a file three.quarks cannot parse, and keeps a picture of it in the air as the store’s preview. A sprite named by a file that is not beside the effect, or loaded from a site, is refused, and so is an effect past the limits that Sharing an effect lists.
  • A file of any other type is refused by its content, whatever its name says.

A sprite sheet or a tile set reaches the store from the platform’s own library for now: the publish refuses one, and it stays in your game’s src/sprites/ or src/tiles/.

An account publishes at most 100 assets a day, a refused file among them, and each asset counts against the account’s 10 GB of storage. Publishing the same file again sends nothing and prints the id it already has.