Skip to content

vehicle-dynamics-6

Choose a tag to compare

@lamb2k lamb2k released this 23 Nov 00:03
· 12 commits to main since this release
466bc6b

A build-time stop for the vehicle step's closest-point search when a body is far off the line (airborne over a gap). Off by default: every SH-2 object is identical to the previous main's.

  • Change: SH2Z_VD_LOCATE_FAR (whole units 0..32767, default 0 = off) and SH2Z_VD_LOCATE_FAR_RUN (default 8). The search in sh2z_vd_step and sh2z_vd_step2 stops when its residual stays above FAR units for RUN passes in a row, and keeps the state it has. A search that converges, or overshoots and comes back, is never stopped and equals the library word for word. Without the stop, a body hundreds of units off the line has no closest point and runs all 99 passes every tick (about 20 ms on an SH-2 at 28.6 MHz).
  • API: two build-time macros; no function or struct changes. Empty host hooks SH2Z_VD_LOCATE_FAR_HIT() and SH2Z_VD_LOCATE_PASS(d). Every translation unit of one image must use the same values.
  • Objects: with the macro at 0, all 51 SH-2 objects are identical to the previous main's; with FAR 128 no new undefined symbol and no libc memcpy, memset or memmove.
  • Evidence: HOST: vehicle_locate_exact, 363,897 checks under GCC, Clang and ASan/UBSan, including 120,000 randomised searches against a second build with FAR 128 (119,221 unstopped and equal word for word, 779 stopped after exactly RUN passes above FAR); 9 of 9 mutation controls caught. No instruction model capture (the default object is unchanged), no console run. CI on the merged head passes (host, SH-2 cross compile with the libc check, math lab, docs). Validation record.
  • Merge: PR #82, merge 466bc6b.
  • Guide: saturn/VEHICLE_DYNAMICS.md.