Skip to content

native: divergence at tic 301, a zombieman fires seven draws short #560

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

prndindex or rndindex

The divergence report

$ clickdoom native diff 400 --probe refemu/reference_traces/demo3/probe.9a6a47d01119.tsv
# native diff elapsed=66.4s tics=391 tics/s=5.9
clickdoom: error: tic 301 game slot 0 prndindex: 41 against the probe's 48
exit=3

The two agree on every draw up to and including gametic 300, then this tic
draws ten where the engine draws seventeen. The deficit is exactly seven from
there on, so it is one missing group rather than a drift:

 tic  ours  theirs  behind
 297    15      15       0
 298    18      18       0
 299    25      25       0
 300    31      31       0
 301    41      48       7
 302    48      55       7
 303    58      65       7

Random draws at that tic

Mobj slot 89 is a zombieman (type 1). It goes from state 184 to state 185
between gametic 300 and 301. 185 is POSS_ATK2, whose action is
A_PosAttack.

A_PosAttack draws three: two for the angle spread,
angle += (P_Random()-P_Random())<<20, and one for the damage,
((P_Random()%5)+1)*3. The shot then reaches something and P_SpawnPuff or
P_SpawnBlood draws four more. Three plus four is seven, which is the
deficit exactly.

The hypothesis is therefore that the shot does not run at all on our side.
It is a hypothesis and not a measurement: what is measured is the deficit,
its size, and that it begins on the tic this zombieman enters its firing
state.

Slot 89's own state, angle and target all agree with the probe at 301:

 tic  st_ours  st_theirs    ang_ours   ang_theirs  tgt_ours  tgt_theirs
 300      184        184           0            0         1           1
 301      185        185  4273612830   4273612830         1           1
 302      185        185  4273612830   4273612830         1           1

The angle moving off 0 says A_FaceTarget ran on both sides. That does not
say the shot ran: A_FaceTarget draws nothing for a target without
MF_SHADOW, and A_PosAttack's own spread is applied to a local rather
than to the thing's angle, so the angle reads the same whether the shot
fired or not. The seven draws are the only thing that distinguishes them.

Reproduction

This tic is not reachable on main, which stops at gametic 210, nor on
either branch alone. It needs native/player-death-actions at 691ed81,
which moves the refusal past 210, and the two commits below, which move it
past 275.

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

make gen-probe-trace              # the trace must be state_schema_version 2
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

Not caused by either of those commits. With the chase fix's dispatch half
removed and only its narrowing kept, the run stops at 301 with the same
field and the same numbers, so nothing they wire in reaches this. They make
the tic reachable and no more.

Why it has not been seen before

Nothing before gametic 275 puts a zombieman into an attack state on demo3,
and a run from tic 1 has never got past 275. So A_PosAttack has never run
in a real tic here: it landed in #517 with seeded arms covering it, and this
is the first tic of the demo that would exercise it.

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