FERRETGame engine over Babylon.js
Ferret

Building a scene from the library

Skill ferret-scene-from-library · download all skills · SKILL.md

When to use#

Before anything is modelled, generated, imported or programmed. The whole way of a scene, and loading an item (AssetLibrary, never an unpacked .ferret): reference/scene-recipe.md.

The rule#

  1. Look it up. The library is English only (tags, descriptions, rubric names): translate the request yourself ("лес" is forest); the commands do not translate.
  2. In the library and no new one was explicitly asked for: take it.
  3. Absent, or a new one was explicitly asked for: make it, and add it to the library when it is reusable.
  4. Never ask for permission to model, nor which of two library items: pick by the cards and previews; the frame corrects it.

Versions, uids, descriptions#

  • An asset has a uid (issued by the library at the first submission; the assets of the first library keep their ids as uids), tags and a short English description. New assets have no names.
  • The library issues the version: 1.0.0 first, then 1.1.0, 1.2.0 ... for each accepted new variant of the same uid. Old versions stay; a new one may hold fewer items.
  • A scene refers to id@version. No version means 1.0.0, never the latest: a new version never changes a made scene; cards list versions. One version of a package is open at a time in a running scene.

The REST API#

Base https://builder.ferret3d.com/ferret/library/, plain HTTP; there is no other interface.

  • Search GET api/search?q=&type=&rubric=&tags=&limit=&offset=: ranked, paged (X-Total-Count). One thing a query (race car, tree). Read the cards and pick.
  • Card GET api/item/<id>[@version]. Catalog GET catalog.json; files GET c/<hh>/<file>, GET previews/<file> (no sign-in): what the engine's AssetLibrary reads.
  • Rubrics GET api/rubrics.
  • Add or update POST api/item[?uid=<uid>&description=<English>&rubric=<path>], Authorization: Bearer <SW session of the person>, body: a .ferret package, or a zip of package.ferret [+ tiers/<tier>.ferret] [+ preview.webp]. The answer carries the uid and version issued; to update an asset send its uid back. English only: Cyrillic is refused. The moderator's items go straight in, others' wait in incoming/ (an update sent while the earlier waits replaces it; once accepted it is a new version of the same uid). Moderator: GET api/incoming, POST api/incoming/<id>/accept|reject.

Steps#

  1. Write into the scene's plan what it is built from (skills; assets and mechanisms as id@version).
  2. Search each need; read the cards; take the pick by id@version.
  3. A thing that is absent: make it (ferret-models, ferret-humans, ferret-terrain), POST it with description, tags, rubric.
  4. A mechanism: search with type=module. Absent: a module in the game language (ferret-motion) with its own test, not scene TypeScript. A reusable one goes in as a module item (a .ferret of kind library); if your tools cannot pack one, keep its folder complete and say so.
  5. A new action of a model, unless particular to this game, goes into the model (ferret-models).
  6. The scene is data and programs; check each part by its own test; the final frame (ferret-frame-check). At each stage's end write the state into the plan.

What usually goes wrong#

  • Modelling first, searching later; asking "shall I model it?"; searching in Russian.
  • A made asset left only in the scene or in the repository.
  • A reference without a version taken for "the latest" (it is 1.0.0); an update sent without its uid (refused, with the uid to send).

Files#

  • reference/scene-recipe.md — The way a scene is built from ready parts: assets and mechanisms from the library, the scene as data and programs in the game language, changes seen live, facts checked by probes and tests, one final frame, and the state written into the scene's plan.