Skip to content

Feature/enhanced effects#33

Merged
manix84 merged 2 commits into
mainfrom
feature/enhanced-effects
Jun 11, 2026
Merged

Feature/enhanced effects#33
manix84 merged 2 commits into
mainfrom
feature/enhanced-effects

Conversation

@manix84

@manix84 manix84 commented Jun 11, 2026

Copy link
Copy Markdown
Owner

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

  • Added a new AtmosphericPlayerMotion interface 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)
  • Updated AtmosphericRainEffect, AtmosphericSnowEffect, and AtmosphericAshEmberEffect to support player-relative motion through options and a new setPlayerMotion() method. Particle motion, spawn, and rendering now incorporate player movement when enabled. [1] [2] [3] [4] [5] [6]

Documentation updates

  • Updated README.md, src/README.md, API.md, and WHATSNEW.md to document the new player-relative motion feature for atmospheric effects, including usage notes and option descriptions. [1] [2] [3] [4] [5]

Testing

  • Added and extended tests in src/__tests__/atmospheric-effects.test.ts to verify that player-relative motion only affects particles when enabled, and that static behavior is preserved otherwise. [1] [2] [3] [4]

Version bump

  • Bumped the package version to 4.7.0 to reflect the added feature.

manix84 added 2 commits June 11, 2026 11:28
- 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.
Copilot AI review requested due to automatic review settings June 11, 2026 10:43
@manix84 manix84 enabled auto-merge (squash) June 11, 2026 10:43
@manix84 manix84 merged commit 2979aa9 into main Jun 11, 2026
8 checks passed
@manix84 manix84 deleted the feature/enhanced-effects branch June 11, 2026 10:45

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +271 to +272
const densityBoost = getMotionDensityBoost(this.options.playerMotion);
const maxDrops = Math.ceil(this.options.maxDrops * densityBoost);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  • AtmosphericRainDrop is a publicly exported type (re-exported from src/index.ts), and adding a new required depth field 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;
};

Comment on lines +131 to +136
const staticRain = createAtmosphericRainEffect({
maxDrops: 5,
playerMotion: { velocityZ: 240 },
random: () => 0.25,
spawnRate: 50,
});
Comment on lines +137 to +142
const movingRain = createAtmosphericRainEffect({
maxDrops: 5,
playerMotion: { enabled: true, velocityZ: 240 },
random: () => 0.25,
spawnRate: 50,
});
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