1. Issues with the game?
    Check the Known Issues list before reporting!

    Dismiss Notice
  2. Before reporting issues or bugs, please check the up-to-date Bug Reporting Thread for the current version.
    0.24 Bug Reporting thread
    Solutions and more information may already be available.

Game hangs for a long time and then crashes when deactivating 100s of mods

Discussion in 'Troubleshooting: Bugs, Questions and Support' started by angelo234, Jan 6, 2022.

  1. angelo234

    angelo234
    Expand Collapse

    Joined:
    Aug 11, 2017
    Messages:
    409
    If you are having issues with deactivating many mods at once like I had, I seem to have found a solution to it. I made a simple code fix which now deactivates the mods a lot faster and doesn't seem to crash the game anymore :) The problem from what I can tell stems from the game rewriting a several MBs large db.json file every time a mod is deactivated when deactivating all mods. This means that if you have 200 mods, it will be rewriting that file 200 times (file writing totaling in the GBs) which kinda makes sense why the game lags so much and then I guess gives up and crashes lol. The thing is that the file write only needs to be done one single time after disabling all the mods.

    To fix it, replace the file at steamapps\common\BeamNG.drive\lua\ge\extensions\core\modmanager.lua with the attached file (keep a backup of the old modmanager.lua file just in case you want to revert changes).

    The changes I made include:
    • Line 836: Added an extra parameter to the function deactivateMod called preventStateChange.
    • Line 860: Added an if statement that checks if preventStateChange is true and prevents the rewriting of the db.json file.
    • Line 650: Added true as the second argument to the deactivateMod function call in the deactivateAllMods function.
     

    Attached Files:

    #1 angelo234, Jan 6, 2022
    Last edited: Jan 10, 2022
    • Like Like x 5
  2. Andryusha

    Andryusha
    Expand Collapse

    Joined:
    Jan 28, 2020
    Messages:
    338
    Thank you!
    I wonder if the devs will implement it to the game if you are not against it.
     
  3. angelo234

    angelo234
    Expand Collapse

    Joined:
    Aug 11, 2017
    Messages:
    409
    I hope they see this post and do implement it for the next update, otherwise when I download the next update the file will be overwritten back with the current bug.
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice