Physics Integration: Dynamic Localized Moisture Bridge and Critical F…#85
Open
zed636 wants to merge 2 commits intoquadural:mainfrom
Open
Physics Integration: Dynamic Localized Moisture Bridge and Critical F…#85zed636 wants to merge 2 commits intoquadural:mainfrom
zed636 wants to merge 2 commits intoquadural:mainfrom
Conversation
…ixes This PR introduces a functional bridge between MoreRealistic and the RealisticWeather (MoistureSystem) mod, alongside several critical fixes for FS25 engine compatibility and multiplayer stability. The core objective is to move away from a "global weather state" for friction and transition to a "localized ground state," where each wheel's physics are calculated based on the specific moisture data at its world coordinates. Key Changes 1. Physics & Integration (The "Bridge") Localized Friction Sampling: Modified MR_WheelPhysics.lua (~line 482) to poll localized moisture data during mrUpdateFriction. Dynamic Rolling Resistance: The wetness factor used in friction and rolling resistance calculations is no longer a global constant. It now utilizes a new helper in MR_Weather.lua (mrGetMoistureWetnessAt(x, z)) to sample the MoistureSystem map. Smart Fallback: Added a safety check to detect the presence of the Moisture mod. If absent, the system seamlessly reverts to native GIANTS weather data to prevent LUA nil-indexing. 2. Mathematical Corrections Arithmetic Precedence Fix: Corrected a logic error in MR_Weather.lua regarding the nocturnal dampness curve. The previous formula hour-dampStart * 0.05 was applying the multiplier to the start time rather than the elapsed duration. Fixed to (hour - dampStart) * 0.05. 3. Structural & MP Stability Lua Syntax Cleanup: Removed continue statements (unsupported in GIANTS' Lua 5.1) that were causing parser errors and preventing script initialization in certain environments. Savegame Path Resolution: Refactored save/load logic to use missionInfo instead of g_careerScreen. This ensures data persistence is maintained on Dedicated Servers/Headless modes where the UI layer is not initialized. MP Metadata: Synchronized modDesc.xml files to ensure multiplayer supported="true" is consistent across the package. Technical Impact Gameplay: Vehicles now exhibit realistic differential slip. Driving with one side in a mud puddle and the other on dry grass will result in asymmetrical traction and yaw moments, as expected in a high-fidelity simulation. Performance: The bridge is optimized to minimize overhead during the physics pre-step. Testing Tested with g_vehicleDebugPhysics 1 to confirm real-time friction coefficient changes across different soil moisture zones. Validated log cleanliness (no "Unexpected <exp>" or "nil value" errors).
Author
|
For context, this integration is designed to work seamlessly with the FS25_MoreRealisticWeather mod (link below), which provides the high-resolution moisture map required for the per-wheel friction calculations: 🔗 Reference Mod: https://github.com/zed636/FS25_MoreRealisticWeather The bridge implemented in MR_Weather.lua includes a safety check: if this specific mod is not active in the current savegame, MoreRealistic will automatically fallback to the standard global weather wetness values, ensuring no breaks in the physics loop or LUA errors for users who prefer a standalone experience. |
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.
…ixes
This PR introduces a functional bridge between MoreRealistic and the RealisticWeather (MoistureSystem) mod, alongside several critical fixes for FS25 engine compatibility and multiplayer stability.
The core objective is to move away from a "global weather state" for friction and transition to a "localized ground state," where each wheel's physics are calculated based on the specific moisture data at its world coordinates.
Key Changes
Dynamic Rolling Resistance: The wetness factor used in friction and rolling resistance calculations is no longer a global constant. It now utilizes a new helper in MR_Weather.lua (mrGetMoistureWetnessAt(x, z)) to sample the MoistureSystem map.
Smart Fallback: Added a safety check to detect the presence of the Moisture mod. If absent, the system seamlessly reverts to native GIANTS weather data to prevent LUA nil-indexing.
Mathematical Corrections Arithmetic Precedence Fix: Corrected a logic error in MR_Weather.lua regarding the nocturnal dampness curve. The previous formula hour-dampStart * 0.05 was applying the multiplier to the start time rather than the elapsed duration. Fixed to (hour - dampStart) * 0.05.
Structural & MP Stability Lua Syntax Cleanup: Removed continue statements (unsupported in GIANTS' Lua 5.1) that were causing parser errors and preventing script initialization in certain environments.
Savegame Path Resolution: Refactored save/load logic to use missionInfo instead of g_careerScreen. This ensures data persistence is maintained on Dedicated Servers/Headless modes where the UI layer is not initialized.
MP Metadata: Synchronized modDesc.xml files to ensure multiplayer supported="true" is consistent across the package.
Technical Impact
Gameplay: Vehicles now exhibit realistic differential slip. Driving with one side in a mud puddle and the other on dry grass will result in asymmetrical traction and yaw moments, as expected in a high-fidelity simulation.
Performance: The bridge is optimized to minimize overhead during the physics pre-step.
Testing
Tested with g_vehicleDebugPhysics 1 to confirm real-time friction coefficient changes across different soil moisture zones.
Validated log cleanliness (no "Unexpected " or "nil value" errors).