Released MK's Dynamic Weather 1.0.2

This lua script implements dynamic weather in BeamNG! (and tornadoes)

  1. MegaKnight

    MegaKnight
    Expand Collapse

    Joined:
    Sep 12, 2024
    Messages:
    195
    This lua script implements dynamic weather in BeamNG!

    It's not the prettiest, but given what's possible on Game Engine side (rain, fog), I think it's still quite good. I will be working on this in the future by adding some more features and fixing possible bugs.

    logo.png


    Current Features:
    • weather events: sunny, cloudy, light rain, rainy, stormy, foggy, foggy rain, tornado storm
    • dynamic wind affecting vehicles and groundcover/forest objects (if supported by the object)
    • windbursts randomly happening from time to time, frequency and strength affected by weather event
    • tornadoes that slowly chase the player and interact with physics objects (vehicles, concrete retaining wall, matress, ...), only one can be active at a time
    • slippery roads during rain/snow (if roads are made out of terrain, does not work for meshes like bridges)
    • UI for optional weather, wind, tornado and road condition control
    • dynamic rain, clouds, fog and brightness
    • compatible with career mode and missions/scenarios
    • > 2500 lines of code
    How to use?

    See repo page

    How does it work?

    Basically, the script cycles through different weather events randomly, starting with sunny weather. After a certain amount of time has passed, the next event is rolled. The script then does slight changes to sunsky, clouds, rain, fog and wind speed each ~10 seconds, until the event's criteria are met. After that, the event timer starts again. When it runs out, the next event is rolled.

    The tornado is just a particle emitter that slowly moves towards the player. When a vehicle gets close enough, wind forces are applied to that vehicle. These wind forces are the same as those from the wind UI app.

    Future Plans
    • career mode safe system
    • multiplayer support
    • rewrite some code to make extensions for this mod possible, so that other mods can expand upon this, eg. by adding more weather events or a JS UI app

    Credits

    • @Komodor for his code to make changing road conditions possible (during Beta versions)
    • @vouthin for his rankine vortex tornado code
    • @MegaKnight (me) for everything else

    Screenshots

    small_island_sunny.png small_island_foggy.png etk_center_cloudy.png etk_center_rainy.png italy_rain.png italy_windburst.png

    Changelog

    • reworked tornado model, by @vouthin
    • added tornado weather event, toggleable, off by default in career mode
    • improved tornado particles
    • added more control options for tornadoes to UI, some combinations may cause instabilities
    • tornado visualization in bigmap mode
    • new UI design with orange highlighted text elements and improved tooltips
    • traffic vehicles using their lights based on weather events
    • wind now applying less force to simplified traffic vehicles and player unicycle to account for their reduced weight, compatible with Agent's Simplified Realistic Traffic Mod (forgot Yakuza Pack, will be added asap)
    • reduced speed of windbursts during stormy and rainy event
    • reworked dynamic groundmodel code to fix bug of cars spawning/resetting (partially) underground, now requires reload of collision, which may take a few seconds on larger maps
    • fixed bug of tornado not working correctly when weather paused
    • improved sunsky and lighting during overcast weather
    • added random start event, instead of sunny everytime a random event will be chosen upon loading
    • added more UI settings
    • option to instantly switch to a weather event (UI)
    • toggle for random tornado paths (UI)
    • toggle for message display (UI, Ctrl + Alt + W still available)
    • control for tornado movement speed (UI)
    • fixed bug with sunScale breaking when switching many times between stormy and sunny weather
    • added easter egg :p
    • added more settings to the UI: pause button, button to roll next random event immediately, rain/snow toggle, wind speed control, advanced settings (duration of event switch, time between rolls)
    • added option for snow instead of rain
    • added icy road condition
    • added dynamic temperature
    • improved fog
    • added UI that displays when main menu is active
    • weather events, tornadoes and road condition can be controlled using the UI
    • custom button sound for UI (plays when game unpaused)
    • added more weather events: light rain, foggy rain and stormy
    • added tornadoes, but they're not part of the weather cycle yet
    • reduced speed of windbursts, they were a bit too fast, especially during rainy event
    • reduced time between events
    • added dynamic road conditions
    • initial release

    Download from the Repository

    Do not reupload anywhere!
     
    #1 MegaKnight, Feb 28, 2025
    Last edited: Apr 8, 2025
    • Like Like x 18
  2. Dedo_do_lula22

    Dedo_do_lula22
    Expand Collapse

    Joined:
    Jan 25, 2024
    Messages:
    57
    No way....
    Now we have Rain =D
     
  3. Komodor

    Komodor
    Expand Collapse

    Joined:
    Dec 16, 2017
    Messages:
    12
    ( google translator )
    You can make the road more slippery during rain.
    This works in real time in Lua Game Engine.
    A piece of my code where I take into account tire type, rain, snow...
    The variables need to be calculated.

    I don't have the ability to check your mod right now, but maybe this is the element you're looking for.
    It works for me, but I only do it for my map. I don't know if it will work correctly for all maps.

    local gm = ground_model()

    gm.staticFrictionCoefficient= ((1.2*mw_o)/mw_p)/mw_ice
    gm.slidingFrictionCoefficient=((0.8*mw_o)/mw_p)/mw_ice2
    gm.hydrodynamicFriction= 0
    gm.stribeckVelocity =4.5
    gm.strength= 1
    gm.roughnessCoefficient= 0
    gm.fluidDensity=0
    gm.flowConsistencyIndex= 0
    gm.flowBehaviorIndex= 0
    gm.dragAnisotropy= 0
    gm.shearStrength= 0
    gm.defaultDepth= 0
    gm.collisiontype= 10--asphalt: 10
    gm.skidMarks= true

    be:setGroundModel("groundmodel_asphalt1",gm)
    be:setGroundModel("concrete",gm)
    be:setGroundModel("concrete2",gm)
    be:setGroundModel("BeachSand2",gm)
    be:setGroundModel("grid",gm)
     
    • Like Like x 2
  4. MegaKnight

    MegaKnight
    Expand Collapse

    Joined:
    Sep 12, 2024
    Messages:
    195
    Thank you, I'll try that :)
     
    • Like Like x 1
  5. jennifer metris

    jennifer metris
    Expand Collapse
    Banned

    Joined:
    Apr 28, 2024
    Messages:
    60
    um i downloaded it yay:)
    --- Post updated ---
    hey did you add tornados also?
    --- Post updated ---
    i want tornados in the thing
     
  6. Sparks4

    Sparks4
    Expand Collapse

    Joined:
    Aug 4, 2013
    Messages:
    355
    Amazing! Once again, modders beating the developers by years.
     
    • Like Like x 1
  7. MegaKnight

    MegaKnight
    Expand Collapse

    Joined:
    Sep 12, 2024
    Messages:
    195
    Thank you very much! This works perfectly ;)

    I just uploaded a new version to the original post, which changes to slippery roads when a certain amount of rain is falling. This however only applies to roads made out of terrain, not to objects such as bridges or the roads of most ported maps. I also made a few more changes, see the changelog fore more information.

    betaV21.png betaV22.png
     
  8. Dedo_do_lula22

    Dedo_do_lula22
    Expand Collapse

    Joined:
    Jan 25, 2024
    Messages:
    57
    how i make it rain on the maps ?
     
  9. MegaKnight

    MegaKnight
    Expand Collapse

    Joined:
    Sep 12, 2024
    Messages:
    195
    Press Alt + T to enable the mod. Then you can either wait until it randomly starts to rain, or you use a console command.

    You can gradually switch to rainy weather with the following command: dynamicWeatherMK_weather.setWeatherEvent("rainy")

    To open the console, press the ~ key on your keyboard (it seems to be Ö instead on german keyboards)
     
  10. Dedo_do_lula22

    Dedo_do_lula22
    Expand Collapse

    Joined:
    Jan 25, 2024
    Messages:
    57
    Thanks man
    Here some photos
     

    Attached Files:

    • 284160_51.jpg
    • 284160_52.jpg
    • 284160_53.jpg
    • 284160_55.jpg
    • Like Like x 2
  11. MegaKnight

    MegaKnight
    Expand Collapse

    Joined:
    Sep 12, 2024
    Messages:
    195
    wild_tornado_spotted.png

    :D
     
    • Like Like x 3
  12. ArsPro

    ArsPro
    Expand Collapse

    Joined:
    Oct 13, 2022
    Messages:
    1,040
    what the hell

    well, this mod is already really good! Question: does the temperature dynamicly change along with weather events with this mod?
     
  13. MegaKnight

    MegaKnight
    Expand Collapse

    Joined:
    Sep 12, 2024
    Messages:
    195
    Thank you!

    No, it doesn't. I didn't even think of that :p. I'll try to add it in the future.
     
    • Like Like x 1
  14. MegaKnight

    MegaKnight
    Expand Collapse

    Joined:
    Sep 12, 2024
    Messages:
    195
    Beta Version 3 is out!

    stormy.png tornado_jsv1.png tornado_jsv2.png tornado_jsv3.png tornado_testing8.png tornado_plane.png tornadoland.png

    New features:
    • tornadoes
    • weather events: light rain, foggy rain and stormy
    Tornadoes can be spawned using Alt + T, but they are not part of the weather cycle yet. Random tornadoes can be toggled using a console command. Only one tornado can be active at a time. For more information, see OP.

    I will also upload this version to the repo.
     
    • Like Like x 6
  15. Kresi

    Kresi
    Expand Collapse

    Joined:
    Feb 11, 2025
    Messages:
    59
    how did i not know that this exists
     
  16. ArsPro

    ArsPro
    Expand Collapse

    Joined:
    Oct 13, 2022
    Messages:
    1,040
    YOOOOO

    Storm chasing in beamng… this is what I wanted for a long time in beam! Looks sick on pics, gonna try the mod when I will be on pc :)
     
    • Like Like x 1
  17. ArsPro

    ArsPro
    Expand Collapse

    Joined:
    Oct 13, 2022
    Messages:
    1,040
    this tornado absolutely likes to destroy covets... pure covet lol

    "Beast" D-Series cant even get lift off the ground though lmao
    Yes, the power of beast is even high than tornado's!

    Really good mod, the stormy weather makes it fun to drive on slippery roads))))
    upload_2025-3-3_22-56-45.png
     
    • Like Like x 3
  18. lamborambo2000

    lamborambo2000
    Expand Collapse

    Joined:
    Jul 25, 2022
    Messages:
    4
    I really like this mod you should add a Ui where it will tell you what kind of weather is expected, and you can customize the weather easier
     
    • Agree Agree x 2
  19. MegaKnight

    MegaKnight
    Expand Collapse

    Joined:
    Sep 12, 2024
    Messages:
    195
    Thank you for the suggestion :)
    I implemented a UI and uploaded a new version to the repo. It should be approved tomorrow.

    ui.png :eek: gotta fix that typo!
     
    • Like Like x 3
  20. Musicman27

    Musicman27
    Expand Collapse

    Joined:
    Dec 13, 2023
    Messages:
    2,568
    Woo-Hoo.gif
     
  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