1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Dedicated Server - Dynamic Race Bot [DRB]

Discussion in 'Automobilista 2 - General Discussion' started by Svenny, Dec 25, 2023.

  1. Mikk Schleifer

    Mikk Schleifer Active Member AMS2 Club Member

    Joined:
    Nov 30, 2019
    Messages:
    209
    Likes Received:
    182
    0.4.2 and lua 0.4.3 workin fine here
     
    • Like Like x 1
  2. Diesels

    Diesels New Member

    Joined:
    Dec 27, 2024
    Messages:
    13
    Likes Received:
    3
    I can try that tomorrow, a litte bit more busy atm, sorry.
     
  3. Diesels

    Diesels New Member

    Joined:
    Dec 27, 2024
    Messages:
    13
    Likes Received:
    3
    So this new one also did not work, and I am beginning to think this is some mistake on my side.
    This is the ams2_drb_config.json that i use. It works with 0.4.1 but not 0.4.2 0.4.3 and the newest one.
    Code:
    // Config version.
    version : 4
    
    // Default configuration.
    config : {
    
        // Is the current rotation index persistent? If true, the rotation will continue after server restart,
        // If false, the rotation will always start from the first setup.
        // You can always delete the sms_rotate_data.json file from lua_config to reset the persisted index.
        "persist_index" : true,
    
        // Default = false
        // Setting to true will output to console certain results  
        "welcome_msg": true,
        "announce_bot" : "[DRB]: Dynamic Race System is running on this server.",
        "send_combo_info": true,
        // Please keep as short as possible - long message don't get split and horizontal scrolling in game chat isn't great.
        "community_msg": "",
        "voice_chat_msg": "",
    
        // Server Admins
        // Admins regardless of if host or not can issue commands via in game chat.
        // Commands:
        // "advance" : Advances session to next or if in Race, resets race to start.
        // "reset" : performs a soft restart of server - destroys session and will need to load back into lobby
        // "+" : Whilst in lobby, admin can skip current combo and generate new combo.
        // "kp" : Will kick player from server. eg type in chat "kp Svenny". It will find player with that name and kick them and ban them for x secs.
        // If the player being kicked is an admin, it will fail..
        // Multiple admins are allowed, just need to separate each with a comma. eg: "72315679455879643,79666345689456463"
        "ingame_admins_steamids" : "mysteamid",
        "ban_secs" : 600,
    
        // Set to true to have all races use to Dedicated Servers date.
        // If false, dates are as per track defaults.
        "use_current_date" : false,
        // Dynamic Dates are randomly selected between default track dates and current date
        "use_dynamic_date" : true,
    
        // Default true
        // This disables the rotation section below and selects track and vehicles/classes
        //  from the none commented out tracks, vehicles/vehicle classes below
        "full_dynamic_system" : true,
        "enable_dynamic_combos": true,
        "enable_dynamic_vehicles" : false,
        "enable_dynamic_vehicle_classes" : true,
    
        // Allow Multi class/track day sessions
        "enable_dynamic_multi_classes" : true,
        // Max is 10. Set to zero for DRB to randomly select number of slots
        "enable_dynamic_multi_classes_count" : 10,
    
        // Enabled by default
        // This will calculate weather probability over the rotation list.
        // If disabled, historical real time weather is used. Note that P/Q/R's *_time_progression must be set or defaults to 1
        "enable_dynamic_weather_system" : true,  
        "dynamic_weather_forecast"    : "MediumCloud",
        "dynamic_weather_probability"    : 10,
        // So the above probability factor is calculated over each session.
        // If rotations are configured it will be over rotations.
        // If NOT using rotations, define the probability of x race weekends. Default is 10.
        "dynamic_weather_probability_sessions"    : 10,
        // By default each slot simulates 60 mins.
        // 4 slots * 60 is 240mins, real-time stage length is 10 mins
        // to work out date/weather progression is 240 / stage length = 24
        // This value then gets rounded down to the nearest progression multiplier which is 20
        // NOTE: If a session's time progression is > 0 then that takes precedence over this calculation.
        "dynamic_weather_slot_duration": 60,
    
    
        // Enable Race stage timeframe
        "dynamic_race_timeframe" : true,
        // Enable Night Races. Default false
        "enable_night_races" : true,
        // Set the 24hr hour range for when the race can start
        // If enable_night_races is true, the below will be overriden in game with start = 0 and end = 23 for race session only..
        "dynamic_race_earliest_start_hour" : 5,
        "dynamic_race_latest_start_hour" : 22,
    
        // Stage Length and Max Number of Slots to randomise between.
        // Short stages should have low max slots to avoid rapid, unrealistic weather changes
        // Set length to zero to disable stage
        "practice_length_mins" : 45,
        // Max Number of Slots to randomise between.
        "practice_weather_slots_max" : 2,
        // Progression options are 1,5,10,15,20,25,30,35,40,45,50,55,60
        // Set this to zero to have DRB calculate it automatically
        "practice_time_progression": 0,
      
    
        // Stage Length.
        // Short stages should have low max slots to avoid rapid, unrealistic weather changes
        // Set length to zero to disable stage
        "qualify_length_mins" : 15,
        // Max Number of Slots to randomise between.
        "qualify_weather_slots_max" : 1,
        // Progression options are 1,5,10,15,20,25,30,35,40,45,50,55,60
        // Set this to zero to have DRB calculate it automatically
        "qualify_time_progression": 0,
      
    
        // Stage Length.
        // Short stages should have low max slots to avoid rapid, unrealistic weather changes
        // Set length to zero to disable stage
        // If raced_timed is false, race length is how many laps
        "race_length" : 45,
        "race_timed" : true,
        // Max Number of Slots to randomise between.
        "race_weather_slots_max" : 4,
        // Progression options are 1,5,10,15,20,25,30,35,40,45,50,55,60
        // Set this to zero to have DRB calculate it automatically
        "race_time_progression": 0,  
    
        // These are the weather events and the order in which that will be sorted and have factors applied.
        // Suggest to leave this as is and if you don't want a certain event to be used,
        // use the extreme weather events list below instead  
        "weather" : [
            {"name" : "Hazy","id" : 1,},
            {"name" : "Clear","id" : 2,},
            {"name" : "LightCloud","id" : 3,},
            {"name" : "MediumCloud","id" : 4,},
            {"name" : "HeavyCloud","id" : 5,},
            {"name" : "Overcast","id" : 6,},
            {"name" : "LightRain","id" : 7,},
            {"name" : "Rain","id" : 8,},
            {"name" : "Storm","id" : 9,},
            {"name" : "ThunderStorm","id" : 10,},
            {"name" : "Foggy","id" : 11,},
            {"name" : "FogWithRain","id" : 12,},
            {"name" : "HeavyFog","id" : 13,},
            {"name" : "HeavyFogWithRain","id" :14,},
            {"name" : "Random","id" :15,}
        ],
        // Weather Weight
        // Assign a value to each weather type. The higher the number the more weight is assigned to that weather
        // type
        // A weight of zero excludes this weather from the available weather types
        "weather_weight" : {
            "Hazy" : 5,
            "Clear" : 15,
            "LightCloud" : 12,
            "MediumCloud" : 10,
            "HeavyCloud" : 9,
            "Overcast" : 7,
            "LightRain" : 6,
            "Rain" : 0,
            "Storm" : 0,
            "ThunderStorm" : 0,
            "Foggy" : 4,
            "FogWithRain" : 0,
            "HeavyFog" : 3,
            "HeavyFogWithRain" : 0,
            "Random" : 0,
        },
        // Credit to Coanda https://forum.reizastudios.com/threads/automobilista-2-extended-car-info-spreadsheet.16746/
        // Other data sourced manually from game itself.
        "vehicle_classes_with_lights" : [
            "P1",
            "P1 Gen2",
            "P2",
            "P3",
            "P4",
            "Opala86",
            "StockCarV8_2020",
            "StockCarV8_2021",
            "StockCarV8_2022",
            "StockCarV8_2023",
            "StockCarV8_2024",
            "Carrera Cup",
            "CopaClassicB",
            "CopaUno",
            "TSICup",
            "Group A",
            "Group C",
            "DPI",
            "LMDh",
            "LMP2",
            "LMP2_Gen1",
            "TC60S",
            "TC60S2",
            "TC70S",
            "Procar",
            "GTOpen",
            "GT1",
            "GTE",      
            "GT3",      
            "GT3_Gen2",      
            "GT4",      
            "G40Cup",      
            "G55Supercup",      
            "SuperV8",      
            "Cat620R",      
            "Cat_Academy",      
            "Cat_Supersport",      
            "Street",      
            "Supercars",      
            "Hypercars",
            "RX",      
        ],  
        "flags" : [
            "ABS_ALLOWED",
            "ALLOW_CUSTOM_VEHICLE_SETUP",
            //"ANTI_GRIEFING_COLLISIONS",
            "AUTO_START_ENGINE",
            "COOLDOWNLAP",
            // "DISABLE_DRIVING_LINE",
            // "FORCE_MANUAL",
            "FORCE_REALISTIC_DRIVING_AIDS",
            // "HAS_BROADCASTER",
            // "HAS_RACE_DIRECTOR",
            "MECHANICAL_FAILURES",
            // "ONLINE_REPUTATION_ENABLED",
            // "PASSWORD_PROTECTED",
            "PIT_SPEED_LIMITER",
            "PIT_STOP_ERRORS_ALLOWED",
            // "SC_ALLOWED",
            "TCS_ALLOWED",
            "TIMED_RACE",
            "WAIT_FOR_RACE_READY_INPUT",
        ],
        // The default setup. This is a table with attributes and values. The following rules apply to the attributes:
        // - If TrackId is specified: The track to enforce. Automatically sets 1 to ServerControlsTrack
        // - If VehicleModelId is specified: The vehicle to enforce. Automatically sets 1 to ServerControlsVehicle, sets FORCE_IDENTICAL_VEHICLES to Flags
        // - If VehicleClassId is specified: The class to enforce. Automatically sets 1 to ServerControlsVehicleClass, sets FORCE_SAME_VEHICLE_CLASS to Flags
        // - Track, vehicle model, vehicle class and all enum/flags attributes can use values in string forms - so you can use either track id, or track name.
        // - Flags in string form can contain multiple flags separated by comma, so for example "ABS_ALLOWED,SC_ALLOWED,TCS_ALLOWED"
        // - The setup should never contain any of the "ServerControls" attributes, those are decided automatically.
        // - The setup should never contain both VehicleModelId and VehicleClassId at the same time. Restrict either the class or specific vehicle.
        // - The Flags attribute should never contain FORCE_IDENTICAL_VEHICLES or FORCE_SAME_VEHICLE_CLASS flags, those are decided automatically.
        "default" : {
            "GridSize" : 32,
            "MaxPlayers" : 4,
            // 0 = Default/Qualify, 1 = Host First, 2 = Host Middle, 3 = Host Last, 4 = Random
            "GridLayout" : 0,
            // If flag ONLINE_REPUTATION_ENABLED enabled
            // AMS2 Builtin Ranks 0 = U, 1 = F, 2 = E, 3 = D, 4 = C, 5 = B, 6 = A, 7 = S
            //"MinimumOnlineRank" : 3,
            // Minimum online strength. Valid values are in range from 100 to 5000.
            //"MinimumOnlineStrength" : 1200,
            // AI Difficulty
            "OpponentDifficulty" : 90,
            // Penalty values are 0 = None, 1 = Full
            "PenaltiesType" : 1,
            "AllowedCutsBeforePenalty" : 6,
            "DriveThroughPenalty" : 1,
            "PitWhiteLinePenalty" : 1,  
            "FullCourseYellows" : 0,
            // Scheduled FCY values are 0 = Off, 1 = 25%, 2 = 50%, 3 = 75%, 4 = Random
            "RaceScheduledFullCourseYellow" : 0,
            // Random Failure values are 0 = Off, 1 = Standard, 2 = SYNC_TO_RACE, 3 = X2, 4 = X3, 5 = X4, 6 = X5, 7 = X10
            "DamageRandomFailures" : 7,
            // Damage Types : OFF = 0, VISUAL_ONLY = 1, PERFORMANCEIMPACTING = 2, FULL = 3
            "DamageType" : "OFF",
            // Damage Scales : LOW = 0, MEDIUM = 1, HIGH = 2, MAX = 3
            "DamageScale" : 0,
            // Fuel & Tire Usage Options : OFF , STANDARD, X2 , X3 , X4 , X5 3
            "TireWearType" : "X3",
            "FuelUsageType" : "X2",
             // Views = ANY = 0, CockpitHelmet = 2
            "AllowedViews" : 0,
            // User Control in Pits. 0 = Auto Drive in and out, 1 is controlled by player
            "ManualPitStops" : 1,
            // The pit speed limit in KPH. Values between 40 and 200 in steps of 5 are valid (rounded down when needed). Unset, 0 or < 40 will result in track default limit
            "PitSpeedLimit" : 0,
            "DisablePitstopRefuelling" : 0,
            "RaceMandatoryPitStops" : 0,
            // PitStopsMinTyresRange 0 - 4
            "RaceMandatoryPitStopsMinTyres" : 0,
            "RaceFormationLap" : 0,
            "RaceRollingStart" : 0,
            "RaceExtraLap" : 1,
             // Session Details
            "AutoAdvanceSession" : 0,
            //Practice
            "PracticeLength" : 2,
            "PracticeDateHour" : 8,
            // Track Preset Options = Default Progressing, Wet, Damp, Green, Light Rubber, Medium Rubber, Heavy Rubber
            "PracticeLiveTrackPreset" : "Default Progressing",
            "PracticeDateProgression" : 1,
            // Qualify
            // Private session is 1 or 0 to have all drivers on track during Qualifying.
            "QualifyPrivateSession" : 1,
            "QualifyLength" : 10,
            "QualifyDateHour" : 10,
            // Track Preset Options = Default Progressing, Wet, Damp, Green, Light Rubber, Medium Rubber, Heavy Rubber
            "QualifyLiveTrackPreset" : "Default Progressing",
            //Race
            "RaceLength" : 8,
            "RaceDateHour" : 12,
            // Track Preset Options = Default Progressing, Wet, Damp, Green, Light Rubber, Medium Rubber, Heavy Rubber
            "RaceLiveTrackPreset" : "Default Progressing",
            "RaceDateProgression" : 1,
          
        },
        // The rotation. Array of setups to rotate. If empty, just the default setup will be used with no actual rotation happening.
        // These setups are applied on top of the default setup, then applied to the game. Previous setup in the rotation is never used.
        // So for example if you wanted to repeat the same track in multiple consecutive setups, different from the default track,
        // each of those setups needs to explicitly include that track. Also remember that apart from the flags nothing can be "removed"
        // from the default setup, so if the default setup contains a track, some track will always be enforced (either the default one,
        // or the setup-specific one). And one last thing, these override setups can never include an attribute that's not specified in
        // the default setup - it can just override some of the default attributes, not add new ones. The only exception are the
        // track/vehicle/class attributes.
        // Attributes in these setups can have a special attribute RemoveFlags set, which will remove the specified flags from the default
        // setup instead of adding them to it (which is what the Flags attribute will do)
        "rotation" : []
    }
     
  4. Svenny

    Svenny Member

    Joined:
    Jul 25, 2023
    Messages:
    49
    Likes Received:
    38
    Thanks. Not sure why this isn't working your end.
    I've tried your config, and it works with latest lua version (not released), the lua file I attached a few posts pack and also 0.4.3 download in the first post.

    Can I suggest you remove/delete the ams2_drb lua folder, any ams2_drb.* files in the lua_config folder and start from scatch again.

    Have you changed anything in the main server.cfg file since it worked?
     
  5. Diesels

    Diesels New Member

    Joined:
    Dec 27, 2024
    Messages:
    13
    Likes Received:
    3
    So I deleted everything and started new with 0.4.3 and it worked. And I also found the Problem, wich is the ams2_drb_data.json. I made a new one starting with the default one and when I only allw the classes GT3gen1, gen2 and GT4 the server no longer works or appears in the server browser.
     
    • Informative Informative x 1
  6. Svenny

    Svenny Member

    Joined:
    Jul 25, 2023
    Messages:
    49
    Likes Received:
    38
    Thanks for the update. When selecting the 3 classes only, do you have the multiclass option also set like you had configured before or was it just using the default settings?
    I'll try default and those 3 classes only to see if I can replicate.

    EDIT: Was able to replicate using only 3 classes enabled and 10 in the mutliclass. This caused an infinite loop when selecting classes trying to get to 10 but could only select 3. New download version available 0.4.4 - Just copy the main "ams2_drb/ams2_drb.lua". I've also added some additional chat messages for admins only to remove vehicles/classes and tracks incase they had been missed on setup + autosaves.
     
    Last edited: Jan 12, 2025
    • Like Like x 2
  7. Diesels

    Diesels New Member

    Joined:
    Dec 27, 2024
    Messages:
    13
    Likes Received:
    3
    Tested 0.4.4 and everything works now, I had no Problems.:)
     
    • Like Like x 1
  8. Ted Pieper

    Ted Pieper New Member

    Joined:
    Feb 6, 2025
    Messages:
    4
    Likes Received:
    1
    This is awesome, thank you for all your work on this! Also, your Better Host looks nice as well! I'm going to be using both of these.

    I'm currently building a Dedicated Server for the Americas Racing League. I just wanted to reach out and see if I can get any insight into something I'm trying to achieve.

    I love the dynamic weather and time slots.

    However I want it to be 3 classes, and the same 3 classes each and every rotation. Then I only want certain tracks in the rotation. Is this possible? What values do I change to make this possible? Do I just set everything to "false" in the ams2_drb_data.json that I don't want? I would like GT3 Gen2, LMP, and LMDh always the car classes as well. And have the sessions always be like 10min/10min/10min.

    Then my second question is for our league nights. How would I use just those Admin Commands? The classes, track, weather and such is all going to be preselected for league race nights, but having the option for that soft reset on a session would be VERY handy.

    Thank You!!
     
  9. Ted Pieper

    Ted Pieper New Member

    Joined:
    Feb 6, 2025
    Messages:
    4
    Likes Received:
    1
    I've got it running now. I've disabled everything in the ams2_drb_data.json that I don't want. But it seems to only pick 2 classes ever. Probably just the dynamics, I'm unsure of how to turn off the full dynamics and just force it to do only what I want.

    Also is there an option for just resetting the session? Say on Race, we totally mess up the start and half the field is totalled. Can we just restart that session? I type in Reset I believe it takes ya all the way back to practice right?

    And for time progression, I just want it always on Real Time, what number is that? I set it on 1 and it does 5x time progression.
     
  10. Svenny

    Svenny Member

    Joined:
    Jul 25, 2023
    Messages:
    49
    Likes Received:
    38
    Hi Ted and thanks for the feedback, glad you enjoy and got it working.

    I haven't tested but have you setup the config section like below since this should loop through all active classes to fill slots .
    Code:
         // Allow Multi class/track day sessions
        "enable_dynamic_multi_classes" : true,
        // Max is 10. Set to zero for DRB to randomly select number of slots
        "enable_dynamic_multi_classes_count" : 3,
    
    There is no way (not that I've found), to reset the Practice/Qualify sessions however in the race session, typing in "advance" does restart the race session (but will instantly start race countdown so limited time to prepare anything), using advance in any other session will....advance it. Typing in "reset" performs a soft server restart which basically disconnects everyone, restarts and lobby will appear in server browser with a new dynamic session created.

    As for the time progression, I did note to myself a little while back that it was missing the option for "Realtime". Currently the code rounds in multiples of 5, with 5x being the mininum and this syncs it with Weather Progression. I'll make some time to have a look this weekend to see how I can better improve that. In saying that, setting the time progression >0 can result in some weird/rapid/looping weather transitions since I typically back calulcate the progression rate based on the weather slots selected to help smooth out the transitions, but I know that this logic still isn't perfect.
     
  11. Ted Pieper

    Ted Pieper New Member

    Joined:
    Feb 6, 2025
    Messages:
    4
    Likes Received:
    1
    Svenny! So far this tool is great!

    So the Multi Class seems to work after I do the "+" command. Seems it's only on initial startup that it's not totally correct. I believe this is probably more an AMS2 DS problem than your code.

    I changed the weather back to just 0 to leave it. From what I know on MP Servers, Weather and Time progression being just at Realtime or off is the best way to go about it, as it's less strain on the system. If we get the selection to be Realtime weather and time progression with the dynamic weather you have coded, that'd be amazing!

    The "advance" command in the race worked perfectly for resetting the race like we needed. So thank you for that!

    I have another question that just came up for me, I am setting up a separate practice server now for a different one off race. And I'm trying to have it have 4 weather slots always. Is there a way to have it always 4, instead of max 4 and it just chooses 1 thru 4. I tried commenting out "practice_weather_slots_max" : 4 and put in the standard code of "PracticeWeatherSlots" : 4, and also tried just "practice_weather_slots" and neither seem to do it..

    Thank You!!
     
  12. Svenny

    Svenny Member

    Joined:
    Jul 25, 2023
    Messages:
    49
    Likes Received:
    38
    mmm...Weather has options for realtime and sync with race. So if using realtime for both session and weather progression a 10min race would only every see the first weather slot used since weather slots are in 60min (in game time) durations, however having weather progression set to "sync with race" would mean a 10min, 4 slot weather session would have weather change every 2.5mins. I suspose this is OK since the logic now sort of does this anyway.
     
  13. Svenny

    Svenny Member

    Joined:
    Jul 25, 2023
    Messages:
    49
    Likes Received:
    38
    @Ted Pieper - I've now added a few things that hopefully fulfils your request.

    Please see attached zip file that contains the latest version 0.4.5. Simply extract and copy/replace the files in lua/ams2_drb/ on the server.
    Please note that because there are new config settings, when you startup the server for the first time, it will copy the old config and replace it with a new default one, so you'll have to redo your custom config again.

    Whats been added/changed is config options for setting fixed weather slots and added progression values for 0 for Sync to Race, 1 for Realtime and 99 for how DRB worked previously (default).

    Code:
    // Enable Fixed Weather Slots. Will use max weather slots number every rotation
        "practice_fixed_slots" : false,
        // Max Number of Slots to randomise between.
        "practice_weather_slots_max" : 1,
        // Progression options are 0,1,5,10,15,20,25,30,35,40,45,50,55,60,99. 0 = Sync with Race/Time Progression and 1 = Realtime
        // Set this to 99 to have DRB calculate it automatically.
        // If you want to evenly spread fixed weather slots throughout session, it's advised to set time progression to 0
        "practice_time_progression": 99,
    
    And for those new to AMS2 weather settings, if you have 4 weather slots, session length set to 10mins and time_progression set to 1/Realtime, you will only every see the first weather slot's weather during the session and not the reamining 3. To see all weather slots spread evenly during a session you should set time_progression to 0/Sync To Race.

    [EDIT]: File moved to release v0.4.5 - See first post.
     
    Last edited: Feb 15, 2025
  14. Ted Pieper

    Ted Pieper New Member

    Joined:
    Feb 6, 2025
    Messages:
    4
    Likes Received:
    1
    @Svenny

    Thank you so much!! I have loaded in the new code, everything seems to be working great!

    What I was trying to force 4 weather slots on was a 2.5hr race with 25x time progression. We are going to do some Endurance racing on Nordshleife, Le Mans, Etc.

    I'm going to keep configuring races with this code, and let ya know if I run into anything else!

    Thank You again!
     
    • Like Like x 1

Share This Page