A race can be replayed exactly, so physics claims can be tested
Three pieces of harness, all env-gated and inert in normal play, that turn "do two frame rates play the same race?" from an argument into a number: - RP412PHYSTRACE=1 samples the player vehicle's position on the SIMULATION's own clock - the vehicle's lastPerformance, which advances in whole fixed steps - so two runs sample at identical step counts and their traces compare exactly. Frame-time sampling compares different instants and calls the difference physics; an earlier version of this trace did exactly that, and its noise was chased as if it were drift. At the green light it stops the vehicle dead, because the pod simulates on its pad while the mission loads and a load is never the same length twice: two runs reached the start 776 and 599 steps in, same position, different velocity. - RP412SPAWNZONE pins which drop zone is tried first. The pick is Random(), and Random() is seeded - but a seed only repeats a run if the same NUMBER of draws precedes the pick, and that count rides on load timing. Same seed, different pad, incomparable traces. Pinned, the zone is tried first and falls back to the random walk if taken, so it cannot wedge and changes nothing unless set. - The trace prints the global step counter, which is what caught the force-accumulator bug: the position columns can look plausible while the step column says the physics ran a different number of times. With these three and RANDOM= (which already existed), a race is repeatable to the bit, and the determinism matrix - rates by frame rates by repeats, run as parallel sandboxed instances - is a regression suite: any mismatch in any cell is a real bug. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
+39
-1
@@ -224,9 +224,47 @@ void
|
||||
//-----------------------------------------------------
|
||||
//
|
||||
highest = highest - lowest + 1;
|
||||
|
||||
//
|
||||
//------------------------------------------------------------------------
|
||||
// RP412SPAWNZONE pins which drop zone is tried first, so a test run can
|
||||
// be repeated.
|
||||
//
|
||||
// The pick below is Random(), and Random() is seeded - but the seed only
|
||||
// makes a run repeatable if the same NUMBER of draws happens first, and
|
||||
// that depends on how many frames the mission load took. So two runs of
|
||||
// the same egg with the same RANDOM= still start on different pads, over
|
||||
// different ground, and no two traces can be compared. That is not a
|
||||
// game bug, but it makes the physics unmeasurable.
|
||||
//
|
||||
// Pinned, the zone is tried first and the loop falls back to the random
|
||||
// walk if it is taken - so this can never wedge, and it changes nothing
|
||||
// unless it is set.
|
||||
//------------------------------------------------------------------------
|
||||
//
|
||||
static int
|
||||
pinnedZone = -2;
|
||||
|
||||
if (pinnedZone == -2)
|
||||
{
|
||||
const char *setting = getenv("RP412SPAWNZONE");
|
||||
pinnedZone = (setting != NULL) ? atoi(setting) : -1;
|
||||
}
|
||||
|
||||
Logical
|
||||
tryPinnedZone = (pinnedZone >= 0) ? True : False;
|
||||
|
||||
while (remaining)
|
||||
{
|
||||
i = lowest + Random(highest);
|
||||
if (tryPinnedZone)
|
||||
{
|
||||
tryPinnedZone = False;
|
||||
i = lowest + (pinnedZone % highest);
|
||||
}
|
||||
else
|
||||
{
|
||||
i = lowest + Random(highest);
|
||||
}
|
||||
Verify(i < dropZoneCount && i >= 0);
|
||||
if (IsAvailable(i))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user