Skip to content

native: divergence at tic 206 #502

Description

@MarcusKainth

ROM sha256

9a6a47d01119f67580e48e9875207186c25efd56ff93019df331eb307cfaa5d9

WAD sha256

1d7d43be501e67d927e415e0b8f3e29c3bf33075e859721816f652a526cac771

ClickHouse version

26.8.2.7

First divergent tic (gametic)

206

First divergent frame, if a frame differs

No response

What disagrees

prndindex or rndindex

The divergence report

Not from clickdoom native diff: this reproduces straight off the probe's
own row, without running the demo from tic 1, so it is independent of the
missile-move gap that already stops the differential run before it reaches
206.

Seeded native_state's own row at tic 205 from
refemu/reference_traces/demo3/probe.9a6a47d01119.tsv's own row at gametic
205 (a thrown fireball, mobj slot 265, one tic from hitting the player),
unchanged. Ran tic 206 with the demo lump's own recorded command
(clickdoom_native::sql::sim::tick::demo_statement, which reads
demo_cmds by the literal tic number).

Reference (the probe's own row at gametic 206): player health 100 -> 82,
p_damagecount 0 -> 18, p_attacker 0 -> 119, prndindex 15 -> 24 (nine
draws). p_inter.c's own damage roll is (P_Random()%8+1)*3; 18 is a roll
of 6.

This run: player health 100 -> 88, p_damagecount 0 -> 12 (a roll of 4),
prndindex 15 -> 23 (eight draws, one short). unresolved reads 0 either
way; the simulation believes it fully resolved the tic.

The missile itself is the only thing carrying MF_MISSILE in the probe's
own row at gametic 205, so this is not two missiles' own folds landing in
a different relative order. native/src/sql/sim/inter.rs's own damaged
and reach (the code a recent PR added to thread a player's own health,
armour, damagecount and attacker through a hit) do not touch any draw
count: draws's own formula (1 + may_fall, unconditional pain-chance
draw plus the fall check) is unchanged from before that PR, and the
missile's own damage roll is drawn by its caller
(native/src/sql/sim/attacks.rs's damage_ask-shaped construction),
outside damaged entirely.

Random draws at that tic

The probe's own random-call log
(refemu/reference_traces/demo3/probe-rng.9a6a47d01119.tsv) attributes
the missile's own three draws to gametic 205, not 206. The state rows
themselves are aligned with native mode's own tic numbering (tic N is
gametic N); the draw log's own gametic label is one behind because the
reference engine logs each draw as it happens, during the tic, and only
stamps the state row with the gametic once the tic finishes - so a draw
made while tic 206 runs is logged against 205, the tic that was still
current when the call fired. The nine rows below are what tic 206's own
processing draws:

gametic call_index caller           caller_offset icount
205     0          A_Chase          256           253062847
205     1          A_Chase          256           253065808
205     2          P_NewChaseDir    164           253067652
205     3          P_NewChaseDir    324           253069456
205     4          A_Chase          256           253069483
205     5          T_LightFlash     108           253082565
205     6          PIT_CheckThing   516           253083241
205     7          P_DamageMobj     676           253083471
205     8          P_ExplodeMissile 72            253083671

Three of the nine are the missile's own hit (PIT_CheckThing's damage
roll, P_DamageMobj's pain-chance draw, P_ExplodeMissile's own draw).
The other six, from some other monster's own chase and a light thinker,
are the more likely place to look for the one this run does not draw:
this run's own missile-damage roll itself lands one slot early
(4 instead of 6), consistent with one fewer draw happening somewhere
before it rather than the missile's own three draws being wrong in
shape.

Reproduction

cargo test -p clickdoom-native --features clickhouse-tests \
  --test sim_player_damage_live a_fireball_reaches_the_player_through_its_own_armour \
  -- --test-threads 1

The test itself carries the exact seeding (native/tests/sim_player_damage_live.rs,
seeded_fireball/hit_after_206, on native/player-damage): create a
fresh database, run the ordinary level and demo load statements, load
native/tests/fixtures/demo3-player-damage.tsv's own row at gametic 205
into native_state at tic 205 via native/tests/support/probe.rs's
load, then run
clickdoom_native::sql::sim::tick::demo_statement(db, 206, 206) and read
p_health, p_damagecount, p_attacker and prndindex back.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: nativeNative mode: the tic simulation and renderer as SQL, and the WAD loaderdivergencerefemu and sqlcpu disagree on the same ROM

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions