Feature/enhanced effects#33
Conversation
- Introduced AtmosphericPlayerMotion type for player motion settings. - Updated SystemsStoryArgs to include motion presets and enabled flags for rain, snow, and ash/embers. - Enhanced AtmosphericRain, AtmosphericSnow, and AtmosphericAshAndEmbers stories to support player motion, allowing weather effects to react to player movement. - Added controls for selecting motion presets and toggling motion on/off in the story demos.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fb0aedc772
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const densityBoost = getMotionDensityBoost(this.options.playerMotion); | ||
| const maxDrops = Math.ceil(this.options.maxDrops * densityBoost); |
There was a problem hiding this comment.
Keep motion spawning within configured particle caps
When playerMotion is enabled with forward or turn velocity, densityBoost raises the effective cap above the caller's maxDrops (and the same pattern is used for snow/ash). A game that sets a low max for performance or visual density can now get up to ceil(maxDrops * densityBoost) active particles instead of the configured maximum; consider boosting spawn rate/motion behavior while still clamping active particles to the explicit max.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Pull request overview
This PR adds opt-in player-relative motion support to the engine’s atmospheric world effects (rain/snow/ash+embers), allowing particles to respond to player forward movement, lateral velocity, and turning while preserving existing behavior by default.
Changes:
- Introduces
AtmosphericPlayerMotion(plus normalization/helpers) and wires it into rain, snow, and ash/ember effect spawning, simulation, and rendering. - Adds Storybook “Combo Effects” demos and extends existing atmospheric demos with motion presets/toggles.
- Updates docs, API listing text, tests, and bumps package version to
4.7.0.
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| WHATSNEW.md | Notes the new optional player-relative motion for atmospheric effects. |
| README.md | Documents how to enable player-relative motion via options or setPlayerMotion(). |
| src/README.md | Updates feature bullets to mention player-relative motion for rain. |
| API.md | Updates the atmospheric effects row descriptions to include player-relative motion. |
| package.json | Bumps version to 4.7.0. |
| package-lock.json | Updates lockfile version metadata to 4.7.0. |
| src/index.ts | Re-exports the new AtmosphericPlayerMotion type. |
| src/atmospheric-effects.ts | Implements normalized motion handling + integrates motion into rain/snow/ash simulation and rendering. |
| src/tests/atmospheric-effects.test.ts | Adds coverage to verify motion only applies when enabled (and preserves static behavior otherwise). |
| src/stories/systems/systems-demos.ts | Adds motion controls/presets and new combo demos layering screen + atmospheric effects. |
| src/stories/systems/ComboEffects.stories.ts | New Storybook entry exposing the combo effect stories. |
| src/stories/systems/README.md | Documents Combo Effects stories and mentions player-relative motion in atmospheric stories. |
Comments suppressed due to low confidence (1)
src/atmospheric-effects.ts:42
AtmosphericRainDropis a publicly exported type (re-exported fromsrc/index.ts), and adding a new requireddepthfield is a TypeScript breaking change. That contradicts the PR's “fully backward-compatible” claim for TS consumers who reference this type.
Consider keeping the exported AtmosphericRainDrop shape stable and introducing an internal drop type that includes depth (or make depth optional with a sensible internal default).
export type AtmosphericRainDrop = {
depth: number;
length: number;
speed: number;
x: number;
y: number;
};
| const staticRain = createAtmosphericRainEffect({ | ||
| maxDrops: 5, | ||
| playerMotion: { velocityZ: 240 }, | ||
| random: () => 0.25, | ||
| spawnRate: 50, | ||
| }); |
| const movingRain = createAtmosphericRainEffect({ | ||
| maxDrops: 5, | ||
| playerMotion: { enabled: true, velocityZ: 240 }, | ||
| random: () => 0.25, | ||
| spawnRate: 50, | ||
| }); |
This pull request introduces optional player-relative motion to all atmospheric effects (rain, snow, ash/embers), allowing particles to react to player movement, velocity, and turning. This enables more immersive effects where weather and debris respond to the player's actions. The change is fully backward-compatible: player-relative motion is opt-in via options or a new setter method. The documentation and tests have been updated to reflect and verify the new behavior.
Atmospheric effects: Player-relative motion support
AtmosphericPlayerMotioninterface and normalized handling, allowing effects to optionally receive player movement data (velocity, turning, etc.) and influence how particles spawn, move, and render. (src/atmospheric-effects.tsR6-R37, Fd799051L85R116)AtmosphericRainEffect,AtmosphericSnowEffect, andAtmosphericAshEmberEffectto support player-relative motion through options and a newsetPlayerMotion()method. Particle motion, spawn, and rendering now incorporate player movement when enabled. [1] [2] [3] [4] [5] [6]Documentation updates
README.md,src/README.md,API.md, andWHATSNEW.mdto document the new player-relative motion feature for atmospheric effects, including usage notes and option descriptions. [1] [2] [3] [4] [5]Testing
src/__tests__/atmospheric-effects.test.tsto verify that player-relative motion only affects particles when enabled, and that static behavior is preserved otherwise. [1] [2] [3] [4]Version bump
4.7.0to reflect the added feature.