Skip to content

Physics Integration: Dynamic Localized Moisture Bridge and Critical F…#85

Open
zed636 wants to merge 2 commits intoquadural:mainfrom
zed636:main
Open

Physics Integration: Dynamic Localized Moisture Bridge and Critical F…#85
zed636 wants to merge 2 commits intoquadural:mainfrom
zed636:main

Conversation

@zed636
Copy link

@zed636 zed636 commented Feb 23, 2026

…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.

  1. 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.

  2. 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).

…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).
@zed636
Copy link
Author

zed636 commented Feb 23, 2026

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant