@silentstatestudio/perseon 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/CHANGELOG.md +192 -0
  2. package/LICENSE.md +30 -0
  3. package/README.md +848 -2
  4. package/dist/authoring/index.cjs +213 -0
  5. package/dist/authoring/index.d.cts +866 -0
  6. package/dist/authoring/index.d.ts +866 -0
  7. package/dist/authoring/index.js +214 -0
  8. package/dist/authoring/index.js.map +1 -0
  9. package/dist/chunk-GDXCMDJ6.js +5462 -0
  10. package/dist/chunk-GDXCMDJ6.js.map +1 -0
  11. package/dist/chunk-ON4JV4BI.js +8432 -0
  12. package/dist/chunk-ON4JV4BI.js.map +1 -0
  13. package/dist/chunk-PT7F7TTB.cjs +8431 -0
  14. package/dist/chunk-Q2HLLGJ7.cjs +5461 -0
  15. package/dist/chunk-SVI6WUOB.js +1 -0
  16. package/dist/chunk-SVI6WUOB.js.map +1 -0
  17. package/dist/chunk-ZIMCQTYK.cjs +1 -0
  18. package/dist/colors-CUEeQ78V.d.cts +2247 -0
  19. package/dist/colors-pshUJaKB.d.ts +2247 -0
  20. package/dist/core/index.cjs +29 -0
  21. package/dist/core/index.d.cts +39 -0
  22. package/dist/core/index.d.ts +39 -0
  23. package/dist/core/index.js +30 -0
  24. package/dist/core/index.js.map +1 -0
  25. package/dist/index.cjs +29 -0
  26. package/dist/index.d.cts +3 -0
  27. package/dist/index.d.ts +3 -0
  28. package/dist/index.js +30 -0
  29. package/dist/index.js.map +1 -0
  30. package/dist/pixi-v7/index.cjs +513 -0
  31. package/dist/pixi-v7/index.d.cts +372 -0
  32. package/dist/pixi-v7/index.d.ts +372 -0
  33. package/dist/pixi-v7/index.js +514 -0
  34. package/dist/pixi-v7/index.js.map +1 -0
  35. package/dist/pixi-v8/index.cjs +608 -0
  36. package/dist/pixi-v8/index.d.cts +380 -0
  37. package/dist/pixi-v8/index.d.ts +380 -0
  38. package/dist/pixi-v8/index.js +609 -0
  39. package/dist/pixi-v8/index.js.map +1 -0
  40. package/dist/rendering-DeUo1BsK.d.cts +237 -0
  41. package/dist/rendering-DeUo1BsK.d.ts +237 -0
  42. package/dist/testing/index.cjs +159 -0
  43. package/dist/testing/index.d.cts +85 -0
  44. package/dist/testing/index.d.ts +85 -0
  45. package/dist/testing/index.js +160 -0
  46. package/dist/testing/index.js.map +1 -0
  47. package/package.json +148 -6
package/CHANGELOG.md ADDED
@@ -0,0 +1,192 @@
1
+ # Changelog
2
+
3
+ Notable changes to `@silentstatestudio/perseon`. The format is based on
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and versions follow
5
+ [semantic versioning](https://semver.org/spec/v2.0.0.html), with the usual `0.x`
6
+ caveat that a minor bump may still break, until `1.0.0` says otherwise. This
7
+ first entry has nothing to compare with, so instead of `Added` or `Changed` it
8
+ describes the package, grouped by area.
9
+
10
+ ## [0.1.0] - 2026-11-16
11
+
12
+ First release. Everything below is new, so this entry describes what the package
13
+ is rather than what changed in it. The [README](README.md) has the full guide.
14
+
15
+ ### Entry points and requirements
16
+
17
+ - `@silentstatestudio/perseon` and `@silentstatestudio/perseon/core`: the engine,
18
+ with no rendering library (`PerseonIntegration`, `PerseonPlayback`,
19
+ `parseAnimationOptions`, `PerseonConfigError`, and the animation, emitter,
20
+ layer, particle and handle classes).
21
+ - `@silentstatestudio/perseon/pixi-v8` and `@silentstatestudio/perseon/pixi-v7`:
22
+ `Perseon` for each Pixi major, with the same API, plus the renderer, ticker and
23
+ atlas helpers (`PixiV8ParticleAtlas` / `PixiV7ParticleAtlas`, `textureFromSource`).
24
+ `createPixiApplication` and `resolveRendererBackend` are v8 only.
25
+ - The adapters also export as values `PerseonAnimation`, `PerseonPlayback`,
26
+ `Emitter`, `ParticleLayer`, `ParticleItem` and the handles `ParameterHandle`,
27
+ `LocalDefaultHandle` and `LocalParameterHandle`. Each is the same class as in the
28
+ root, so `instanceof` works whichever entry it was imported from. Every entry but
29
+ `authoring` and `testing` exports the types of the format and the render
30
+ interfaces (`ITicker`, `IRenderer`).
31
+ - `@silentstatestudio/perseon/authoring`: for tools that write animations, not for
32
+ games. The domains of every field, the catalogs a Linked parameter reads from
33
+ (sources, triggers, blend modes, curve presets, `option()` paths),
34
+ `ANIMATION_FORMAT_VERSION`, `WARM_UP_MIN_STEP_SECONDS`, `compileCurveSegments`,
35
+ `sanitizeName` and the checks an editor runs.
36
+ - `@silentstatestudio/perseon/testing`: `FakeTicker`, `FakeRenderer`,
37
+ `FakeRenderNode` and `FakeParticleGroup`, to test a game without Pixi.
38
+ - `pixi.js` is an optional peer dependency (`^7.0.0 || ^8.5.2`; Pixi 8.5.0 and
39
+ 8.5.1 are left out). The engine itself imports no rendering library.
40
+ - Node 18 or later. ES2022, shipped as ESM and CommonJS, with type declarations.
41
+
42
+ ### Playing animations
43
+
44
+ - Three levels: `Perseon` (the integration, one per app), `PerseonAnimation` (one
45
+ compiled config, paid once at load) and the playback (one showing of it, pooled).
46
+ The template holds a frozen copy of the config.
47
+ - `animation.play(options)` fires and forgets: at its natural end the instance goes
48
+ back to the pool. `animation.prepare(options)` returns a stopped playback you can
49
+ customize, then `start()`; it stays yours until `release()`. `autoRelease` sets
50
+ who owns the instance at the end, with those defaults.
51
+ - Playback control: `start()` (emits unless given `false`; goes on after `pause()`),
52
+ `pause()`, `reset()`, `stop()`, `release()`, `destroy()`. Every end is told once,
53
+ to `onFinished` and to the `finished` promise (which never rejects), with a
54
+ `reason`: `'completed'`, `'stopped'`, `'released'`, `'destroyed'` or
55
+ `'hostDestroyed'`.
56
+ - A handle carries a generation: once its instance goes back to the pool,
57
+ `alive` is `false` and every call on it is a no-op with a diagnostic.
58
+ - Play options: `parent`, `x`, `y`, `seed`, `params`, `transform`, `timeScale`,
59
+ `emit`, `autoRelease`. `new PerseonPlayback` builds one without a pool.
60
+ - An emitter the game closes (`spawn = false`), or one started with
61
+ `start(false)`, does not reopen by itself, even with repeats left.
62
+ - A call that arrives while the instance is in its tick (from a listener or a
63
+ `ParticleClass` hook) is queued and applied at the end of that tick; a restart
64
+ chain that goes past 64 rounds is cut with a warning.
65
+
66
+ ### Customizing an instance
67
+
68
+ - `param(id)` for a local parameter and `option(path)` for any field of the config,
69
+ on a playback, an emitter or a layer. Both have `get`, `set`, `reset`, `current`
70
+ and `describe`. `set(number | label)` pins a local; `set(config)` replaces a
71
+ strategy, validated whole before anything changes.
72
+ - `describe().stage` says when a change is read: `immediate`, `tick`, `birth`,
73
+ `cycle`, `session` or `construction`.
74
+ - `animation.param(id)` sets the default of a local for the instances prepared
75
+ afterwards; `animation.describe()` lists globals, locals, events, emitters,
76
+ layers, point forces and regions.
77
+ - Shortcuts that persist: emitter setters (`spawnRate`, `spawnDuration`, `repeat`,
78
+ ...) and playback ones (`gravity`, `damping`, `wind`, `windVector`,
79
+ `addPointForce`, `updatePointForce`, ...). Layers take `gravityFactor`,
80
+ `dampingFactor`, `windFactor` and `pointForceFactors.<id>`; a layer without a
81
+ factor is not affected by that force.
82
+ - `maxUpdateRate` and `warmUpMaxTicks` on the playback and on each emitter;
83
+ `effectiveMaxUpdateRate` and `effectiveWarmUpMaxTicks` on the emitter.
84
+ - `visible` on emitters and layers: hidden only stops drawing, and the emitter
85
+ still spawns, simulates and fires its events.
86
+
87
+ ### Particle classes
88
+
89
+ - `EmitterOptions.ParticleClass` takes a subclass of `ParticleItem`, given in code
90
+ (a JSON file cannot carry it). It overrides `onInit` (at birth) and `onUpdate`
91
+ (every tick), and `reset()`, calling `super.reset()`, for state of its own. A
92
+ layer's config takes the same two hooks as functions.
93
+ - A hook receives the `particle`, its `emitter` (`ParticleHookEmitter`: `id` and
94
+ `playback` with `start`, `stop` and `param`) and `rng` (`ParticleHookRandom`,
95
+ the emitter's seeded generator).
96
+ - `ParticleItem` reserves the names the engine uses: `init`, `updatePhysics`,
97
+ `updateEnvironment`, `updateTexture`, `layer`, `mem`, `bornX` and `bornY`.
98
+ Declaring any of them in a subclass is a compile error.
99
+
100
+ ### Parameters
101
+
102
+ - Locals are declared at the root of the animation with a mode (Fixed, Range,
103
+ List or Linked) and a `sampleScope`: `'playback'`, `'emitter'` or `'particle'`.
104
+ - Globals are values of the game, with no modes: `perseon.setGlobalParameter(id,
105
+ value)` reaches every animation that declares them, before or after they exist.
106
+ `NaN` and `Infinity` throw.
107
+ - A value can be Linked to another parameter through a Bezier curve, and can carry
108
+ a stack of modifiers driven by a waveform modulator (`sine`, `square`,
109
+ `sawtooth`, `triangle`, `noise` or `custom`). Linked values evaluate in
110
+ dependency order and read from the same level or above.
111
+ - Names are 1 to 50 characters and unique; ids of emitters, regions and point
112
+ forces cannot contain a dot.
113
+
114
+ ### Events
115
+
116
+ - Layers and emitters bind named events to triggers (`onSpawn`, `onDeath`,
117
+ `onRegionEnter`, `onRegionExit`, `onEmitStart`, `onEmitStop`, `onFinished`).
118
+ - Listen at three levels, each call returning an `Unsubscribe`: `pb.on`,
119
+ `animation.on` and `perseon.on`. Delivery is synchronous. `pb.on` and
120
+ `animation.on` throw on a name the animation does not declare.
121
+ - The payload is a `PerseonEvent`: `particle` is a read-only copy
122
+ (`ParticleSnapshot`) with `toObject()`, not the live particle.
123
+
124
+ ### Space and composition
125
+
126
+ - Transforms: `playback.transform`, each emitter's and each layer's, of `{ x, y }`,
127
+ move where new particles are born. Containers handle scale, rotation and the
128
+ movement of the whole effect.
129
+ - Motion levels (position, rotation, scale, alpha, each with its velocity) compose
130
+ as `stack(base + accumulator)`: a Linked or modulated level does not discard the
131
+ ones below it or the forces. Integration is semi-implicit.
132
+
133
+ ### Time
134
+
135
+ - `timeScale` scales the simulated step of one playback. Seeded randomness
136
+ (xorshift128) gives the same sequence for the same seed, on a new or a recycled
137
+ instance.
138
+ - A frame delta that is not a finite, non-negative number of milliseconds
139
+ advances nothing and is reported once; a delta of 0 is ignored silently.
140
+ - The warm-up (`initialState.simulateTime`) steps in slices of at least 1 ms
141
+ (`WARM_UP_MIN_STEP_SECONDS`), capped by `warmUpMaxTicks`.
142
+ - `Infinity` as "no limit" for `maxUpdateRate` and `warmUpMaxTicks` is taken by
143
+ the setters only; a config cannot hold it.
144
+
145
+ ### Diagnostics and errors
146
+
147
+ - A config the format does not accept is a `PerseonConfigError` with a `path`,
148
+ at `createAnimation`, `parseAnimationOptions` and `set`. A failed `set` changes
149
+ nothing.
150
+ - At load, the `path` is the field in the file (`emitters[1].emission.rate`);
151
+ regions, point forces and parameters are named by id
152
+ (`ParticleAnimationOptions.regions['water']...`). A value of the wrong shape is
153
+ never a bare `TypeError` or `RangeError`: the error underneath is the `cause`.
154
+ - Loading checks the structure: a random list needs at least one value;
155
+ `capacity.maxAlive`, `capacity.initialPoolSize`, `randomness.seed` and
156
+ `performance` take plain numbers; emitter values and locals do not take the
157
+ `{ base, modifiers }` form of layers; emitter ids and layer ids within an
158
+ emitter are non-empty and unique, and event names unique; a modulator needs a
159
+ known `shape`; color stops cannot go backwards; a polygon has at least 3 points;
160
+ the format's booleans and strings must be of their type.
161
+ - A `"__proto__"` key is rejected, by `createAnimation` and by `set`. Unknown keys
162
+ are ignored.
163
+ - Recoverable misuse (a stale handle, a number clipped to its domain, a global of
164
+ the wrong type) follows `diagnostics: 'warn' | 'throw' | 'silent'` on `Perseon`.
165
+
166
+ ### File format and textures
167
+
168
+ - A config file is plain JSON carrying `formatVersion: 2`; one without it, or with
169
+ another version, is rejected. `parseAnimationOptions` loads it from text or from
170
+ a parsed object.
171
+ - A texture source is a cache id: an atlas frame, or a URL once `Assets.load` has
172
+ cached it. Resolution is synchronous and never fetches. `textureFromSource`
173
+ resolves string ids only; anything else is `Texture.EMPTY`.
174
+ - `PixiV8ParticleAtlas` / `PixiV7ParticleAtlas` load an atlas image and its data
175
+ and publish its frames. Each atlas needs its own `cacheKey`: `load` throws,
176
+ publishing nothing, when that key holds anything but the atlas's own sheet, or
177
+ when a frame id is already an entry of the game. An image the game had loaded
178
+ before is never unloaded by an atlas.
179
+
180
+ ### Renderers
181
+
182
+ - A renderer reports what it can do through `IRendererCapabilities`. Pixi v8 draws
183
+ all fourteen blend modes; the ten advanced ones need `useBackBuffer: true` on
184
+ WebGL. Pixi v7 draws the fixed-function modes and reports the rest as
185
+ `unsupported`.
186
+ - `Perseon` accepts any `ITicker`; a Pixi `Ticker` is recognized by its members.
187
+
188
+ ### Known limits
189
+
190
+ See "Known limits" in the [README](README.md).
191
+
192
+ [0.1.0]: https://github.com/silentstatestudio/perseon/releases/tag/v0.1.0
package/LICENSE.md ADDED
@@ -0,0 +1,30 @@
1
+ # Perseon License
2
+
3
+ Copyright © 2026 Silent State Studio
4
+
5
+ All rights reserved.
6
+
7
+ ## Grant of License
8
+
9
+ Permission is granted to use Perseon in personal and commercial projects, including games and interactive applications, provided that Perseon is used solely as part of a final product.
10
+
11
+ You may modify the source code for your own projects.
12
+
13
+ ## Restrictions
14
+
15
+ You may NOT:
16
+
17
+ - Sell, sublicense, rent or lease Perseon as a standalone product
18
+ - Redistribute Perseon on its own, in source or binary form, whether modified or unmodified. Shipping Perseon inside your final product, as the Grant of License allows, is not redistribution on its own
19
+ - Include Perseon in another engine, framework, SDK or library that is distributed or sold
20
+ - Present Perseon (or a modified version of it) as your own product
21
+
22
+ ## Ownership
23
+
24
+ Perseon is proprietary software.
25
+ All rights, title and interest in and to Perseon remain with Silent State Studio.
26
+
27
+ ## Disclaimer
28
+
29
+ This software is provided "as is", without warranty of any kind, express or implied.
30
+ In no event shall the authors or copyright holders be liable for any claim, damages or other liability arising from the use of this software.