# Eidolon: using it in a Mmorada game

> Tu personaje, creado con IA: juégalo en Mmorada o llévalo a tu mesa de rol con su ficha de quinta edición. This file is for coding agents adapting a game to it. The platform's guide: https://www.mmorada.com/dev/llms.txt (read it first); the SDK's types: https://www.mmorada.com/dev/sdk.d.ts; the page for people: https://www.mmorada.com/apps/eidolon/guide.

## Steps

1. In the game's `mmorada.json`, add `"eidolons"` to `permissions` (or tick it under Complementos in the game's settings on the portal).
2. Use the SDK as the section below explains; read the types before writing calls.
3. Test in dev mode, then upload the new version to testing (with the MCP server: `apply_manifest`, then `start_upload` / `finish_upload`).

## Eidolons (characters made with AI, for every game)

An Eidolon is a player's own character, made with AI on Mmorada's screen: a name, an epithet, a short legend (in Spanish), a portrait (1024 × 1024 and a 512 avatar) and a **rigged 3D model** (a GLB on Mmorada's CDN, about 10,000 triangles, base-color texture). Every body (`biped`, `quadruped`, `avian`, `serpentine`, `aquatic`, `hexapod`, `octopod`) gets its rig (`model.skeleton: "tripo"`, `model.rigType` its body) with a few stock animations baked in and named in `model.clips` (a humanoid: idle, walk, run, jump, hurt; a creature: its gait; a bird none yet, `model.animations: 0`): play them with your engine's animation mixer, no retargeting needed. Its shape is measured for you, in three levels, so your game takes what it needs: nothing (draw the portrait), `model.bounds` and `model.body` (one capsule for the whole body, always there), `model.head` (a sphere `{ bone, center, radius, source }` where the head is, for headshots, always there; `source` is `"named"` when a bone is called head, `"guessed"` when the body's shape said where; `null` when a body has none), or `model.hitShapes` (a capsule `{ bone, a, b, r, zone }` per bone, the hitbox as the model is, `zone` one of `head`, `torso`, `arm`, `leg`, `other` for your damage rules; what each is worth is your call: ask with `Mmorada.eidolons.list({ include: ["hitShapes"] })` or `hitShapes(id)`), all in the model's space: scale with the model, turn with the character. The same Eidolon works in every game that asks for the `eidolons` scope. Each has a `kind`: a player's own `"character"` (what Eidolon is about, and all `list()` returns), a character's `"companion"` (a pet, a familiar, a mount: one character in 40 comes with one, at no cost; the character's `companionId` and the companion's `companionOf` link them; `list({ kind: ["companion"] })`), or a `"mob"` or an `"npc"` they made for a game of theirs, private (`list({ kind: ["mob", "npc"] })`).

- **Your rules decide what an Eidolon is in your game.** Each one carries a closed vocabulary to read: `archetype` (guardian, striker, hunter, mystic, trickster, artificer, healer, wanderer), `element` (ember, tide, gale, stone, thorn, frost, storm, void, radiance), `traits` (Spanish words), `palette`, `size`, and `quirks`, the physical differences the player chose (limp, hunched, missing_arm, missing_leg, prosthetic_arm, prosthetic_leg, one_eye, blind, extra_arms, extra_limbs, wings, tail): the model shows them, the skeleton stays the standard one (a part it lacks, like a third arm, moves with the torso), so use a limping walk or a rule for them where you have one, or ignore them. Map them to your own kit deterministically and keep what you decided with `Mmorada.eidolons.data.set(id, json)` (64 KB per Eidolon; a server of yours writes it at `PUT /api/v1/apps/<appId>/server/players/<playerId>/eidolons/<id>/data`). Never sell power through an Eidolon: every kit must be reachable by playing.
- **Creating one** is `Mmorada.eidolons.create()`: Mmorada's creator opens over the game; the player writes an idea (or asks for a surprise), sees the legend and the picture (up to 4 other versions), and forges it with a credit. It resolves with the Eidolon (`state: "forging"`) or `null`; `wait(id)` until `state: "ready"` (a few minutes; Mmorada also notifies the player).
- **Selling the creation**: an item with `eidolonCredits` (1, or 3 for a pack; on the portal or in `mmorada.json`) is always a consumable that only forging an Eidolon uses up; sell it with `Mmorada.store.buy(key)` before `create()`. For each Eidolon your items forge, Mmorada takes 1.50 USD from your month (the AI's cost), so the item's price must cover it: at least 2.00 USD per credit (your share of the price, after the processor's fee); the creator offers your game's credits first. A forge that fails gives the credit back (the player keeps the draft: its sheet and picture). Mmorada+ members get one free creation, paid by Mmorada.
- **Showing it**: `portraitUrl` / `avatarUrl` in menus and on the HUD, `model.url` in the world (load it with your engine's glTF loader; it is served with CORS). Scale it to your world: models come in meters (`auto_size`). Give a fallback character while `model` is null.
- Step by step for an agent (also in `read_guide` with `addon: "eidolon"`): https://www.mmorada.com/apps/eidolon/guide.md; for the person: https://www.mmorada.com/apps/eidolon/guide.
- In dev mode `Mmorada.init({ devEidolons: [...] })` sets the local player's Eidolons; `create()` answers the first.
