Repository navigation
Conversation
gynt
force-pushed
the
reimpl/GameStateStructures
branch
from
October 16, 2026 23:06
0ffd027 to
9f4ba41
Compare
gynt
commented
Oct 16, 2026
Split out of the previous reimpl/GameStateStructures tip: the 92 byte-identical functions moved to reimpl/GameStateStructures-100. What stays here is the work still open - computeBuildingCategoryEntryPointAndDestroyEarlierBuilding (33.5%), spawnMotherOrChild (54.6%), processPeasantSpawnAndDespawnCycle (84.0%), resetVariousCountsAndStatisticsAndStartGoodsAndResources (92.2%), spawnPoisonCloudsAroundBuilding (92.4%), processFoodConsumption (96.8%) and computePopulationStatistics (98.0%) - plus their status lines, the /GL entries they use, and the AGENTS.md / cheat-sheet notes and the two diff tools that record their blockers. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
gynt
force-pushed
the
reimpl/GameStateStructures
branch
from
October 18, 2026 16:04
0d94328 to
93ce3f2
Compare
It was misfiled onto reimpl/GameStateStructures-100. The cheat-sheet section recording its blocker is already here. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…tures # Conflicts: # cmake/compiler-flags-gl.txt
- updateCrowding, processFoodConsumption: walk a pointer to the field the original anchors its loop on, reaching other PlayerData fields by offset - spawnPoisonCloudsAroundBuilding: decrement the retry counter in each failure branch to get the original's memory decrement - computePopulationStatistics: name the blessed + unblessed total - updateFoodTypesInStockForAllPlayers (0x00458A70): new, needed so /GL can keep `this` live across the call in processFoodConsumption Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Port the branch's GameStateStructures functions to the upstream PlayerData layout (buildingEntryInfos[] instead of named entries, renamed fields). Keep the matched updateFoodTypesInStockForAllPlayers in its flat form. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Compound assignments and ++/--, imported string literals, RT_GOLD instead of 15, countof/sizeof for array bounds, decimal constants, no redundant casts, for instead of while, HeightLayer[tile] instead of an offset into EntityLayerLT25. All nine functions measure unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… entry read (33.5% -> 64.0%) The original reads the building entrance once for nine categories and jumps to it. Written out per arm, MSVC merges the copies only after register allocation, so buildingID scored high enough to take ebx. Kept as goto with a comment; a goto-free outer || test measured 52.1 quick against 71.8. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Its only users are the four accesses in processFoodConsumption, which increment it, compare it signed against 2 (add eax, 1; cmp eax, 2; jle) and reset it to 0. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…es a BuildingEntryInfoEnum The category indexes PlayerData::buildingEntryInfos[], whose index enum is Player::Enums::BuildingEntryInfoEnum; PlayerDataBuildingCategoryEnum is the older duplicate of it with the same values. The .cpp follows the signature and its constants. No code change: the function measures 64.0% before and after. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… copies Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…he entry in locals Structure over raw match: kind 0.956 -> 0.973, mismatched mnemonics 7 -> 2. The original picks the clock increment into one register in every arm and stores it once, walks a pointer to vclockIncrement, and scales the campground entry with three adds. Raw match falls 85.3% -> 78.4% because the increment and the sum now trade eax/ecx with the original; reg_scores shows that pick comes down to a one-point eax affinity, so no source form tried reaches it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
structural_diff.py only scores files in the build list, so a source variant could not be judged by structure before it replaced the source. quick_diff.py --structural reports kind/shape/delta for any file from its one compile and diffs the register-anonymised lines; quick_styles.py --structural ranks the variants by delta, then kind, then ratio. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
quick_diff.py: keep both the branch's --structural and main's -d flag. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…aiHoldBackTicks PlayerData::aiControlStatusRelated was renamed to aiHoldBackTicks on main. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
…StockForAllPlayers The branch changed computeBuildingCategoryEntryPointAndDestroyEarlierBuilding's category parameter to BuildingEntryInfoEnum. Main's headers lead, and the enum type does not change code generation, so the header is back to main's PlayerDataBuildingCategoryEnum and the .cpp compares against PDBCE_* instead. updateFoodTypesInStockForAllPlayers is 100% on main as well, so the PR no longer changes it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
… reg Take the plain-indexing version from 6and8/reimpl/GameStateStructures (gynt, October), adapted to main's PlayerData field names: 78.4% -> 85.3%. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
The tile index of the new entry is computed into a local before the stores and the area is read through it. With the area read back from the entry's tileEntry field the compiler kept category in a callee-saved register; now it stays in edx and is reloaded from its home after the calls, as in the original (64.0% -> 84.8%). What is left is the swap of this (ebx) and the keep branch's player pointer (ebp): reg_scores.py shows this (benefit 38) served before the player pointer temp, the original serves them the other way round. Build mode: plain. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
kotijekriv
pushed a commit
to kotijekriv/OpenSHC
that referenced
this pull request
Dec 4, 2026
…, plus 1 with register allocation differences (sourcehold#551) * build: compile processFoodConsumption with /GL As in sourcehold#243: the original keeps this in edx across the call to updateFoodTypesInStockForAllPlayers, which is already /GL on main. LTCG can only reproduce that with both sides compiled /GL (96.5% without the entry, 100% with it). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp * reimplement: SHC_3BB0A8C1_0x0045AF30 100.00% Reimplemented Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp * reimplement: SHC_3BB0A8C1_0x00458AD0 100.00% Reimplemented Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp * reimplement: SHC_3BB0A8C1_0x00459A20 100.00% Reimplemented Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp * reimplement: SHC_3BB0A8C1_0x00458E60 100.00% Reimplemented Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp * reimplement: SHC_3BB0A8C1_0x00455E10 92.88% Register allocation differs Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp * style: apply the style guide to the five GameStateStructures functions countof instead of the loop bounds 9, 8, 300 and 299; the logic-layer mask in spawnPoisonCloudsAroundBuilding as Logic1 flags (L_SEA | L_BORDER | ... | L_MOAT == 0x4a5014b1); BOOLEnum fields and returns tested directly instead of against FALSE; const on the two assign-once locals of resetVariousCounts...; duplicate own .func.hpp include and unused usings dropped; namespace closing comments. Re-measured on 40cbb1c with a full build and reccmp: the four 100% functions stay 100.0/100.0, resetVariousCountsAndStatisticsAndStartGoodsAndResources stays 92.9/85.5 (register-blind identical). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp * review: pre-review pass for TheRedDaemon - processFoodConsumption and updateCrowding leave this PR: they only match through a local PLAYER_FIELD #define that walks an int pointer through PlayerData (a PlayerData* walk measures 0.48 in quick_diff). Their status lines go back to main's, and so does the /GL entry processFoodConsumption needed. - spawnPoisonCloudsAroundBuilding: map bounds as MC_MAP_XY_LIMIT_MIN_1 / MC_MAP_XY_LIMIT, the logic mask tested by truthiness, const on the two positions, and the match-explaining comment removed (moved into the PR thread). Re-measured on 592a17d with a full build and reccmp: computePopulationStatistics and spawnPoisonCloudsAroundBuilding 100.0/100.0, resetVariousCountsAndStatisticsAndStartGoodsAndResources 92.9/85.5 (register-blind identical). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
# Conflicts: # src/OpenSHC/Game/GameStateStructures/computePopulationStatistics.cpp # src/OpenSHC/Game/GameStateStructures/resetVariousCountsAndStatisticsAndStartGoodsAndResources.cpp # src/OpenSHC/Game/GameStateStructures/spawnPoisonCloudsAroundBuilding.cpp # status/addresses-SHC-3BB0A8C1.txt
This branch has not been deployed
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.
No description provided.