Better Host - Dedicated Server Lua Addon

Discussion in 'Automobilista 2 - General Discussion' started by Svenny, Dec 8, 2024.

  1. Svenny

    Svenny Member

    Joined:
    Jul 25, 2023
    Messages:
    49
    Likes Received:
    39
    With the increase in numbers and addition of more multiplayer servers being populated, it was mentioned to me that the better host lua addon that I've made and have been tinkering with over the past several months might come in handy to server admins.

    This is still in a beta form, however if you wish to assist in testing and reporting bugs, updating code, etc, please head over to GitHub - glenv/AMS2-Better-Host: A Lua Addon Script to AMS2 Dedicated Server. There is also installation info over on github to help.

    What is Better Host?

    A lua Addon Script for AMS2 Dedciated Server to help reduce lag between players when host has poor ping to dedciated server. The Host is the first person to join the server.

    How does it choose better host?

    The default is better host will capture all players pings every 15 seconds, then takes the avg of these pings and compares it to other players. If the host has the lowest ping, there is no better host however if a player has a lower ping value, they should be a better host. There is a paramater in the config file called "bh_ms_range" to reduce minor ping variance between players with a default set of 75ms. If the host has a avg ping of 150, a better host would need to have an avg ping of 75 or less to become a better host.

    How does a better host become host?

    In order for the better host to become host, everyone between the current host and the better host needs to be kicked from the server. The affected players will be notified via in game chat to leave and rejoin server however there is a default limit of 3 reminders with reminders sent to players in game chat every 10 secs, if they don't leave they will be kicked.

    PS: The list/index of players is based on jointime to the server, so you might be determined to be the better host but 10 other players had joined server before you, these 10 players will receive message to rejoin server and if ignored will forcefully be removed.

    At the moment, better host only runs in Lobby and Practice sessions, however this might get extended to Qualifying (opt in) in future releases.

    A good explanation of some findings on how the DS works can be found here: AMS2 Dedicated Server Tool / SteamCMD Support
     

    Attached Files:

    Last edited: Dec 8, 2024
    • Like Like x 6
  2. Theoloop

    Theoloop Active Member AMS2 Club Member

    Joined:
    Oct 4, 2021
    Messages:
    228
    Likes Received:
    138
    • Like Like x 4
    • Agree Agree x 2
  3. Florent.Neron

    Florent.Neron New Member

    Joined:
    Feb 18, 2024
    Messages:
    22
    Likes Received:
    3
    Great idea!
    As the owner of a dedicated server I've had a lot of player disconnections!

    .
     
  4. Svenny

    Svenny Member

    Joined:
    Jul 25, 2023
    Messages:
    49
    Likes Received:
    39
    Thanks. If you decide to try this out on your server, suggest a practice/casual server to start with (as it's in beta still) and see how things go. I don't have enough data to say if this addon results in any less disconnections or introduces more instability due to multiple host migrations. Unfortunately there's not much you can do lua side to control this, except trying to ensure the host has the better connection/lower latency to the Dedi.
     
    Last edited: Jan 1, 2025
    • Like Like x 1

Share This Page