# Build a game with Set's simulations

Set supplies complete generated characters/items and an optional small combat
fallback. You can reuse the examples' local math, rendering, or both. The
[mathematical review](https://set.world/gameplay-math-review) records what was calculated,
the corrected range boundary, and the remaining gameplay choices.

## Choose the layer you need

| Layer | Reuse | Ownership |
| --- | --- | --- |
| Generation and economy | [API skill](https://set.world/skill), [crafting skill](https://set.world/craft-guide), `/api/spec` | Set returns complete immutable roll results, grades, prices, attributes and advisory budgets. |
| Optional damage and initiative | [Combat skill](https://set.world/basic-lightweight-combat), `common/basic-lightweight-combat.ts` | Your game maintains health, stamina, scheduling, targets and event history. |
| Turn-based example | `three-isometric-engine/dungeon/adventure.ts` and `dungeon/initiative.ts` | One serial opportunity beat; 20-point physical attempts; logical-time recovery; enemy models, party resource cards. |
| Spatial weapon rules | `three-isometric-engine/weapons/handling.ts`, `range.ts`, `ballistics.ts`, `tempo.ts`, `impact.ts` | Relative equipment mass/inertia, authored timing, range, per-hand reload, contacts and explicit local damage multipliers. |
| Complete scene integration | `three-isometric-engine/anima-scene/equipment.ts` and `model.ts` | Mixed hand items, pose/contact composition, movement, recoil, healing and lifecycle. The home army shares these owners. |
| Visual assets and motion | [Anima workspace](https://set.world/anima), [asset guide](https://set.world/api/guides/anima-assets), [motion contract](https://set.world/api/guides/anima-motion) | Rigged model and selected clip exports; source-owned runtime controllers for interactive behavior. Asset provenance remains separate from code licensing. |

Read this guide at [set.world/game-development](https://set.world/game-development),
the [math review](https://set.world/gameplay-math-review), and the complete
[formula reference](https://set.world/algorithms). Source filenames below identify
owners in a Set checkout; public source-repository access is not required to
read these hosted documents or use the API/model download controls.
There is no published client SDK or hosted weight/range calculation endpoint. When copying
helpers, retain their imports, constants, licenses and a matching source snapshot;
the repository aliases `@common`, `@engine`, and `@root` are local conventions.
Other game engines can implement the equations in [ALGORITHMS §13–14](https://set.world/algorithms#13-local-weapon-handling)
without adopting Three.js or Set's page layout.

## Build one consistent character interpretation

1. Roll one character per request. Fan out a roster with `deriveSeed(base, i)`
   and retain each complete response, display UUID, seed and `contentVersion`.
   Keep the request queue sequential and reject mixed content snapshots.
2. Read `finalStats` and returned `attributes` once. Traits are already applied;
   equipment bonuses are off unless explicitly requested. Your local health,
   stamina, equipment changes and position live beside the immutable response.
3. Resolve hands with `weapons/generated.ts`'s `generatedHandItem`: `tool` is
   right/mainhand, `offhand` is left. It reads the canonical gear factor at
   `item.props[3].name`; never parse the composed item name. A normal full
   generated set fills both slots. Consumer-modified characters can have an
   empty hand, and the universal punch remains available.
4. Map to `weaponCatalog()`, build/cache geometry, and measure it with
   `measureWeaponMass`. The item Orb uses `orbMass(ITEM_ORB_RADIUS)` and its
   shared small sphere. Mirror geometry and attachment frames together with
   `mirrorWeapon` for the other hand. Full inventory does not imply that all
   fifteen items have body meshes or contribute to a whole-inventory weight.
5. Compute `weaponHandling(activeMass, finalStats, otherMass)` and then
   `actionHandling(handling, weaponUsage(entry))`. For launch/aura calculations,
   supply the same stats, geometry and support mass. Read `usage.launch` and
   `usage.sling`; an animation label alone does not establish projectile rules.
6. Commit once, pay once, advance one clock, and alternate complete hand actions.
   Start each hand's reload deadline at release. Resolve actual contacts once;
   do not also send an API hit request for a hit already resolved locally.

Cache static geometry/mass by the geometry and handling versions, not just a
character UUID. Handling/range caches must additionally account for stats,
support equipment and placement units. If equipment changes, invalidate its
profiles and grip/motion bindings. `anima-scene/equipment.ts` is the reference
for resource disposal, independent hand carries and dynamic strings/strands.

## Keep clocks, units and budgets explicit

| Quantity | Current meaning |
| --- | --- |
| Geometry, relative mass, inertia | Measure in authored model coordinates. Mass behaves as length³ and inertia as length⁵ under authoring scale changes. Neither is kilograms or a rarity-derived modifier. |
| Scene placement | Spatial examples place Anima at scale 0.60. Convert reach/release positions to world units once. Do not remeasure already world-scaled geometry with unchanged reference-mass constants. |
| Handling rate | Multiplier for an authored four-second cycle: `seconds = 4 / effectiveRate`. It is not attacks/second. Untargeted non-aura actions use an additional 1.30 playback multiplier; cost is not recalculated afterward. |
| Public timing | `1000 / attackSpeed` milliseconds is the optional fallback's physical interval, distinct from the four-second scene animation. |
| Initiative | `1000 / initiative` milliseconds between recurring opportunities. Preserve exact ordinal/rate ordering and `(start, end]` window boundaries. |
| Dungeon visual beat | 1.1 seconds with impact at 0.36. Regenerate from elapsed logical opportunity time, never from this visual duration. |
| Stamina | Keep full precision. Recover 10/second once per eligible interval; cap at the returned maximum. Two-decimal text is presentation only. |
| Ballistic range | Horizontal distance until the center reaches the landing height. `flightEnvelope(profile, releaseHeight - landingCenterHeight)` includes release height; `targetElevation` can return `null`. |
| Gunfire range | A finite 3D ray-distance budget borrowed from the Fire envelope. Reports distinguish `range`, `horizontalRange`, and `availableRange`. Ground AI range is a planning gate; the actual release segment decides contact. |
| Tool `reach` | A conservative geometry/culling bound, not the measured melee hit radius. Spatial melee gates sample the authored attack; final collision uses the composed pose. |
| Aura factor | A radius multiplier whose square is the area factor. Apply it to radius once; dual wield does not double the radius or area. |

`advanceWeaponClock` fits the review field's same-tool alternating hands. Mixed
equipment uses the scene integration's separate per-hand profiles/readiness;
passing one hand's profile for both hands changes the rules. Do not sum
independent initiative, attack-speed and animation clocks into accidental extra
attacks or regenerate on all three. Your game can choose a different clock.

Normal four-second weapon cycles are sustainable at 10 stamina/second: the
review establishes a conservative drain bound below 9.790/second across the
accepted stat domain and nonnegative hand burdens. Stamina gates commitments,
but ordinary uninterrupted cycles alone do not impose exhaustion. Cancelled
actions, Reel, shorter WorldSphere delivery and the initiative dungeon differ.
If your design requires sustained resource pressure, choose and version a local
recovery/cost rule; do not silently change Set's shared API constant.

Large weapons currently trade speed and per-attempt stamina for spatial reach,
contact geometry and sometimes recoil. Mass is not an automatic damage bonus.
The math review is not a guarantee of equal weapon effectiveness. Price/grade
also cannot be treated as a damage, weight, or range multiplier without an
explicit consumer interpretation of the advisory budget.

## Download Anima and its motions

Open [Anima](https://set.world/anima), or `/anima` on your local Set server.
Scroll the desired column into view and wait for its model to prepare. In
Base avatar or Portrait face, select **Download model**. In a demonstration
column, select **Download motion** after choosing its controls.

| Column | Download | Selected content |
| --- | --- | --- |
| Base avatar / Portrait face | `anima.glb` | Rigged Anima and Breathing clip; framing changes the viewer, not its anatomy. |
| Walking | `anima-walk.glb` | Current Walk to run blend, as an in-place clip. Set the slider to Run for the running blend; the filename remains the same. |
| Jump | `anima-jump.glb` | Selected jump height and its clip. |
| Punching | `anima-punch.glb` | Authored punch clip. |
| Taking a hit | `anima-hit.glb` | Selected frequency/direction, eight contacts, then full recovery. |
| Kneeling | `anima-kneel.glb` | Kneel, hold and rise. |
| Lobbing a WorldSphere | `anima-throw.glb` | Selected delivery motion, prop choreography and Lob metadata; optional walking while holding. |

The browser constructs these GLBs from the prepared model. `anima.glb` is a
download filename, not a static URL; there is no `/api/models` or export API.
Exports include geometry, the 48-bone rig, skin weights, generated surface maps,
resin shell, the selected clip and metadata. The stage floor is excluded.
The base model has 25,964 triangles plus its matching shell, 51,928 total;
the WorldSphere demonstration adds its prop. That count is not a performance
promise for an arbitrary engine or roster.

For a Three.js consumer, a basic import uses the existing glTF loader and
animation mixer:

```ts
import { AnimationMixer } from 'three';
import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';

const asset = await new GLTFLoader().loadAsync('/assets/anima-walk.glb');
scene.add(asset.scene);
const mixer = new AnimationMixer(asset.scene);
if (asset.animations[0]) mixer.clipAction(asset.animations[0]).play();
```

Place your downloaded file at that application-owned asset path. Advance
`mixer.update(deltaSeconds)` from your existing visible simulation loop. The
snippet assumes your renderer/scene lifecycle already exists. For multiple
independent characters, use skeleton-aware cloning, independent mixers and
shared geometry/maps; dispose each skeleton/mixer and release shared resources
when their last owner leaves. Preserve scale, material transparency/unlit
behavior and metadata when importing in another engine. [Three.js GLTFLoader](https://threejs.org/docs/pages/GLTFLoader.html).

The export implementation is `avatar/model.ts` using
[GLTFExporter](https://threejs.org/docs/pages/GLTFExporter.html). A baked clip
does not contain the interactive IK, grip fitting, ragdoll, targeting, combat,
inventory, or motion-composition controllers. Those live in source. The weapon
review currently has no weapon-download button; the catalog's 144 procedural
tools are built by `weapons/meshes.ts`. Reuse those constructors and their
dynamic-part descriptions rather than assuming the base GLB contains a full
inventory, every weapon clip, or ready-made weapon exports.

## Preserve model provenance

Set's code/API guide license does not relicense third-party model geometry.
The [asset provenance](https://set.world/api/guides/anima-assets#attribution-and-evidence) records
derived parts from tramdrey's model with embedded `SKETCHFAB Standard` metadata;
the author/source/license record remains in exports. The current source listing's
license and any separate permissions held by the maintainer have not been
established by this review. Do not advertise the GLBs as an unrestricted MIT
asset pack. Before redistributing them or incorporating them into a shipped
game, establish the applicable permissions; the recorded Standard terms have
restrictions on standalone redistribution. You can use the code/math with your
own cleared assets. [Sketchfab license terms](https://sketchfab.com/licenses).

## Retain enough information to replay

Keep the full roll, seed, `contentVersion`, consumer rule version, geometry,
handling, ballistic, motion and visual versions, and simulation inputs. The
current local correction is `anima-ballistics-4`; Gunfire report semantics are
`gunfire-5`; handling remains `weapon-handling-6`. A generation content stamp
alone cannot replay an evolving spatial game. A saved scene report contains
useful data and observations, but is not a general save-game loader.

Keep action randomness separate from visual randomness, recover resources once,
freeze hidden/paused time under your chosen simulation contract, and resolve
ties consistently. No level curve, status-effect implementation, guaranteed
battle termination, server inventory, or equipment rebalance is implied by
adopting these examples.
