Skip to content

Phase 1 / Forge / Forge 3D integration (semi-implicit Euler)#58

Merged
guysenpai merged 14 commits into
mainfrom
phase-1/forge/integration-euler
Jul 23, 2026
Merged

Phase 1 / Forge / Forge 3D integration (semi-implicit Euler)#58
guysenpai merged 14 commits into
mainfrom
phase-1/forge/integration-euler

Conversation

@guysenpai

Copy link
Copy Markdown
Contributor

Milestone brief: briefs/M1.1.5-integration-euler.md

Sixth core sub-milestone of the M1.1 rigid arc — the FIRST where bodies move. Adds semi-implicit (symplectic) Euler integration as an internal free-flight pass over the forge_3d SoA store. No solver/contacts, no PhysicsModule wiring (M1.1.6 / M1.1.15).

Closing notes

Delivered. pipeline/integration.zig integrate(bm, dt, gravity) — one pure per-tick pass, ascending slot-index order, isAliveIndex-filtered over the non-compacting SoA store, free-flight only (broadphase/narrowphase exist but are never invoked; contact response is M1.1.6). Linear: gravity as an acceleration × gravity_factor (mass-independent), Jolt clamped-linear damping, position from the new velocity. Angular: α = (R·I_local_inv·Rᵀ)·τ, clamp-damped ω, first-order orientation q ← normalize(q + ½·dt·(ω_quat ⊗ q)) with world-space ω on the LEFT; gyroscopic term dropped. Body gained force/torque accumulator columns; BodyManager gained the stale-safe velocity getters/setters, addForce/addTorque, addImpulse (addTorque/setAngularVelocity internal — no public interface change). No EPA/GJK/manifold file touched; PhysicsModule not instantiated.

Threshold discipline (M1.1.4 class). The only guard is the damping clamp max(0, 1 − d·dt) (physical, not a geometric epsilon). The first-order quaternion path divides by no |ω| and needs no zero guard — ω_quat ⊗ q ⊥ q in 4D, so ‖q + dq‖ ≥ 1 and the renormalisation is never near-zero.

Tests. 112/112 green at f32 AND -Dphysics_f64=true, Debug AND ReleaseSafe; zig fmt --check, zig build lint, zig build clean. Discrete semi-implicit free-fall oracle (−4.98675 m / −9.81 m/s, tolerance justified at the site), mass-independence, gravity_factor scaling, damping bend + clamp, force consume-once, impulse, static/kinematic invariance (position + orientation + accumulators-cleared), freed-slot skip observed bit-exact, angular closed form on a rotated anisotropic box, angular damping + clamp, unit-quaternion preservation, ω=0 no-op/no-NaN, left-product lock, and full-integrator determinism (linear + angular, bit-identical).

Recorded deviations / decisions. (1) E1 mutator/getter/isAliveIndex tests placed in the existing tests/body_manager_test.zig (BodyManager's established acceptance-test home) — outside the brief's file list, justified. (2) f32 fix: descriptor mass/gravity_factor are always f32 (caught by the f64 sweep). (3) Codex review P2×2, TEST-ONLY (production untouched): dead-slot skip now observed bit-exact incl. stale-force-not-cleared, and the LEFT quaternion product locked by a non-commutative one-step oracle with a discrimination guard.

§3.6.1 audits. Language: production code, CLAUDE.md, and the brief's LIVING section are French-free (one leaked French spec quote in body.zig's doc comment was removed). The brief's FROZEN SECTION retains verbatim French spec citations authored by Claude.ai (the demonstrator label, the plan row, the §2 "reset chaque fixed tick" contract) — left untouched per the FROZEN-section rule. Drift: the introduced symbols are referenced consistently across integration.zig/root.zig/body_manager.zig/tests — no orphaned or half-renamed references.

Out of scope — confirmed untouched. No solver / Sequential Impulses / friction / restitution / warm-start, no sleeping, no CCD, no substep handling, no kinematic position-from-velocity, no gyroscopic term, no ECS↔BodyManager sync, no PhysicsModule wiring, no bench, no spec-file edit, no EPA hotfix.

Validation

  • All Scope deliverables present (E1 accumulators + mutators/isAliveIndex; E2 linear + gravity + damping + oracle; E3 angular + close)
  • No drift into Out of scope
  • Acceptance tests green in Debug AND ReleaseSafe, at f32 AND -Dphysics_f64=true (112/112)
  • zig build, zig build test, zig fmt --check, zig build lint green
  • CLAUDE.md §3.4 updated (current-state table, +1 Tags row, open-decisions delta, "Last updated") and committed on-branch
  • Language audit §3.6.1 passed (diff + brief; frozen-section spec citations noted)
  • Local drift audit §3.6.1 passed
  • Closing notes filled; Status: CLOSED, Closed: 2026-07-23; final docs(brief): close M1.1.5 commit

Merge and tag (v0.11.5-integration-euler) are Guy's — not performed here.

🤖 Generated with Claude Code

@guysenpai
guysenpai merged commit 6e9ad44 into main Jul 23, 2026
10 checks passed
@guysenpai
guysenpai deleted the phase-1/forge/integration-euler branch July 23, 2026 12:00
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.

1 participant