Asynchronous lua environment

Discussion in 'Ideas and Suggestions' started by Anonymous275, Oct 13, 2020.

  1. Anonymous275

    Anonymous275
    Expand Collapse

    Joined:
    Feb 27, 2016
    Messages:
    23
    Just an idea and a potential game changer:
    A way to load and execute a lua file with it's own lua state on a thread that isn't the main game's loop, allowing the possibility of executing long tasks or tasks that requires multiple frames without affecting game performance.
     
    • Agree Agree x 4
    • Like Like x 2
  2. Diamondback

    Diamondback
    Expand Collapse
    Vehicle Systems Lead
    BeamNG Team

    Joined:
    Apr 8, 2014
    Messages:
    1,957
    Do you have anything specific in mind? :)
     
  3. Anonymous275

    Anonymous275
    Expand Collapse

    Joined:
    Feb 27, 2016
    Messages:
    23
    Well surely not everything needs to be synchronous one day the game will have so much scripts that it will be unable to run properly. The lua files could also be put in a sub folder that way it would be very clear which ones are asynchronous. :D
    --- Post updated ---
    Furthermore mods could potentially prime custom asynchronous events that will get triggered when conditions are met rather efficiently since it would be independent from any update function call.
     
    • Agree Agree x 1
  4. Anonymous275

    Anonymous275
    Expand Collapse

    Joined:
    Feb 27, 2016
    Messages:
    23
    Another thing that just thought of: A system that allows instant communication between other cars would be possible and it could be used for a potentially hard ai to flee from, the ai could be completely loaded and handled asynchronously too and if I am not mistaking even car spawning could be done like that so you never get a freeze while playing (unless ofc your cpu cannot handle that many cars). This opens so many modding and optimization possibilities :D
     
    • Agree Agree x 3
  5. Anonymous275

    Anonymous275
    Expand Collapse

    Joined:
    Feb 27, 2016
    Messages:
    23
    Sorry for the bump, but this caught my eye when i was reading through all the changes, I am so excited about these! :D
    upload_2021-4-13_0-10-44.png
     
    • Like Like x 3
  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