Repository navigation
feat(engine): Let a Character Manifest scale its gravity - #1944
Conversation
A manifest may declare gravity = 0.25..2, a multiple of the default fall. Undeclared stays exactly 1. Part of #1500.
|
Fix round at
Also took the note: the — Cursor agent (P. Coder), on @omesser's behalf. |
omesser
left a comment
There was a problem hiding this comment.
Soft+Hard — tip d1efb909 — Cleared
| Axis | Verdict |
|---|---|
| Soft | Pass |
| Spec | Pass |
| Hard | Pass |
| Total | Cleared |
Prior fixes verified
- Fixed.
the_default_gravity_scale_falls_as_it_always_hasnow pins main's numbers (first tick Falling withvelocity.y == 57.6, Grounded on tick 42) for bothEngine::newandwith_gravity_scale(GravityScale::DEFAULT). I ran it red against this tip three ways:- Falling line
self.gravity * dt * 0.999gives57.5424, red. - Falling line
* 1.001gives57.6576, red. GRAVITY * scale.get() * 0.999inwith_gravity_scale, red.
- Falling line
- Fixed. "How to test" now says
character.manifest.
The non-blocking note is done too: the JUMP_SPEED doc now says "at default gravity".
Soft — Pass
The new diff is just the test rewrite and the doc line. The test asserts observable state and velocity, not internals, and it isn't a self-comparison any more. Comments are 3 lines or fewer, there are no sleeps, and there's no string parsing.
Spec — Pass
Unchanged from the last gate. This is the manifest slice of #1500, and zero gravity, the fish, perching and the Settings override stay split out to #1939 to #1942.
Hard — Pass
- fidget-core on this tip: 658 pass, plus 28 package tests. Nothing outside
engine.rschanged since1dbef15e, so the earlier Node and bin results still stand. - CI at review time: build, npm-audit, cargo-audit and trufflehog pass. checks (ubuntu, macOS), windows, renderer and detect-secrets are still pending. CI is reported here, not a merge condition.
Fix list
Fix list empty.
— Cursor agent (subagent of P. Architect), on @omesser's behalf.
omesser
left a comment
There was a problem hiding this comment.
Soft CLEARED
Tip: d1efb909
What changed
- Manifest field: a Character Manifest may declare
gravity, a multiple of the default fall from 0.25 to 2.GravityScalerefuses anything outside that range, NaN included, and the parser names the bad value. - Engine:
Engine::with_gravity_scalesets each Instance's gravity, the Roster passes the Character's scale in, and Falling uses it. Undeclared stays at 1. - Docs and tests: the manifest table documents the field. New tests cover lighter and heavier falls, a higher throw under light gravity, the default fall pinned to main's numbers, and accepted and rejected manifest values.
What is wrong
Nothing blocking. GRAVITY has no other reader, so no fall or jump path keeps the old constant.
Soft-FIX
None
Non-blocking
- Field doc:
Character::gravity_scaleis the only nearby field with no doc comment. One line saying it comes from the manifest'sgravitywould match its siblings.
Verified: cargo test -p fidget-core passes on the box at this tip, 658 unit tests and 28 integration tests.
— Cursor agent (Architect), on @omesser's behalf.
What
A Character Manifest can now declare
gravity, a multiple of the Engine's default fall (GRAVITY, 3600 pt/s²). The Roster reads it when it builds each Instance. Leave it out and you get 1, which keeps every frame exactly as it is today.GravityScaleinfidget-coreaccepts only0.25..=2. The manifest boundary rejects0, negatives, NaN, infinity and non-numbers by name:"gravity" is 0, and must be a number from 0.25 to 2, where 1 is the default fall.Engine::with_gravity_scalesets that Instance's gravity, and Falling uses it.docs/DEVELOPMENT.mddocuments the field.Why
Oded wants Characters that don't all fall like a stone: a fish, a bird, something floaty. This is the first slice of #1500. Each Character gets its own gravity. Zero gravity and floating are left for later.
Why 0.25 to 2.
Settings override deferred. A global override needs a Settings form, a slider, persistence and a live op to every Engine. That is as big as this slice, so it's tracked separately.
Part of #1500. Follow-ups, filed as sub-issues:
How to test
cargo test -p fidget-core. The new tests check that a lighter Character lands later and a heavier one sooner, that the same throw goes higher under lighter gravity, that the default scale still falls exactly as main does (the_default_gravity_scale_falls_as_it_always_has: Falling at velocity.y 57.6 on tick 1, Grounded on tick 42), that the Roster gives an Instance its Character's gravity, and that manifests accept and reject the right values.gravity = 0.5to a character'scharacter.manifest, run the app, and drag and drop the character. It should fall noticeably slower.— Cursor agent (P. Coder), on @omesser's behalf.