Onceworlds
Engine · Library

Asset library

Ready-made models, sprites, textures, sounds and music by name (Library.model).

The engine has a library of ready-made assets, all made in code in one consistent style: 145 low-poly 3D models, 88 2D sprites (10 animated characters, items, 32 UI icons, tiles and a tile set, background layers, effects), 15 textures, 16 looks (palettes with matching light), 72 sounds and 10 music loops. No files, no downloads, nothing to host: an asset is made the first time something draws it. Use it whenever the game has no art of its own: it looks better than shapes made by hand, and costs one line. The full reference (every option, every id) is "Asset library" in the API reference.

import { Transform } from '@onceworlds/engine';
import { Library, SpriteAnim } from '@onceworlds/engine/modules';

// 3D: a model where the Transform puts it, standing on y = 0, facing -z.
world.spawn([Transform({ position: [4, 0, -2] }), ...Library.model('tree.pine', { height: 6 })]);
world.spawn([Transform({ position: [0, 0, 0] }), ...Library.model('crate', {}, { body: 'dynamic' })]);   // with physics
world.spawn([Transform({ position: [2, 1, 0] }), ...Library.model('coin', {}, { collider: 'sensor' })]);  // a pickup trigger
Library.scatter(world, 'tree.oak', { count: 30, area: [80, 80], avoid: [[0, 0, 10]] });              // a forest, few draw calls
Library.backdrop(world, 'meadow');                                    // sky, sun with shadows, ambient light and fog in one look

// 2D: a sprite the size it should be; a character plays its clips (idle, run, jump, fall, hurt).
const hero = world.spawn([Transform({ position: [0, -2, 0] }), ...Library.sprite('char.knight')]);
hero.get(SpriteAnim).clip = 'run';
Library.backdrop(world, 'forest');                                    // in a 2D world: parallax background layers

// Sound: the catalog's names play like the built-in effects; loops by mood.
audio.play('coin.chime');
audio.music.play('music.adventure');

The rules that keep it looking good

Finding assets

3D in more detail

2D in more detail

Sound and music

In tests

Geometry and pictures are made by code that loads the first time a game draws a library asset (so a game that uses none downloads none of it). Game logic never waits for it: names, sizes and colliders are there at once. A test that reads geometry or draw lists calls await Library.load() first.