Spielwerk 42: Bestiarium

2026-11-21
Spielwerk 42: Bestiarium - Teaser

A monster from a seed: a dog-like Vierbeiner, an upright Zweibeiner, a Wurm or a winged Flieger, its bones, its body, its colours, its walk and its attacks all made from one number. The same number always makes the same monster. It walks, runs, crawls or flies, bites, breathes fire or claws at a straw dummy, goes into a bestiary of three pages, and roams the Wildnis with a dozen others. The toolbox learns generated creatures on step 41's soft skin: skeleton templates, a part kit painted into one picture, gaits made from the body's measurements and attacks with hit areas.

Play it · Source: collection-spielwerk/42-bestiarium · Toolbox 6.3.0 or later

The game

There is nothing to win or lose. The stage shows one monster and a straw dummy.

Controls:

New in the toolbox: generated creatures

The problem. Steps 38 to 41 drew every puppet by hand: a skeleton, parts, clips, all made once in Blender. A game that wants a hundred different monsters can't draw a hundred. It needs a recipe that makes them, and the recipe has to give the same monster every time it gets the same seed, so a monster can be saved as a few numbers.

A skeleton from a template. Each kind is a template written as plain data. A Vierbeiner has a spine of 3 to 5 bones, a neck, a head with a jaw, four legs of three bones and a tail of 2 to 6. Each chain has a range for its count, its length and its angles, and the generator picks inside the ranges. Each value and each chain draws from a random stream of its own, keyed by the seed and its name. A longer tail therefore leaves the legs exactly as they were. The spine tilts so all four feet stand, a worm lies on the ground, a flier hangs in the air.

A body from a part kit. A part kit is one atlas of body parts: heads, jaws, torsos, upper and lower legs, paws, claws, hands, wings, tails and tail ends, segments, eyes, horns, ears and spikes. Each part is drawn in grey, and beside it lies a tint mask whose red, green and blue say where the three colours go. Each part has a pivot and a tip, the line that goes onto a bone. A head also names its mouth, its jaw hinge and the places for the eyes, horns and ears.

One soft skin from the parts. compose_soft_skin places every part on its bone, scales and turns it, tints it and paints it into one picture per layer: the far legs, the body, the near legs. Beside each picture it paints step 41's bone map, every pixel in the colour of the bone it follows. Parts are painted twice, whole and then without their outlines, so where a thigh meets the hip only the outline around both shows. The top of each limb is painted in its parent's colour, so it stretches with the body. Step 41's soft mesh takes the result as it is: the monster bends as one skin with no joints showing.

Movement made from the measurements. No clip is keyed by hand:

They are ordinary clips, so fades, moments and jiggle from steps 38 and 41 work on them.

Attacks with hit areas. Every attack is a clip with hit moments and an area around an anchor:

The body decides which attacks a monster has: a bite needs a jaw, a claw needs claws, and fire comes by chance, more often for worms and fliers.

const kit = this.load_kit("beasts");                  // catalogue_images: { beasts: "rendered/monster/quadruped-parts" }
// once kit.is_ready:
const monster = generate_creature("quadruped", 4711, kit);
monster.play("walk");                                  // idle, walk, run
monster.events.attach(CreatureHitEvent, (hit) => {
    const area = monster.area_now(hit.attack, x, floor_y, { scale: 0.5 });
    if (area !== null && in_area(area, dummy_x, dummy_y)) { dummy.hit(); }
});
monster.attack("bite");                                // once, then back to walking
// every frame:
monster.update(delta_seconds);
monster.draw(context, x, floor_y, { layer, scale: 0.5 });
layer.draw(context);
save(monster.data);                                    // { kind, seed, params, parts, tints, attacks }

The bestiary is plain data. A monster saves as its kind, seed, slider values, part ids, three colours and attacks. creature_from_data makes the same monster from it, pixel for pixel. A page of the bestiary is six of these in a save slot (step 35), or a JSON file.

The art. One Blender script (42-bestiarium/kit__blender/build.sh) builds every part from simple shapes in the style of steps 38 to 41. It renders each part twice, once shaded in grey with its outline and once as a flat mask, and packs them into one atlas per kind with their pivots, tips and points. The kits have 27 parts for the Vierbeiner, 31 for the Zweibeiner, 19 for the Wurm and 27 for the Flieger. They go into the asset library as rendered/monster/quadruped-parts, biped-parts, worm-parts and flyer-parts.

What it costs. Measured in Chrome on an RTX 4070 (Intel i7-11700F). Making a monster takes 14 ms for a worm and 54 ms for a Vierbeiner. That covers its skeleton, painting its parts into the skin, its clips and its attacks. Its grid adds 4 to 18 ms at its first drawing. That is one monster a frame at most, so the Wildnis makes its dozen one a frame. Roaming, 1 536 monsters still give 57 frames a second; copies share their rig, so their skin goes to the graphics card once. In headless Chromium, where WebGL runs in software, it is 57 to 72.

Tests. The toolbox's tests check the following:

The game's tests cover 200 seeds of every kind:

They also check that every attack of every kind reaches the dummy, and that a kept monster comes back with the same pixels. The browser check makes monsters of every kind, plays every movement and attack, keeps one and loads it again pixel for pixel, exports and imports a page, and runs the Wildnis.

The modules are in src/canvas/puppet/: CreatureTemplate.ts, PartKit.ts, SoftCompose.ts, PuppetIk.ts, CreatureGait.ts, CreatureAttack.ts and Creature.ts. The docs are the "Generated creatures" section of docs/puppet.md.

From earlier steps

The scaffold, start screen, intro and scaling are explained in Spielwerk 00: The workbench.

Embed it

<script src="https://www.game-object.de/tce-elements/tobidot/dll-tce-assets"></script>
<script src="https://www.game-object.de/tce-elements/tobidot/tce-bestiarium"></script>
<tce-bestiarium></tce-bestiarium>
Attribute Values Default
init-seed whole number: the first monster's seed and the Wildnis's random
init-intro true / false: play the GO logo intro true

Next

Previous: Spielwerk 41: Gummihaut · Next: Spielwerk 43: Knochenwerkstatt · All steps

Comments

captcha