native: throw the imp's fireball from the tic that reaches it - #480
Draft
MarcusKainth wants to merge 1 commit into
Draft
native: throw the imp's fireball from the tic that reaches it#480MarcusKainth wants to merge 1 commit into
MarcusKainth wants to merge 1 commit into
Conversation
A_TroopAttack's missile branch reached P_SpawnMissile and the tic refused it. The strike now builds a throwing ask from the attack's own answer and folds missile::spawn over it, and the thing it makes goes on the end of the mobj arrays the way a spawn does: born_column for every column but the two the caller assigns, the next link order for m_linkseq, the slot the compaction leaves for m_id, and one of each counter. missile::spawn_fold is new, for the same reason inter::damage_fold is: a map runs every function in its body once even on an empty list, and the body here is P_SpawnMissile and the move test under it. The fireball goes at the end because P_AddThinker appends, and the pointer it carries to the imp that threw it is renumbered with every other pointer the compaction moves.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes, and why
A_TroopAttack's missile branch reachedP_SpawnMissileand the tic saidit could not be produced. It now throws.
The strike builds a
missile::throwingask out of the attack's ownanswer — the imp, its target,
MT_TROOPSHOT, and the draws the tic andthe attack already made — and folds
missile::spawnover it. What comesback goes on the end of the mobj arrays the way a spawn does:
missile::born_columnfor every column but the two the caller assigns,the next link order for
m_linkseq, the slot the compaction leaves form_id, and one of each counter. The pointer the fireball carries back tothe imp is renumbered with every other pointer the compaction moves.
missile::spawn_foldis new, for the same reasoninter::damage_foldis:a map runs every function in its body once even on an empty list, and this
body is
P_SpawnMissilewith the move test under it.Evidence
The oracle, and what it does not reach
The first divergence stays at gametic 169 and moves off
prndindex.Every number the throw draws is now counted, so
prndindexat 169 reads194 against the probe's 194. What is left is the fireball's own thinker.
P_AddThinkerappends to the thinker list andP_RunThinkerswalks thatlist to its end, so the engine runs a thing's own thinker on the tic it was
spawned. The probe's fireball at 169 has already taken one full
P_XYMovementstep and one tic off its clock. This tic has not, becausethe missile's own thinker is still refused. The arithmetic is exact:
So the divergence cannot move past 169 until the missile's thinker runs,
which is the pull request after this one. That is the oracle this misses,
and the figure above is what it costs.
Gametic 169 also still says it could not be produced, but not for the
missile any more. Breaking
now_unresolvedinto its terms showscw_crowdedandtx_crowdedat 169,tx_unrunandtz_unrunfrom 170on. The last two are the missile's own thinker.
The parity fixture
sim_parity_livegains the fireball's row at 169: the list grows from 264things to 265, and the last one's type, z, momentum, angle, target, state
and flags are read against the probe. Its x, y and tics are read as one
momentum step and one tic behind the probe's, which is the thinker this
does not run, and the
prndindexcheck is what says the draws are right.The seeded throw
sim_troop_live's fireball arm no longer reads a refusal. It reads a thingappended to the list, its type, and the pointer it carries back.
The seeded arms fail when the wiring breaks
Three breaks, each applied on its own and reverted.
Cost
Measured on a throwaway ClickHouse 26.8.2.7 of this lane's own, started
from
docker-compose.yml's digest with the sameconfig.dandusers.d,against
f2818a7in the same session, three rounds interleaved, themachine lock taken and given back around each measurement. The 60 tic
window is idle; the 240 tic window runs the chase, the shot and the
attack.
The resident statement goes from 1,255,576 to 1,327,228 bytes.
The idle tic rises 2.0 ms by arm medians and 1.9 ms paired; the active tic
rises 0.9 ms. Both are over the 0.5 ms gate, and both are smaller than the
attack wiring's own. The idle gate miss is tracked as its own issue and
nothing here narrows where it sits.
The demo gate
Relative to main, in the same session.
Suites
sql::sim::tick::tests::each_caller_of_the_move_test_holds_onecounts themove test's callers so nobody adds one by accident. The spawn's half-step
is a real new caller, so the count goes from four to five.
Invariants
None.
Spec impact
Checks
make gates. Not run whole.make lint, the whole ofclickdoom-native's test set against a live server, andmake native-smokeran instead, all by exit codemake native-smoke, ifnative/ordriver/src/native/changedAnything else
The oracle is the part worth attention: the divergence stays at gametic
169 because the engine runs a newly spawned thing's own thinker on the tic
it was spawned, and this does not.
Written mostly by Claude Opus 5.