Skip to content

Releases

vehicle-dynamics-7

Choose a tag to compare

@lamb2k lamb2k released this 23 Nov 19:24
c8e2869

The closest-point search of the vehicle dynamics gains two build-time changes for a body far off the line, both off by default. With both off, the objects of the vehicle units are identical to vehicle-dynamics-6. Approximation, in the approved class.

  • Change: SH2Z_VD_LOCATE_DAMP (passes, default 0): after that many passes of a call, the secant step through the last two passes replaces the pass's step when it is not longer and has its sign. It fixes the swing of a body near the centre of curvature, where the step is about twice the Newton step. SH2Z_VD_LOCATE_FLIP (flips, default 0): ends a search that flips between two nodes and returns to the same parameter every second pass, on the parity the 99th pass has.
  • API: two new build-time macros in sh2zam/vehicle_dynamics_experimental.h; no new entry points, no change to existing signatures. Every translation unit of one image must use the same values.
  • Objects: no libc memcpy, memset or memmove in the SH-2 objects; compiled with -Wall -Wextra -Werror. With the macros off, the objects of sh2zam_vehicle_dynamics, sh2zam_vehicle_dynamics2 and sh2zam_vehicle_contact are byte-identical to main (cmp).
  • Evidence: HOST: test_vehicle_locate7 under GCC and Clang strict and ASan/UBSan (506,265 checks; 120,000 randomised searches against the 99-pass library as oracle: untouched searches equal word for word, damped steps never longer than the step they replace, flip stops on the right parity, converged end states within the bounds in the record); mutate_vehicle_locate7.sh catches 12 of 12 controls. No instruction model, no console run. CI on the head passes (host, SH-2 cross compile, math lab, docs). Validation record.
  • Merge: PR #85, merge c8e2869.
  • Guide: saturn/VEHICLE_DYNAMICS.md.

vehicle-dynamics-6

Choose a tag to compare

@lamb2k lamb2k released this 23 Nov 00:03
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.

line-field-15

Choose a tag to compare

@lamb2k lamb2k released this 23 Nov 01:15
b1e1e39

The line field can refill a vehicle on a recharge strip by a share of its own energy capacity, and not while it is in the air. With the new parameter at 0 the step is line-field-14's, bit for bit.

  • Change: surface->recharge_share, appended to the surface block (Q16 share of the vehicle's own max_energy refilled a tick on a recharge strip, rounded to nearest, clamped at max_energy; none while the vehicle is in the air; a negative value reads as 0). sh2z_field_recharge(f, v, ticks) applies the same refill to a vehicle the owner drives itself, from one static inline shared with the step, so the two cannot differ. With the share 0 the one global recharge applies in the air as before.
  • API: one new field, recharge_share, and one new entry point, sh2z_field_recharge.
  • Cost: one compare of the share on a recharge zone; with the share set, a 64-bit multiply on a step that is on a strip. Nothing elsewhere.
  • Objects: no libc memcpy, memset or memmove in the SH-2 objects; the line field's undefined symbols are the same as on main; compiled with -Wall -Wextra -Werror.
  • Evidence: HOST: line_field_exact 26,367,628 checks under GCC, Clang and ASan/UBSan; 400 random scenes hash to the same value with the share at 0 as main does (0x6f29a14e3fe9f895, re-checked at merge against main's step); a control for each claim; 11 of 11 mutation controls caught. No instruction model, no console run. CI on the head passes (host, SH-2 cross compile, math lab, docs). Validation record.
  • Merge: PR #83, merge b1e1e39.
  • Guide: saturn/LINE_FOLLOWER.md.

body-contact-2

Choose a tag to compare

@lamb2k lamb2k released this 23 Nov 10:39
e83dae5

Body contact gains a sorted sweep, an exact range filter and a pair-list resolve, so a caller that computes a body's position or velocity lazily pays for them only where a pair needs them. No body-contact-1 result changes.

  • Change: sh2z_bc_sweep (the pairs within a window, in the field walk's order, with the bodies they touch marked), sh2z_bc_range (pairs of two ACTIVE bodies within the reach on every axis, tested in 32 bits) and sh2z_bc_field_resolve_list (the pair function over a list, with the field's history). sh2z_bc_field_resolve also tests the position box in 32 bits before it calls the pair function; the test never rejects a pair the pair function accepts.
  • API: three new entry points; no new types, no change to existing signatures.
  • Objects: no libc memcpy, memset or memmove in the SH-2 objects; compiled with -Wall -Wextra -Werror.
  • Evidence: HOST: body_contact_exact under GCC and Clang strict and ASan/UBSan, with 20 races x 300 ticks x 30 bodies of the list path equal to the field walk, the int32-range case and two controls that are caught. At merge, a separate differential of main's field walk against this one (16,000 ticks, 24 bodies, positions across the whole int32 range) showed 0 differences in outputs, history and counters. No instruction model, no console run. CI on the head passes (host, SH-2 cross compile, math lab, docs). Validation record.
  • Merge: PR #84, merge e83dae5.
  • Guide: saturn/BODY_CONTACT.md.

vehicle-dynamics-5

Choose a tag to compare

@lamb2k lamb2k released this 22 Nov 19:06
cc18a63

The half-pipe road shape in sh2z_vd_step2: a trough, the pipe's ground with the top open (it was treated as an open road).

  • Change: SH2Z_VD_SHAPE_HALF_PIPE takes the pipe's height, up vector, radial clamp and joins. The body leaves the surface when road_up . disp - tube.pipe_rim + sin(22.5 deg) * radius >= 0 (radius tapered by the share over a join), on the whole span rather than only over a join. Gravity acts along the road's up everywhere, also over a join, where the pipe blends it.
  • API: none changed. The shape is selected by the node's shape byte; the constants are the existing pipe_rim and the rule's fixed sin(22.5 deg). sh2z_vd_step (no tubes) is unchanged and still treats a half-pipe as open road.
  • Objects: 49 of the 51 SH-2 objects are byte-identical to the previous main's; the two tube objects change (sh2zam_vehicle_dynamics2.o and sh2zam_vehicle_contact2.o). No libc memcpy, memset or memmove.
  • Evidence: HOST: vehicle_dynamics2_exact, 438 checks under GCC, Clang and ASan/UBSan, with a rim oracle over a 360-position sweep, and 10 of 10 mutation controls caught. MODELLED: two new instruction-model scenarios, half_pipe_floor (mean 8,940.4 cycles a tick) and half_pipe_join (8,981.6), every tick checked word for word against the host build in the pinned Yabause interpreter; flat RAM, not Saturn timing. The existing step2 scenarios keep their ticks and results and move by about 0.2% at most in cycles, because the step2 object changed. CI on the merged head passes (host, SH-2 cross compile with the libc check, math lab, docs). No console run. Validation record.
  • Known, not changed: airborne_up overflows a signed integer when the gravity up vector is exactly (0, -1, 0); it predates this change and is shared by the tube shapes.
  • Merge: PR #78, merge cc18a63.
  • Guide: saturn/VEHICLE_DYNAMICS.md.

vehicle-dynamics-4

Choose a tag to compare

@lamb2k lamb2k released this 22 Nov 18:44
46cd07f

The engine force carried in Q(16+n): a build-time scale for the vehicle step's force constants.

  • Change: SH2Z_VD_FORCE_FRAC (16 to 28, default 16) sets the fraction bits of the engine force constants (force_low, force_slide, force_high, top_force) and the body's accel_force. A constant such as 0.10027 is no longer rounded to a multiple of 2^-16. Above 16 the force chain runs in int64 with one rounding per product (ties up, saturating to int32), and the force added to the acceleration is converted to Q16 once, at the force application.
  • Compatibility: at the default 16 all 51 SH-2 objects of saturn/src are byte-identical to the previous main's (checked on the CI artifacts: every library object, libsh2zam.a and every model ELF identical). The caller's constants must use the scale the library is built with.
  • Evidence: HOST: vehicle_force_exact, 134,467 checks under GCC, Clang and ASan/UBSan: 200,000 random states against a long-double oracle (error at most 2.7 force steps and 1.5 acceleration steps against bounds of 5 and 2), exact stored constants, saturation, and the negative controls. CI on the merged head passes (host, SH-2 cross compile with the libc check, math lab, docs). No console run and no instruction-model capture. Validation record.
  • Merge: PR #77, merge 46cd07f.
  • Guide: saturn/VEHICLE_DYNAMICS.md.

line-field-14

Choose a tag to compare

@lamb2k lamb2k released this 22 Nov 23:54
3188d32

The line field can drop an agent that is in the air over a gap too long for it to clear. With the new parameter at 0 the step is line-field-13's, bit for bit.

  • Change: behave->gap_reach_ticks, appended to the behaviour block. With it above 0, an agent in the air flies speed * gap_reach_ticks; once it has covered that from the start of its air run (the contiguous nodes matching the air mask, at most 64 back) and is still in the run, it leaves the line as on an open edge: falling, then retiring fall_ticks later. A run exactly the reach long is cleared. Stateless, no new brain field.
  • API: one new field, gap_reach_ticks. No new entry point.
  • Cost: one scan of at most 64 node flags a step for an agent in the air with the field set; nothing otherwise.
  • Objects: no libc memcpy, memset or memmove in the SH-2 objects; compiled with -Wall -Wextra -Werror.
  • Evidence: HOST: line_field_exact 26,365,473 checks under GCC, Clang and ASan/UBSan; an oracle over 3000 random scenes; an identity differential against main over 20000 scenes (same hash with the field at 0); 12 of 13 mutation controls caught, the other equivalent. No instruction model, no console run. CI on the merged head passes (host, SH-2 cross compile, math lab, docs). Validation record.
  • Merge: PR #81, merge 3188d32.
  • Guide: saturn/LINE_FOLLOWER.md.

line-field-13

Choose a tag to compare

@lamb2k lamb2k released this 22 Nov 20:35
4e6408f

The line field's contact phase does less work per step, with the same results as line-field-12, bit for bit.

  • Change: the order's rows are read once into a packed array; a step with no two neighbouring vehicles within the contact reach has no pair in reach and its passes do nothing. Otherwise the first pass lists the pairs (up to 192), later passes skip a pair that did not overlap sideways until a push has moved one of its two vehicles, and a pair is rejected on the signed lateral difference before the push code.
  • API: none changed. No new entry point or parameter.
  • Cost: the step's stack grows by about 4.5 KB (per-vehicle arrays for 255 vehicles, the packed rows and a 192-pair list).
  • Objects: no libc memcpy, memset or memmove in the SH-2 objects; compiled with -Wall -Wextra -Werror.
  • Evidence: HOST: line_field_exact 26,143,380 checks under GCC, Clang and ASan/UBSan, with two new pinned checks recorded from the line-field-12 source and a differential harness (4 x 20000 scenes, old and new equal); 30 of 31 mutation controls caught, the other equivalent. MODELLED (flat-RAM Yabause model, no caches): contact phase cycles 32,387 to 30,056 (loose field), 67,065 to 51,891, 84,188 to 61,165 and 97,038 to 68,705 (pile); hash chains identical. No console run. CI on the merged head passes (host, SH-2 cross compile, math lab, docs). Validation record.
  • Merge: PR #79, merge 4e6408f.
  • Guide: saturn/LINE_FOLLOWER.md.

line-field-12

Choose a tag to compare

@lamb2k lamb2k released this 22 Nov 17:32
cc10b10

Line field: pace ranks that move, the driver's slowing, and wall impacts. With every new parameter at zero it is line-field-10 step for step.

  • Change: params->ranks gives a finish target that follows each agent's pace rank. A chaser released in the last lap (or whose chased vehicle retired) joins at the rank of the nearest ranked agent and the ranking is renumbered; a retiring agent holds rank 254. With coast a target below an agent's speed only coasts it down; floor is the least target; after_speed is every agent's target once the focus vehicle has finished. behave->wall_impact charges a wall by the speed it is hit at, once, and an agent resting on the edge pays nothing.
  • API: new sh2z_field_ranks_t and params->ranks, brain->pace_rank, behave->wall_impact. ranks NULL and wall_impact 0 give line-field-10's results bit for bit, and its hashes (the hash gains pace_rank only with ranks set).
  • Tests: new checks for the nearest rank and renumbering, retirement, the hash, coast, floor, after-drive and wall impact (exact values), with 13 of 13 mutants caught.
  • Evidence: HOST: 26,143,376 checks pass under GCC (gnu11 and c11, pedantic), Clang, and GCC with ASan and UBSan; the library object has no libc memcpy, memset or memmove. CI on the merged head (host, SH-2 cross compile with the libc check, math lab, docs) passes. No instruction-model capture and no console run: there is no line field instruction model, and every per-suite model ELF is byte-identical to main's before the change (capture check in fdf5f46). Validation record.
  • Consumer (not this repository): a Saturn racing engine's native field on the line-field-10 and line-field-12 sources with every new parameter at zero, six courses, seeds 1 to 6: 72 of 72 reports equal.
  • Merge: PR #76, merge cc10b10.
  • Guide: saturn/LINE_FOLLOWER.md.

line-field-10

Choose a tag to compare

@lamb2k lamb2k released this 22 Nov 11:49
8d7773e

Line field: the contact passes of a step share the pair list and the line samples. Exact against line-field-9.

  • Change: a step runs up to three contact passes. A contact moves a vehicle sideways and changes its speed and energy, never its distance or node, so the pairs in reach along the line are the same in every pass while nobody retires, and a vehicle's line sample (flags, half width) is the same all step. The first pass lists the pairs in reach (up to 192) and samples the line once a vehicle (the first 32); the later passes walk the list. A vehicle that retires part-way through a pass makes the pass resume as a full scan from the position it reached, and the next pass scans in full. A longer list than 192 pairs is not kept and its passes scan in full.
  • API: no new entry point and no new parameter. The results are line-field-9's, bit for bit: every pin of the suite is unchanged.
  • Tests: two new checks that record the line-field-9 step's results (five stacked agents with none, one, two or all retiring in the first pass; a 3000-pile fuzz of random piles with retirements in the first and later passes, line-start straddles, external vehicles and list overflow) and their controls. 10 of 11 mutants are caught; the other is equivalent.
  • Evidence: HOST: 26,143,323 checks pass under GCC, Clang and GCC with ASan and UBSan. The same pile generator over 30000 piles hashes equal on the line-field-9 and line-field-10 sources. No instruction-model capture and no console run: there is no line field instruction model, and no existing model suite links the line field (every per-suite model ELF is byte-identical to main's before the change). Validation record.
  • Consumer (not this repository): a Saturn racing engine's native field on the line-field-9 and line-field-10 sources, six courses, seeds 1 to 6, behaviours on and off: 72 of 72 reports equal. In an emulator run (EMULATOR, timing MODELLED) the field step's 99th percentile on a tube course fell from 6.4 to 4.9 ms.
  • Merge: PR #75, merge 8d7773e.
  • Guide: saturn/LINE_FOLLOWER.md.