Skip to content

native: divergence at tic 301, a shot's puff misses its own first tic #561

Description

@MarcusKainth

ROM sha256

9a6a47d01119f67580e48e9875207186c25efd56ff93019df331eb307cfaa5d9

WAD sha256

1d7d43be501e67d927e415e0b8f3e29c3bf33075e859721816f652a526cac771

ClickHouse version

26.8.2.7

First divergent tic (gametic)

301

First divergent frame, if a frame differs

Not checked. The run stops at the state comparison.

What disagrees

A mobj field

The divergence report

clickdoom: error: tic 301 mobj slot 272 m_z: 1569317 against the probe's 1634853
exit=3

Slot 272 is the puff a zombieman's shot leaves at gametic 301, mobj type 37.
Its z is exactly 65536 low, one FRACUNIT, on the tic it spawns and on every
tic after. Its momentum and its state agree:

 tic    z ours    z theirs   momz ours  momz theirs  state ours  state theirs
 301   1569317     1634853       65536        65536          93            93
 302   1634853     1700389       65536        65536          93            93
 303   1700389     1765925       65536        65536          93            93

Our z at each tic is the engine's z at the tic before. The lag is constant,
never grows, and the momentum driving it is right, so the puff is a whole
tic behind from birth rather than moving wrongly.

P_SpawnPuff sets th->momz = FRACUNIT, and P_AddThinker appends the new
thing to the end of the thinker list. P_RunThinkers walks that list to its
end, so a thing appended during the walk is still reached by it and runs its
own P_MobjThinker on the tic it was spawned. That first step is the
missing FRACUNIT.

mobj::thrown_thinks already does this for the fireball a tic throws, with
a comment saying the compaction has appended it so it runs last, exactly
where P_AddThinker put it. The debris a gun attacker's shot leaves —
mt_debris, the puffs and blood spots — has no equivalent, so it is spawned
and then not run.

Random draws at that tic

Not involved. prndindex agrees at this tic and after it, once #560's own
fix is in. The draws this shot makes are right; where the thing they spawn
ends up is not.

Reproduction

Not reachable on main, which stops at gametic 210. It needs
native/player-death-actions at 691ed81 to pass 210, the chase crossing
fix to pass 275, and #560's fix to pass 301's draw count.

git checkout --detach 691ed81
git cherry-pick 2659738 3fc2eb9 c061770   # native/chase-crossing

make gen-probe-trace
cargo build --locked --release -p clickdoom-driver

CONN="--host localhost --port 18124 --password clickdoom --database clickdoom_native"
PROBE=refemu/reference_traces/demo3/probe.9a6a47d01119.tsv
./target/release/clickdoom native load --fresh $CONN
./target/release/clickdoom native load --probe $PROBE $CONN
./target/release/clickdoom native diff 400 --probe $PROBE $CONN   # exit 3 at 301

Why it has not been seen before

Gametic 301 is the first tic of demo3 that puts a gun attacker in the list
at all, so A_PosAttack has never run here and has never left a puff here.
The routine landed in #517 with seeded arms that assert what the shot leaves
— the puff's own spawn — rather than what the puff does on the tic it is
left. Both this and #560 sat behind those arms passing.

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