Scopes and names¶
Everything from here on is one text for four faces. The vocabulary differs; the model does not. This page is the bridge โ read it once and every other Guide page reads in your language.
Pick your language once
Code below appears in tabs. The one you pick is remembered for every page on this site, so you never choose twice.
Three scopes¶
The player splits its state by how long the thing it holds stays useful, not by object hierarchy.
flowchart TD
dev["Device scope<br/>pipelines ยท sampler ยท atlas textures"]
tgt1["Target scope<br/>projection ยท this frame's geometry"]
tgt2["Target scope"]
p1["Character"]
p2["Character"]
p3["Character"]
dev --> tgt1
dev --> tgt2
tgt1 --> p1
tgt1 --> p2
tgt2 --> p3
| Scope | Holds | You keep one per |
|---|---|---|
| Device | pipelines, bind group layouts, the sampler, atlas textures | GPU device โ never one per window |
| Target | the projection, the frame's geometry arena, the draw list | thing you draw into: a window, a canvas, an offscreen texture |
| Character | the playback tree, transform, draw order, visibility, alpha | character on screen |
The consequence that matters in practice: a character holds no GPU resource at all. Ten characters in one target share one atlas upload, one set of pipelines and one render pass. A second character on screen adds its playback tree and its own parts to the frame, and no pass, pipeline or atlas upload of its own.
The same three, named per face¶
| Scope | Rust | C | JavaScript | Bevy |
|---|---|---|---|---|
| Device | SSRenderer |
(inside ss_scene_t) |
SsContextWeb |
(inside the plugin) |
| Target | SSScene |
ss_scene_t |
SsSurfaceWeb |
(the camera's view) |
| Character | SSPlayer |
ss_player_t |
SsPlayerWeb |
an entity with SsPlayer |
Two asymmetries change what is cheap:
- C fuses the device and target scopes into
ss_scene_t. That handle is a whole graphics stack built on the window you named โ so one window is one device. Two windows in one C++ application are two devices. Two characters in one window are one device, which is what thess_scene_t/ss_player_tsplit is for. - JavaScript keeps them apart, so a page with eight
<ss-player-webgpu>elements still builds exactly oneGPUDevice:SsContextWebis the page,SsSurfaceWebis a canvas.
The frame, in each language¶
The shape is identical: advance everything, then draw everything, once.
Pass every character of a target through one update. A second update on the same target
starts a new frame and replaces what the first one built, so only the last call's characters are
drawn; a character handed to two targets' updates in one frame advances twice.
Draw order inside a target is set_order, ascending. It is a plain integer, not a tree.
What each face can do¶
The library is one; the faces expose different amounts of it. A dash is not a promise. The coverage row is a boundary by design: the C and JavaScript faces own their render pass and its stencil, and coverage exists only for a pass with no stencil to lend. The ROADMAP lists what is planned.
| Rust | C | JavaScript | Bevy | |
|---|---|---|---|---|
| Load, both export modes, sibling packs | โ | โ | โ | โ |
| Transport: play / pause / resume / stop / seek | โ | โ | โ | โ |
| Loop count, sections, direction, sub-frame | โ | โ | โ | โ |
| Events: user data, signal, audio | โ | โ | โ | โ |
| Part overrides: visibility, cell, colour | โ | โ | โ | โ |
| Texture replacement: a whole cell map | โ | โ | โ | โ |
| Part transform lookup | โ | โ | โ | โ |
| Group alpha: a fade as one layer | โ | โ | โ | โ |
| Crowds: one character at many placements | โ | โ | โ | โ |
| Motion blending: tracks, crossfade, sources | โ | โ | โ | โ |
| Masks โ stencil | โ | โ | โ | โ |
| Masks โ coverage bitmap | โ | โ | โ | โ |
| Supplying your own textures | โ | โ | โ | โ |
| Device-loss recovery | โ | โ | โ | โ |
| Frame statistics | โ | โ | โ | โ |
| Drawing into a render pass you own | โ | โ | โ | โ |
On Bevy, motion blending is driven by the SsTrackCommand message and read
back from the SsTrackState component, since the playback trees live in the render world.
Two calls, not one: selecting and starting¶
On Rust, C and JavaScript, choosing an animation and starting it are separate:
That split is deliberate: switching motions is frequent and must not carry an allocation you did
not ask for, or a promise you have to await. See Playback and transport for what
each verb does โ in particular why play() is not how you lift a pause().