Manifests¶
A manifest is one avatar: 1,000 bytes that hold its body, its shape, its nine colours, its face and the item worn in each slot. It is the same description an Xbox 360 keeps for a profile, so a manifest from a console, from the gamertag lookup or from 360sona.com's editor draws the same avatar in every SDK. Text APIs carry it as base64 (1,336 characters).
sona_manifest m;
sona_guid tee;
/* 0xAARRGGBB */
const uint32_t colours[3] = { 0xff2a5caa, 0xffffffff, 0xffffffff };
if (sona_manifest_parse(manifest, &m) == SONA_OK &&
sona_guid_parse("00000008-006e-0001-c1c8-f109a19cb2e0",
&tee) == SONA_OK &&
sona_manifest_wear(&m, &tee, colours, 0) == SONA_OK &&
sona_manifest_write(&m, manifest) == SONA_OK)
sona_avatar_add(ctx, manifest, NULL, &avatar);
sona::Manifest m;
sona_guid tee;
// 0xAARRGGBB
const uint32_t colours[3] = { 0xff2a5caa, 0xffffffff, 0xffffffff };
sona::Manifest::parse(manifest, m);
sona::parse_guid("00000008-006e-0001-c1c8-f109a19cb2e0", tee);
m.wear(tee, colours);
sona::Avatar dressed = ctx.add(m);
var m = SonaManifests.Parse(manifest);
var tee = SonaManifests.ParseGuid("00000008-006e-0001-c1c8-f109a19cb2e0");
SonaManifests.Wear(ref m, tee, 0xff2a5caa, 0xffffffff, 0xffffffff);
var dressed = ctx.Add(SonaManifests.Write(m));
let mut m = Manifest::parse(manifest)?;
m.wear(&guid_parse("00000008-006e-0001-c1c8-f109a19cb2e0")?, [0xff2a5caa,
0xffffffff, 0xffffffff], 0)?;
let dressed = ctx.add(&m.to_bytes()?, &AddOptions::default())?;
m = sona.Manifest(manifest)
m.wear("00000008-006e-0001-c1c8-f109a19cb2e0", colours=(0xff2a5caa,
0xffffffff, 0xffffffff))
dressed = ctx.add(m.to_bytes())
The parse and write are exact: sona_manifest_write gives back x byte for byte, so a
manifest you edit and save loses nothing you did not change. None of these calls needs a context, a licence or the
network.
Where a manifest comes from¶
| Source | How | Page |
|---|---|---|
| A player's Xbox profile | the gamertag lookup, GET /sona/v1/gamertag/{gamertag} |
An avatar from a gamertag |
| A player who signs in | Sign in with 360sona, then GET /slots with the avatar:read scope |
Saved avatars |
| A player, while playing | the player editor | Player editor |
| Code | sona_make_random, sona_make_variant, sona_make_dress_like |
Making avatars in code |
| The command line | sona avatar random, sona avatar new |
CLI reference |
| 360sona.com | the editor's share box | Avatar manifests |
A manifest you keep is a value like a name: store it, send it over the network and compare it byte for byte. It does not change unless the player changes it.
What is in it¶
sona_manifest_parse reads the bytes into a sona_manifest:
| Field | What it holds |
|---|---|
weight, height |
The two body sliders, -1 to 1 (stored as given; beyond 1 saturates when drawn) |
figure_a |
The body. Its id says the gender: gender is 1 for the man's body, 2 for the woman's |
figure_b |
The head |
chin, nose, ears |
The face's shapes, as item ids |
face[6] |
Mouth, eyes, eyebrows, facial hair, eye shadow and a facial feature, each a part and its placement |
colours[9] |
Skin, hair, mouth, eyes, eyebrows, eye shadow, facial hair, facial feature, facial feature 2 (0xAARRGGBB) |
worn[13] |
The item in each of the 13 slots, with its three colours; an empty slot has a zero id |
required[4] |
The last shoes, trousers, shirt and hair worn, so taking an item off puts them back |
valid |
Whether the manifest passes the console's own check |
The struct fields page has every field's type; items and slots says what an item id is and which slot it fills.
Changing one¶
The edit calls follow 360sona.com's editor, so an avatar edited in your game is one the editor and a console take:
sona_manifest_wearputs an item on and takes off what shares its slots, then refills the required clothes (a shirt, trousers and shoes) from the last ones worn.SONA_EDIT_NO_REQUIREDleaves them empty;SONA_EDIT_STACK_PROPSkeeps the props already held.sona_manifest_unweartakes off what a slot mask holds;sona_manifest_undress_alltakes everything off.sona_manifest_set_colour,sona_manifest_set_shapeandsona_manifest_set_genderset a colour, the two sliders and the body. A new body swaps the clothes made for the other one, as the editor does.sona_manifest_ready_for_xboxsays whether a console would take it as it is: one prop, the required clothes, no custom item.
An avatar's look is fixed when it is added. To change what an avatar on screen wears, add the edited manifest as a new avatar and swap the two when the new one is READY, so the old look stays on screen while the new one loads:
sona_manifest m;
uint8_t edited[SONA_MANIFEST_BYTES];
sona_avatar *next = NULL;
/* where the old one stands */
sona_placement here = { { 0.0f, 0.0f, 0.0f }, 0.0f, 1.0f };
sona_manifest_parse(manifest, &m);
if (sona_manifest_wear(&m, &item, NULL, 0) == SONA_OK &&
sona_manifest_write(&m, edited) == SONA_OK)
sona_avatar_add(ctx, edited, NULL, &next);
/* each frame, after sona_update */
if (next && sona_avatar_state_of(next) == SONA_AVATAR_READY) {
sona_avatar_move(next, &here, 0);
sona_avatar_remove(avatar);
avatar = next;
next = NULL;
}
sona_avatar_set_manifest is for one case only: an avatar added with sona_avatar_add_waiting before its manifest
was known takes it once (loading placeholders). On the web, the avatar changes an
item in place (avatar.wear()).
Base64¶
Base64 is the form for text: JSON, URLs, the web SDK, a save file. sona_avatar_add_base64 takes it directly (at
most 4,096 characters, so whitespace and line breaks are allowed); sona_base64_decode gives you the bytes.
sona avatar random --seed 42 --catalogue sona-catalogue.bin -o me.txt
sona manifest unpack me.txt -o me.json
sona manifest unpack writes every field as JSON to read or edit, and sona manifest pack turns it back into the
same 1,000 bytes.
Related¶
- Items and slots: what goes in
worn[13]. - Making avatars in code: random avatars and outfits.
- Struct fields:
sona_manifestfield by field.
This page as Markdown · All the docs as one file (llms-full.txt)