Skip to content

Effekseer pool, HDR overlay follow-ups, treasure-chest space check, action-sequence lift and waits (runtime 20261124.1) - #98

Merged
Psychronic-Games merged 6 commits into
Psychronic-Games:mainfrom
Xehanort88:feat/effekseer-hdr-chests-sequences
Nov 25, 2026
Merged

Psychronic-Games merged 6 commits into
Psychronic-Games:mainfrom
Xehanort88:feat/effekseer-hdr-chests-sequences

Conversation

@Xehanort88

Copy link
Copy Markdown
Contributor

Summary

Four independent changes, one commit each, so they can be reviewed or reverted one at a time. The runtime ones share one revision, 20261124.1.

  1. Effekseer contexts keep 16000 particles instead of 4000
  2. HDR overlay: keyed bloom and grade, companions, model twins, in-scene distortion
  3. Treasure chests wait for room
  4. Action sequences: flat 2D lift and Wait for Animation

No new user-visible strings except in part 3, which adds 7 phrases translated in all 17 locales as a machine-assisted first pass.

1. Effekseer contexts keep 16000 particles instead of 4000

Problem

Every Effekseer context is created with init(gl) and no settings, so it keeps Effekseer's default pool of 4000 instances. When the pool is full, Effekseer skips each new particle (ManagerImplemented::CreateInstance returns null). Nothing is thinned out and nothing is reported. The layers that spawn first keep all their particles and later layers lose theirs.

Everything playing in a context shares that pool: an HDR effect and its companion, one effect on several targets, and any other animation on screen. A Sky Break strike played with HDR peaks at 5552 instances, so about 1550 of its paint volutes and embers were never created.

What changed

  • Runtime: Graphics.effekseerContextSettings ({ instanceMaxCount: 16000, squareMaxCount: 40000 }, in reactor_core.js) now initializes every context:
    • the overlay context, and its restore after a context loss;
    • the in-scene layer (reactor_sprites.js);
    • the 3D effects pass (reactor_3d_effects.js).
  • Editor: the animation previews use the same numbers, from the new src/utils/EffekseerContextSettings.js (loaded in index.html). That covers the Animations page, the animation pickers, the preview layer and the Effekseer generator. A preview now drops particles exactly where the game does.
  • The largest single play among 965 installed test animations peaks at 11728 instances.
  • Memory cost: a pool reserves about 5 KB per instance at init, so each context takes about 80 MB of Effekseer's heap instead of about 20 MB.

No new user-visible strings.

Tests

  • effekseer-context-settings.test.cjs (new) checks three things: every createContext site passes the settings, runtime and editor agree on the numbers, and the Demo copies match. effekseer-state-guard is updated for the new init call.
  • sync-runtime.cjs --check: the Demo matches runtime/.
  • Measured in the game when written (runtime 0.99.4): a Sky Break HDR play peaked at 5552 live instances. The largest single play among 965 installed test animations peaked at 11728.
  • Seen on 0.99.7: a battle test of a 132-plugin project reaches the turn phase with no errors on a runtime carrying parts 1 and 2, on NW.js 0.115 and 0.120.

2. HDR overlay: keyed bloom and grade, companions, model twins, in-scene distortion

Problem

These are the HDR overlay follow-ups to #78 and #79. They were built from 2026-10-29 to 11-08 as seven commits on a line that upstream's later HDR work (47790645 and the in-scene work around it) rewrote around. Replaying them one by one onto 0.99.7 meant resolving the same functions again and again. Part 2 carries their net change as it already runs on top of 0.99.7, as one commit.

It closes six gaps:

  1. Bloom could not be clamped the way Unity's post-processing does. Effects authored against Unity's bloom prefilter (Rogue Trader: clamp 0.8, threshold 0.674, knee 0.464) bloomed unclamped, and their dark cores vanished.
  2. Bloom intensity was one number for a whole effect. Some games animate it within one spell; Bravely Default II's Electon goes from 2.0 to 0.12.
  3. An effect had one grade throughout. It could not blend into a second grade as it played.
  4. Refraction and opaque bodies have to be left out of an HDR asset, and nothing could play them back beside it.
  5. An HDR effect anchored on a placed 3D model played the raw HDR file, clipped and ungraded. The 3D scene has no HDR path, and reactor_3d_effects.js never read the sidecar.
  6. Distortion layers drawn in the battle scene drew a dark copy of the scene instead of bending it. PIXI creates its context with alpha: false, and WebGL refuses copyTexSubImage2D from an alpha-less framebuffer into Effekseer's RGBA backdrop. That returns INVALID_OPERATION after every capture, so the backdrop stayed black. Example: Bravely Default II's Meltdown, at its end sphere.

What changed

All new sidecar fields are optional. Older runtimes ignore them and play what they played before.

  • bloom.prefilter = { threshold, knee, clamp }.
    • The bloom setup clamps light to clamp per channel, then scales it by max(b - threshold, s) / max(b, 0.0001), where b is the brightest channel and s = clamp(b - threshold + knee, 0, 2·knee)² / (4·knee + 0.0001). That is Unity's prefilter.
    • It runs where bloom.threshold would, and replaces it when both are given. The setup shader switches on a uniform, so effects without the field draw exactly as before.
    • A caller that passes no prefilter gets the sidecar's, so an older editor previews such an effect the way the game draws it.
  • bloom.intensityKeys = [[frame, intensity], ...], on the effect's own clock.
    • The clock is Sprite_Animation._effectFrame, which advances each Effekseer step (0 while paused, scaled by the fight camera's slow motion) times speed / 100.
    • Intensity runs in straight lines between keys and holds the first and last values outside them.
    • The overlay and in-scene paths group HDR animations by grade and evaluated intensity, so animations at different intensities bloom in separate passes.
    • bloom.intensity stays required, because older runtimes play it. Invalid keys fail closed.
  • gradeB + gradeKeys = [[frame, weight], ...] (weight 0..1, straight lines between keys) blends a second grade in over the effect on the same clock.
  • companion and companionOccludes (default true) let a sidecar name one ordinarily graded effect for the parts left out of the HDR asset.
    • Both handles start together, with one fresh random seed per cast and the same transforms and speed.
    • The companion draws before the HDR light. With occlusion on, it also writes depth into the cleared light target with colour writes disabled.
    • Playback waits for both loads and ends only after both handles end.
    • If the companion is missing or fails to load, the complete graded twin is selected instead, with one warning.
    • The editor's previews pair the two effects the same way.
    • The sidecar check validates the names, refusing an extension, an alias of the HDR effect or its fallback, or a companion that carries its own HDR metadata.
  • 3D model anchors: every sprite reads the sidecar.
    • Anything the 3D scene draws plays the twin, loaded into the context it plays in.
    • A -hdr effect without a valid sidecar is refused, as it is everywhere else.
    • A refusal is remembered on the model, so an Always loop or a live trigger doesn't respawn it and warn on every frame.
  • In-scene distortion: on the alpha-less canvas, SceneLayer.captureBackground copies the scene into an RGBA8 scratch renderbuffer the size of the effect's square viewport.
    • Its off-screen margins repeat the screen's edge rows and columns, since zeros showed as black bands. Effekseer then copies from that square.
    • Filter targets (RGBA textures) and alpha canvases copy as before. The target's framebuffer comes from PIXI's records, with no GL read-back.
    • The scratch buffer is dropped on context loss.
  • docs/HDR-EFFECT-OVERLAY.md and docs/EFFEKSEER-IN-SCENE.md document the new fields.

Files:

  • Runtime: reactor_hdr_overlay.js, reactor_sprites.js, reactor_managers.js, reactor_3d_effects.js, reactor_fight_camera.js and reactor_main.js (the revision), each mirrored in template/Demo/js.
  • Editor: utils/HdrPreview.js, utils/AnimationPreviewLayer.js, database/AnimationPickerModal.js, database/DatabaseAnimationEditor.js and event/AnimationPicker.js.
  • Tests: hdr-overlay, hdr-preview-render, hdr-preview-twin (new), effekseer-in-scene and model-effects.

No new user-visible strings.

Tests

  • The branch's own tests pass: hdr-overlay, hdr-preview-render, hdr-preview-twin (new), effekseer-in-scene (the canvas path: screen, edge strips and corners copied from the square and reused; a filter target copied directly) and model-effects.
  • sync-runtime.cjs --check: the Demo matches runtime/.
  • How part 2 was built: every difference between upstream/main and the fork's main (0.99.7 merged in) belongs to parts 1, 2 or 3. Part 2 takes the HDR series' files from main, where they already run on top of 0.99.7 with part 1. The branch as a whole equals the fork's main plus part 4, apart from upstream's changelog index and the revision header.
  • Seen on 0.99.7: a battle test of a 132-plugin project reaches the turn phase with no errors on a runtime carrying this change, on NW.js 0.115 and 0.120. No HDR effect was played in that check.

3. Treasure chests wait for room

Problem

A Treasure quick event gives its reward through Change Items, and Change Items clamps at the party's cap. If the party was already full, anything over the cap was lost, and the chest still counted as opened (Self Switch A set). So the player could lose a chest's item for good just by carrying too many.

What changed

  • Conditional Branch › Reactor › Can Receive [Item/Weapon/Armor] [entry] × [amount].
    • It is true when numItems + amount <= $gameParty.maxItems(item), asked when the event runs. VisuStella's <Max: x> and Reactor's own limits therefore apply. A missing entry is false.
    • It saves as a tagged Script condition (kind itemCapacityCondition), so the data stays plain MZ.
    • It reopens in the dialog and reads as "Can Receive Item: Audio picker addendum, the plan for plugin commands #7 Potion × 5" in the event list. Once edited by hand, it is an ordinary Script condition.
    • Runtime: no change. It is a Script condition, so any MZ-compatible runtime evaluates it.
  • Quick Event › Treasure gains Check Inventory Space (on by default) and a Failure Message.
    • Item, weapon and armor chests put the opening route, the reward, the message and Self Switch A inside that branch.
    • The Else branch shows the failure text, so a full party leaves the chest closed to try again later.
    • Gold chests, chests with the option unticked, and existing events are built exactly as before.
  • Fix: the Treasure dialog's Message field now reaches the event in the editor's language even when left untouched. It used to fall back to English.
  • Guide: docs/INVENTORY-CAPACITY.md, linked from docs/README.md.
  • Files: EventManager.js, event/EventCommandList.js, event/commands/ConditionalBranchEditor.js and I18nManager.js. Tests: item-capacity-chests.test.cjs (new) and quick-event-creation-20260812.test.cjs, whose expected Treasure output gains the branch.
  • 7 new phrases, translated in all 17 locales. This is a machine-assisted first pass and deserves a native speaker's review.

Tests

  • item-capacity-chests.test.cjs (new, 11 tests) covers:
    • the tagged Script round trip, including an edited or malformed script reopening as the author left it;
    • the event-list sentence;
    • item, weapon and armor chests wrapped in Can Receive with the failure text in Else, while gold chests and unticked chests are built as before;
    • whole-number ids and amounts, and the boundaries: empty, exact fit, short by one, full and over the cap;
    • a blocked chest opening once room is made and granting exactly once;
    • the cap asked of the live party each time, and a deleted entry failing quietly.
  • quick-event-creation-20260812 expects the new Treasure shape. The i18n coverage and locale-key tests pass.
  • The change is editor-only. The condition is a Script that any MZ-compatible runtime evaluates, so there is no runtime revision.

4. Action sequences: flat 2D lift and Wait for Animation

Problem

Two faults in native action sequences on flat 2D battles (no battle room):

  1. Float, Fall, Jump and Leap lost their height. The sequence subtracted its lift from sprite.y each frame. Sprite_Battler.updatePosition then rebuilt y from home + offset, so the lift lasted only until the next position update. There were three further problems:
    • Chaining two lift steps restarted from the wrong height, so Float → Fall or Fall → Jump jumped visibly.
    • Cleanup did not hand back exactly what it had taken.
    • An _offsetY set by something else, such as a plugin or a motion, was overwritten.
  2. Wait for Animation stopped waiting too early, or too late. It asked the battler sprites whether an animation was playing.
    • A sequence-owned animation with a mid-animation impact let the wait end at the impact.
    • A cancelled sequence, a missing animation entry, an Effekseer or MV effect that failed to load, or a target that died while the animation was queued could all leave the wait holding until the 15-second safety timeout.

What changed

All changes are in runtime/reactor_battle_presentation.js, mirrored in template/Demo/js.

  • Lift:
    • A lift is now applied to both sprite.y and sprite._offsetY, recorded as _rrAppliedLift, and taken back off at the start of the next pose and at cleanup. So updatePosition keeps it, and an outside _offsetY is preserved.
    • Lift heights come from one liftHeight(effect, time). A new lift step starts from the height the previous one has reached at that frame, so chains are seamless.
    • Battle rooms (3D) are unchanged: they already lift through _reactorRoomPosition.z.
  • Wait for Animation:
    • The sequence keeps its own media tickets (adapter.media, each tagged kind: 'animation' with its targets). The wait asks those tickets first, then the spriteset's animation sprites for its targets, then the queue, and only then the battler sprites.
    • It honours the step's role and its alive filter, and it can be cancelled.
    • A queued request leaves the wait once the queue drops it or all its targets are dead.
    • A missing $dataAnimations entry gives a ticket that is already finished.
    • P.isSequenceSpritePlaying treats a destroyed sprite, a sprite no longer in the spriteset, an MV bitmap error or an Effekseer load error as finished. Effekseer load failures are watched through SceneLayer.load / EffectManager.load.
    • Wait for Move, Motion, Popup and Effecting use the same target choice. Move and Motion also skip dead battlers, whose move or motion would never end.

No new user-visible strings; editor files are untouched apart from the tests.

Tests

  • New tests, which pass:
    • battle-presentation: "flat 2D float, fall, jump and leap keep vertical lift across Sprite_Battler.updatePosition, chain seamlessly and restore cleanly".
    • sequence-media: "waitFor animation holds past mid-animation impact until sequence-owned animation completes" and "waitFor animation terminates cleanly on cancel, missing data, Effekseer/MV load errors, and target death".
    • They load the real Sprite_Battler.prototype.updatePosition from reactor_sprites.js and the real presentation module in a vm context.
  • sync-runtime.cjs --check: the Demo matches runtime/.

Verification of the whole branch

  • npm test on this branch (Git Bash; node_modules linked in from a checkout with 0.99.7's lockfile installed): 10,134 tests, 47 failing. Compared by name with the same suite on the fork's main with upstream 0.99.7 merged in, there are no new failures from these changes:
    • The 46 known names are all environmental: symlinks refused without Developer Mode, no zip on the PATH, Git Bash's GNU tar, Linux-only AppImage tooling, and tests that assume POSIX paths.
    • three-version "vendored browser output reproduces exactly" fails because of the linked node_modules. It fails the same way on an unmodified upstream/main checkout with the same link, and passes in a checkout with its own node_modules.
  • Each part was also run as its own branch on the same base, with the same failing names.
  • The branch's tree equals the fork's main plus part 4, apart from upstream's changelog index and the revision header (checked with git diff). sync-runtime.cjs --check: the Demo matches runtime/.

Changelog entries (for editor/changelog/)

  • Effekseer animations keep up to 16000 particles at once instead of Effekseer's default 4000 (runtime 20261124.1), in the game and in the editor's animation previews. A full pool used to skip every new particle silently, so a big effect lost its later layers. An HDR effect and its companion, or one effect played on several targets, share the pool. Each context reserves about 80 MB of Effekseer's memory for it instead of about 20 MB. Graphics.effekseerContextSettings holds the numbers.

  • HDR sidecars can give bloom.prefilter (threshold, knee, clamp: Unity post-processing's bloom prefilter), animate bloom intensity with bloom.intensityKeys, and blend a second grade in with gradeB and gradeKeys. The keys are [[frame, value], ...] on the effect's own clock, slow motion included (runtime 20261124.1). Editor previews follow all three; older runtimes play bloom.intensity and grade.

  • HDR sidecars can pair an ordinary companion, drawn before the HDR light with optional depth occlusion and sharing the HDR effect's seed, transforms and lifetime. A missing companion selects the graded twin.

  • An HDR effect anchored on a 3D model plays its graded twin instead of the raw HDR file.

  • Distortion layers of screen animations drawn in the battle scene bend the scene again instead of drawing a dark copy of it.

  • Treasure chests wait for room. Conditional Branch › Reactor has Can Receive [Item/Weapon/Armor] [entry] × [amount]. It is true when the whole amount fits under the cap the game reports when the event runs ($gameParty.maxItems, so VisuStella's <Max: x> and Reactor's limits apply); a missing entry is false. It saves as a tagged Script condition, reopens in the dialog, reads as "Can Receive Item: [Trivial] The elements don't fit on the screen #1 Potion × 5" in the list, and stays a plain Script once edited by hand.

  • Quick Event › Treasure adds Check Inventory Space (on by default) and a Failure Message. An item, weapon or armor chest opens, gives its reward and sets Self Switch A only inside that branch. A full party gets the message, and the chest stays closed for another try. Gold chests and existing events are unchanged.

  • The Treasure dialog's Message field now reaches the event in the editor's language even when left untouched.

  • Guide: docs/INVENTORY-CAPACITY.md.

  • Native action sequences on 2D battles: Float, Fall, Jump and Leap keep their height while the battler's position updates, chain without a jump in height, and give back exactly what they took, an outside offset included (runtime 20261124.1).

  • Wait for Animation waits for the sequence's own animation to end, past a mid-animation impact. It ends at once when the sequence is cancelled, the animation entry is missing, its effect fails to load, or its targets die, instead of holding until the safety timeout.

Limits

  • (1) The 80 MB per context is reserved whether or not an effect needs it. I have not measured it on a low-memory machine.
  • (2) On this branch's base, only the suite and a battle-test boot were run; no HDR effect was looked at on screen. The on-screen measurements below were taken when the commits were written, on 0.99.4–0.99.5 runtimes:
    • Distortion: inside Meltdown's sphere the blue channel stays at 125–126 of 128, where it was 3.8–72 before. No pixels are black, where up to 42% of the screen was before. Refraction p90 is 0.34 of the screen height at its peak, against the reference capture's 0.32.
    • 3D model twin: checked on the Demo's 3D start map.
    • Show Animation: the same HDR effect draws through the HDR pass on 3D and 2D maps.
  • (2) Companions need matching exports: the same node order, spawn and life settings, and random-consuming renderer parameters in both. This isn't checked automatically.
  • (2) Unit tests don't prove GPU output. The depth prepass's zero colour and the light it keeps were measured by hand, as docs/HDR-EFFECT-OVERLAY.md describes.
  • (3) Existing chests are not converted. Only Treasure events created from now on get the check; older ones need rebuilding or a Can Receive branch added by hand.
  • (3) The translations are unreviewed.
  • (4) I have not watched a 2D battle play these steps on screen on this branch's base. The tests drive the real Sprite_Battler.prototype.updatePosition from reactor_sprites.js and the real presentation module in a vm context, with stub sprites, not PIXI.

Xehanort88 and others added 4 commits November 24, 2026 18:24
…1124.1)

Every Effekseer context was created with init(gl), so it kept Effekseer's
default pool of 4000 instances. When the pool is full Effekseer skips each new
particle (ManagerImplemented::CreateInstance returns null): nothing is thinned
and nothing is reported. The layers that spawn first keep everything and later
ones lose particles, and everything playing in the context shares the pool: an
HDR effect and its companion, one effect on several targets, other animations.
A Sky Break strike HDR play peaks at 5552, so about 1550 particles of its paint
volutes and embers were never made.

Graphics.effekseerContextSettings ({ instanceMaxCount: 16000, squareMaxCount:
40000 }) now initializes the overlay context, its restore after a context loss,
the in-scene layer and the 3D effects pass. The editor's animation previews
(Animations page, pickers, preview layer, generator) use the same numbers from
src/utils/EffekseerContextSettings.js, so a preview drops particles where the
game does. The largest single play among 965 installed test animations peaks
at 11728. A pool reserves about 5 KB per instance at init: about 80 MB of
Effekseer's heap per context instead of 20 MB.

effekseer-context-settings.test.cjs checks that every createContext site
passes the settings, that runtime and editor agree, and that the Demo copies
match. The 304 test files that read the changed sources: the same failures as
main, except three-version's vendored rebuild, which resolves node_modules
through this worktree's link (three.js and its inputs unchanged).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… distortion

The HDR overlay follow-ups built on PRs 78 and 79, brought onto 0.99.7 as
one change (they were seven commits, 2026-10-29 to 11-08, on a line that
upstream's later HDR work rewrote around):

- bloom.prefilter: Unity post-processing's bloom prefilter; a caller that
  passes none gets the sidecar's.
- bloom.intensityKeys: bloom intensity keyed on the effect's own clock.
- gradeB + gradeKeys: a second grade blended in over the effect.
- Synchronized ordinary companions drawn beside an HDR effect, before the
  light, with optional depth occlusion; the editor previews pair them too.
- An HDR effect anchored on a 3D model plays its twin.
- In-scene distortion copies the backdrop through an RGBA square instead
  of drawing a dark copy of the scene.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A Treasure quick event gave its reward through Change Items, which clamps at
the party's cap, so anything over it was lost and the chest still counted as
opened.

Conditional Branch > Reactor gains Can Receive [Item/Weapon/Armor] [entry] x
[amount]: true when numItems + amount <= $gameParty.maxItems, asked when the
event runs, so VisuStella's <Max: x> and Reactor's own limits apply; a missing
entry is false. It saves as a codec-tagged Script condition (kind
itemCapacityCondition), reopens in the dialog, reads as "Can Receive Item:
Psychronic-Games#7 Potion x 5" in the event list, and stays a plain Script once edited.

Quick Event > Treasure adds Check Inventory Space (on by default) and a
Failure Message. Item, weapon and armor chests put the opening route, the
reward, the message and Self Switch A inside that branch; Else shows the
failure text, so a full party leaves the chest closed for another try. Gold
chests, unticked chests and existing events are built as before. The Message
field now reaches the event translated even when left untouched.

Translations for 7 new phrases in all 17 locales (machine-assisted first
pass). Guide: docs/INVENTORY-CAPACITY.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… action sequences

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Xehanort88 Xehanort88 changed the title Feat/effekseer hdr chests sequences Effekseer pool, HDR overlay follow-ups, treasure-chest space check, action-sequence lift and waits (runtime 20261124.1) Nov 24, 2026
Psychronic-Games and others added 2 commits November 24, 2026 15:55
- Effekseer pool: the overlay context made at boot keeps Effekseer's default pool while screen animations play in the scene, where it only loads effects, and takes the large pool only when it draws them itself (Graphics._overlayEffekseerSettings, used at boot and after a lost context). The in-scene and 3D effects contexts, both made at first use, keep the large pool. A game that plays no effect costs what it did before. The context-settings test checks this rule.
- Flat 2D lift: a new sequence-media test drives a lifted battler through MZ's own move (updateMove) and checks it ends at the move's target. The code already guarantees it (each pose sets the offset outright and cleanup restores the saved values), so the test is a guard; no change.
- reactor_hdr_overlay.js used literal NUL characters as a key separator; they are now written as the \u0000 escape (same value), so the file is text again.
- Removed the never-set effect.isError and sprite._effect.isError checks; the bitmap isError() checks stay.
- Comments in reactor_hdr_overlay.js no longer cite revision numbers from another fork.
- HDR-EFFECT-OVERLAY.md and EFFEKSEER-IN-SCENE.md start from the restyled pages (docs/WRITING-GUIDES.md) and add the PR's material: companion and companionOccludes, bloom.prefilter, bloom.intensityKeys, gradeB and gradeKeys, twins for 3D-anchored effects, the in-scene distortion edge note, the editor's preview pairing, and the install order.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The restore now sizes the new overlay context by Graphics._overlayEffekseerSettings,
as at boot; the test's stand-in Graphics lacked it, so the restore threw inside its
try and kept the old context. The stand-in gains the helper, and the test checks the
restored context is initialized with what the helper gives.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Psychronic-Games
Psychronic-Games merged commit 8a19b1e into Psychronic-Games:main Nov 25, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants