[PR #7569] Native mods: declarative particle motion, size and fade #7679

Open
opened 2026-11-03 07:21:53 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/7569
Author: @Xmilon
Created: 11/2/2026
Status: 🔄 Open

Base: main ← Head: content/particle-behaviour


📝 Commits (4)

  • 2e98a62 feat(particles): add declarative mod particle behaviour
  • cdad8e2 test(particles): use a valid air registry for motion checks
  • 81e9020 Mod particles: spawn velocity, random velocity range and sprite animation modes
  • b4f5ca7 Mod particles: the sprite animation advances in the tick

📊 Changes

2 files changed (+555 additions, -7 deletions)

View changed files

📝 crates/horizon-client-render/src/particles.rs (+504 -7)
📝 docs/native-mods.md (+51 -0)

📄 Description

🤖 Opened by Xmilon's AI agent (Claude Code orchestrating GPT-6.1 Sol), not by Xmilon personally.

What and why

Part of #7465. Delivers the declarative simple-particle slice first; arbitrary per-particle code hooks are deferred.

A native mod can add horizon:behaviour to its existing assets/<namespace>/particles/<name>.json and declare exact initial velocity, gravity, friction, lifetime, and linear [start, end] size/alpha curves. All fields are optional. Missing or empty declarations preserve today's seeded random draws and defaults. Invalid declarations warn and fall back as a whole without discarding the sprite set. Values are bounded and checked before use.

Motion reuses the existing vanilla base tick, including collision and ground drag. Fixed-size curve data is copied at spawn; the added per-particle tick path does not allocate or look up strings/maps. Fading particles use the blended render layer. Reloaded declarations affect future spawns, not existing particle values.

Only crates/horizon-client-render/src/particles.rs and docs/native-mods.md change. No dependencies, protocol fields, native hooks, or mod API fragments change; API generation is not applicable.

Kind

  • parity: Horizon now does what vanilla 26.3 does
  • bug: a crash or a breakage
  • perf: faster, or less memory
  • feature: something new for players (listed under New in the release notes)
  • extra: Horizon-only, off by default
  • tooling: tools, CI, tests, harnesses
  • docs

Vanilla reference

Horizon-only resource declaration, not a new vanilla-parity claim. Reuses Horizon's existing Particle.tick/SingleQuadParticle base behaviour rather than replacing vanilla tick math. No new vanilla bytecode oracle was run.

Other projects' code

None.

Self-check

  • cargo fmt --all: passed.
  • git diff --check and git diff upstream/main --check: passed.
  • python tools/check_public_tree.py: passed.
  • cargo clippy -p horizon-client-render --all-targets -- -D warnings: attempted; blocked before checking the touched crate by Windows memory/quota exhaustion while compiling dependencies (memory allocation ... failed, OS error 1453, and STATUS_STACK_BUFFER_OVERRUN); no successful lint result claimed. Not repeated after this recorded attempt.
  • Full default-parallel cargo test -p horizon-client-render: compiler OOM, so tests were retried serially.
  • cargo test -p horizon-client-render -j 1: passed: 1,163 unit tests passed / 38 ignored; 7 integration tests passed / 1 ignored; doc-tests passed (0 tests).
  • Focused motion/gravity/friction/curve/removal test also passed independently.
  • Searched tests/ Python sources for references to the edited renderer file and documentation: none, so no source-reading Python fixture needs updating.

Coverage: declarations loaded/reloaded from actual particle JSON; invalid-data fallback and default preservation; input type/range validation; linear curve endpoints, interpolation and clamping; motion/gravity/friction order and lifetime removal; alpha and blended-layer vertex output. A new test initially used an invalid empty block registry; the follow-up commit corrects that fixture to contain air.

Unverified

No in-game launch, visual screenshot, allocation profiler, or vanilla parity harness run. Rendering is checked at CPU vertex/layer output, not on-screen. This slice intentionally offers linear curves and constant gravity/friction only, with no arbitrary code hook.

Written by an AI agent (Claude Code orchestrating GPT-6.1 Sol) for Xmilon

🤖 Generated with Codex (GPT-6.1 Sol), orchestrated by Claude Code.

Update: the declared velocity now adds the velocity the spawn call passes (it no longer replaces it); velocity_jitter gives a random range per axis from the particle's seeded generator; animation (age | loop + frame_ticks | random | first) chooses how it walks its sprites. New unit tests for each; cargo test -p horizon-client-render --lib particles: 22 passed.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/7569 **Author:** [@Xmilon](https://github.com/Xmilon) **Created:** 11/2/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `content/particle-behaviour` --- ### 📝 Commits (4) - [`2e98a62`](https://github.com/horizon-rust/horizon/commit/2e98a62e1bf20487e5471652a7cd690ad4a5bbf0) feat(particles): add declarative mod particle behaviour - [`cdad8e2`](https://github.com/horizon-rust/horizon/commit/cdad8e28e520c8bd997a509f1b887f795996b405) test(particles): use a valid air registry for motion checks - [`81e9020`](https://github.com/horizon-rust/horizon/commit/81e9020fa97100269295f606e4d792408d91e6d5) Mod particles: spawn velocity, random velocity range and sprite animation modes - [`b4f5ca7`](https://github.com/horizon-rust/horizon/commit/b4f5ca7c56d3b7fa3fb5a053ffce05bbf14b33bf) Mod particles: the sprite animation advances in the tick ### 📊 Changes **2 files changed** (+555 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/particles.rs` (+504 -7) 📝 `docs/native-mods.md` (+51 -0) </details> ### 📄 Description > 🤖 Opened by Xmilon's AI agent (Claude Code orchestrating GPT-6.1 Sol), not by Xmilon personally. ## What and why Part of #7465. Delivers the declarative simple-particle slice first; arbitrary per-particle code hooks are deferred. A native mod can add `horizon:behaviour` to its existing `assets/<namespace>/particles/<name>.json` and declare exact initial velocity, gravity, friction, lifetime, and linear `[start, end]` size/alpha curves. All fields are optional. Missing or empty declarations preserve today's seeded random draws and defaults. Invalid declarations warn and fall back as a whole without discarding the sprite set. Values are bounded and checked before use. Motion reuses the existing vanilla base tick, including collision and ground drag. Fixed-size curve data is copied at spawn; the added per-particle tick path does not allocate or look up strings/maps. Fading particles use the blended render layer. Reloaded declarations affect future spawns, not existing particle values. Only `crates/horizon-client-render/src/particles.rs` and `docs/native-mods.md` change. No dependencies, protocol fields, native hooks, or mod API fragments change; API generation is not applicable. ## Kind - [ ] parity: Horizon now does what vanilla 26.3 does - [ ] bug: a crash or a breakage - [ ] perf: faster, or less memory - [ ] feature: something new for players (listed under New in the release notes) - [x] extra: Horizon-only, off by default - [ ] tooling: tools, CI, tests, harnesses - [ ] docs ## Vanilla reference Horizon-only resource declaration, not a new vanilla-parity claim. Reuses Horizon's existing `Particle.tick`/`SingleQuadParticle` base behaviour rather than replacing vanilla tick math. No new vanilla bytecode oracle was run. ## Other projects' code None. ## Self-check - `cargo fmt --all`: passed. - `git diff --check` and `git diff upstream/main --check`: passed. - `python tools/check_public_tree.py`: passed. - `cargo clippy -p horizon-client-render --all-targets -- -D warnings`: attempted; blocked before checking the touched crate by Windows memory/quota exhaustion while compiling dependencies (`memory allocation ... failed`, OS error 1453, and `STATUS_STACK_BUFFER_OVERRUN`); no successful lint result claimed. Not repeated after this recorded attempt. - Full default-parallel `cargo test -p horizon-client-render`: compiler OOM, so tests were retried serially. - `cargo test -p horizon-client-render -j 1`: passed: 1,163 unit tests passed / 38 ignored; 7 integration tests passed / 1 ignored; doc-tests passed (0 tests). - Focused motion/gravity/friction/curve/removal test also passed independently. - Searched `tests/` Python sources for references to the edited renderer file and documentation: none, so no source-reading Python fixture needs updating. Coverage: declarations loaded/reloaded from actual particle JSON; invalid-data fallback and default preservation; input type/range validation; linear curve endpoints, interpolation and clamping; motion/gravity/friction order and lifetime removal; alpha and blended-layer vertex output. A new test initially used an invalid empty block registry; the follow-up commit corrects that fixture to contain air. ## Unverified No in-game launch, visual screenshot, allocation profiler, or vanilla parity harness run. Rendering is checked at CPU vertex/layer output, not on-screen. This slice intentionally offers linear curves and constant gravity/friction only, with no arbitrary code hook. Written by an AI agent (Claude Code orchestrating GPT-6.1 Sol) for Xmilon 🤖 Generated with Codex (GPT-6.1 Sol), orchestrated by Claude Code. **Update:** the declared `velocity` now adds the velocity the spawn call passes (it no longer replaces it); `velocity_jitter` gives a random range per axis from the particle's seeded generator; `animation` (`age` | `loop` + `frame_ticks` | `random` | `first`) chooses how it walks its sprites. New unit tests for each; `cargo test -p horizon-client-render --lib particles`: 22 passed. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#7679
No description provided.