Repository navigation
feat(math): backport upstream deterministic math and route gamelogic via wwmath (#2670) - #389
Merged
Merged
Conversation
…via wwmath (TheSuperHackers#2670) Backports upstream TheSuperHackers PR TheSuperHackers#2670 establishing the cross-platform deterministic math standard across all systems: - Add BaseDefines.h with RETAIL_COMPATIBLE_CRC and USE_DETERMINISTIC_MATH switches - Add bit_adapter.h utility for portable bit_cast - Update wwmath.h with comprehensive deterministic gm_*f math wrappers - Route GameLogic, Locomotors, PhysicsUpdate, AIUpdate, and simulation math through WWMath - Preserve CRT math in client/rendering code (Drawable, W3DShadow, PlaceEventTranslator, WW3D2) - Backport full math parity to Generals base game target - Update AGENTS.md, CodeRabbit guidelines, and reviewer prompts
|
Important Review skippedToo many files! This PR contains 226 files, which is 126 over the limit of 100. To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch. Upgrade to a paid plan to raise the limit. This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry.
|
- Set gamemath_SHARED_LIBS OFF and GM_ENABLE_INTRINSICS OFF in cmake/gamemath.cmake - Enable POSITION_INDEPENDENT_CODE on gamemath target - Add libgm.so fallback copy to flatpak manifests and bundle scripts
…twork drift - Add resolveUpgradeForProducer in GameLogicDispatch.cpp to dynamically resolve upgrade templates from the producer object's CommandSet when NameKey sequential IDs drift across platforms - Guard RecorderClass::sawCRCMismatch against null m_crcInfo on aborted replay playback - Check TheRecorder->playbackFile return status in ReplaySimulation to prevent black screen hang on missing or invalid replay files - Guard TheControlBar dereference against null in Object::canProduceUpgrade - Update worklog for 31/10/2026
- Remove 2 non-vanilla Reforged FXList definitions from GeneralsZH/Data/INI/FXListGeneralsX.ini and 34 Zero-Hour-only definitions from Generals/Data/INI/FXListGeneralsX.ini that shifted TheNameKeyGenerator IDs by +2 before TheUpgradeCenter initialized - Guard FXListStore::parseFXListDefinition when loading FXListGeneralsX.ini so it resolves existing keys without allocating new NameKeys - Package Data/INI/FXListGeneralsX.ini in Windows CI artifacts and macOS/Linux release bundle scripts - Revert temporary NameKey workarounds (resolveUpgradeForProducer and syncUpgradeCenterID) while retaining null-pointer crash guards in Recorder, ReplaySimulation, and Object - Update October 2026 worklog diary
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.
Description
Backports upstream TheSuperHackers PR #2670 (
feat(math): Route game logic math through WWMath with 3-mode deterministic support), establishing bit-identical cross-platform game simulation determinism between macOS (ARM64) and Linux (x86_64) to prevent multiplayer SyncCrash / CRC desyncs.Context & Architectural Scope
Upstream PR TheSuperHackers#2670 established the gold standard for cross-platform simulation determinism:
GameLogic(and shared math primitivesTrig.cpp,Coord2D,Coord3D,BezierSegment) is routed through deterministicWWMath/GameMathsingle-precision wrappers (gm_*f), which guarantee bit-identical results across architectures without x87/NEON 1-ULP divergence.GameClient,W3DDevice,WW3D2, D3DX math compat) do not contribute to simulation CRCs and remain on standard CRT math (sinf,cosf,sqrtf,tanf,atan2f) to eliminate unnecessary runtime overhead.*Origin,*Trig,Div_FixNaN,SAGE_USE_DETERMINISTIC_MATH) have been completely cleaned up in favor of the official upstream API (WWMath::Sqrt,WWMath::Sin,WWMath::Cos,WWMath::Tan,WWMath::Acos,WWMath::Asin,WWMath::Atan,WWMath::Atan2,WWMath::Ceil,WWMath::Floor,WWMath::Pow,WWMath::Fabs,WWMath::Div_Safe).Summary of Changes
Core/Libraries/Source/Lib/Include/Lib/BaseDefines.hwithRETAIL_COMPATIBLE_CRC (0)andUSE_DETERMINISTIC_MATH (1)defaults, andDependencies/Utility/Utility/bit_adapter.hfor portablestd::bit_cast.Core/Libraries/Source/WWVegas/WWMath/wwmath.hwith comprehensivegm_*fentry points, preserving 64-bit safety fixes andDiv_Safedivision-by-zero guards.WWMathinLocomotor.cppandPhysicsUpdate.cpp.Generals/) ensuring exact bit-for-bit parity with Zero Hour (GeneralsMD/).AGENTS.md,.coderabbit.yaml, and PR review prompt rules to enforce determinism checks strictly onGameLogicand shared simulation math.Testing & Validation
cmake --build build/macos-vulkan --target z_generals(Exit code 0)cmake --build build/macos-vulkan --target g_generals(Exit code 0)GameLogicsubsystems inGeneralsMD/,Generals/, andCore/