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

AMS2 Dedicated Server Tool / SteamCMD Support

Discussion in 'Automobilista 2 - General Discussion' started by Dave Stephenson, May 29, 2020.

  1. he02

    he02 New Member AMS2 Club Member

    Joined:
    Dec 6, 2016
    Messages:
    3
    Likes Received:
    0
    hi, would you like to tell me how to create a leaderboard like this, thx!
     
  2. Shriukan

    Shriukan Touristenfahrten Community AMS2 Club Member

    Joined:
    Sep 23, 2019
    Messages:
    1,293
    Likes Received:
    931
    Lua addon to detect laptimes and sort the ranks, webengine and the website that loads the file, parses through it and shows the laptimes. I didn't do the addon or website, but rather, ported it over from m00lean who passed me his pC2 files.
     
    Last edited: Dec 4, 2020
    • Like Like x 1
  3. Daniel R.

    Daniel R. New Member AMS2 Club Member

    Joined:
    Mar 21, 2017
    Messages:
    11
    Likes Received:
    5
    Hello Everybody,
    I have a little problem.
    I rented a Cloud server with Ubuntu 20.04 on it. I successfully managed to install a gui, steam and steamcmd.
    I can successfully start the DedicatedServerCmd.elf file in the terminal.
    No errors in the terminal!
    Server switches to running state as it does on my normal PC.
    Ports on the server are all open. No messages of not being able to communicate.

    Anyway, the server does not show up in the ingame Server List.

    Any ideas?

    The server.cfg is fine since I used it last week for a race I set up.

    Cheers Dan
     
  4. Shriukan

    Shriukan Touristenfahrten Community AMS2 Club Member

    Joined:
    Sep 23, 2019
    Messages:
    1,293
    Likes Received:
    931
    I am simply running the .exe via wine since there is no Linux client yet. Are you sure you downloaded the correct program? (aka windows ams2ds and not the pc2 ds)
     
  5. Dave Stephenson

    Dave Stephenson Administrator Staff Member AMS2 Club Member

    Joined:
    Feb 13, 2016
    Messages:
    873
    Likes Received:
    1,124
    @Daniel R. There is no linux build of our dedi...

    As far as I'm aware it should run without issue under wine as @Shriukan seems to have confirmed. You can force steamcmd to install another platforms depots by providing the option
    Code:
    +@sSteamCmdForcePlatformType windows
    as the first argument to update/validate commands
     
  6. Dave Stephenson

    Dave Stephenson Administrator Staff Member AMS2 Club Member

    Joined:
    Feb 13, 2016
    Messages:
    873
    Likes Received:
    1,124
    Escaping to pits immediately invalidates the current lap as can be seen in the HUD (time goes red in lap info panel and does not get listed on the in-game leaderboards in pause/garage screens). CountThisLapTimes is correctly set to 0 in these circumstance.

    I think you may need to look closer to home on this one as the code you posted previously and have since removed had a bug in it and from the sound of things has had one for a very long time.

    CountThisLapTimes is not a part of the 'event' table but is actually part of the 'event.attributes' table.

    Code:
    if event.name == "Lap" then
    if event.CountThisLapTimes ~= 0 then
    add_new_vehicleEntry(event, participant)
     
  7. Daniel R.

    Daniel R. New Member AMS2 Club Member

    Joined:
    Mar 21, 2017
    Messages:
    11
    Likes Received:
    5
    Hi Thank you, I hoped it would work without, but I will try with vine.

    Its strange though, when I start the server in the terminal... It looks good...
     
  8. Shriukan

    Shriukan Touristenfahrten Community AMS2 Club Member

    Joined:
    Sep 23, 2019
    Messages:
    1,293
    Likes Received:
    931
    oh wow thanks for the return on this. Me and m00lean were checking on this this afternoon. This explains the issue. We thought we could simply copy-paste his pC2 script. I had removed the bit because i was under the impression this was the irrelevant bit. Cheers for checking my edits and going above and beyond to correct me on the callback. We were testing an alternative by forcing lap distance calculations and funnily enough we noticed that events.DistanceTravelled was actually events.attributes.DistanceTravelled.

    Needless to say, I feel dumb xD
    Then again documentation is scarce :p

    Again, thanks :)

    Edit: Lesson learned. Check the api list first.
     
    Last edited: Dec 4, 2020
    • Agree Agree x 1
  9. Dave Stephenson

    Dave Stephenson Administrator Staff Member AMS2 Club Member

    Joined:
    Feb 13, 2016
    Messages:
    873
    Likes Received:
    1,124
    np, you're welcome. I got lucky with the code and saw it before you edited it though it was some time after before I had chance to look properly and reply. There was a little head scratching going on when I returned :D

    As far as I'm aware it is/would have been the same in pcars2 as I haven't changed that code so if it's still being run for pcars2 it may be worth checking there too.

    As for docs they should ideally be better of course but as you have the data and freedom to add code you can also always dump the data to the terminal while testing on a local dedi instance. In the addon_callback function at the bottom of sms_stats.lua throwing in a for to print the table on the event and/or it's attributes will quickly get you a list of what's included in each. Add it at the top if you want everything or drop it after one of the if statements for something a little narrower in scope.

    Code:
    print("--------------------------------------------------------")
    
    forkey, valueinpairs(event) do
    print("\t", key, " -- ", value)
    end
    
    forkey, valueinpairs(event.attributes) do
    print("\t\t", key, " -- ", value)
    end
    
    print("--------------------------------------------------------")
    
    You will find that the data on the event type is typically just the data that describes the event; it's type, it's name, when it happened, and who it concerns etc. The attributes key on the event is where the event specific stuff is found; the old state/new state, or for laps, if it's valid and the sector times etc.
     
    Last edited: Dec 4, 2020
    • Winner Winner x 1
  10. ToMythTo

    ToMythTo The Hero We Need But Not Deserved

    Joined:
    Aug 31, 2020
    Messages:
    273
    Likes Received:
    78
    Hey guys, I'm setting a rotation based MP race. When I try to set the races without quali&practice and join (while only me in the server) "Waiting for players" button is deactivated. But what i want to is start the race if even there is only me (to test some other things). If I set any quali or practice no problem for that rotation index only.
    Any others having this issue?
     
  11. Daniel R.

    Daniel R. New Member AMS2 Club Member

    Joined:
    Mar 21, 2017
    Messages:
    11
    Likes Received:
    5
    So, i installed wine on the cloud server. I copied the AMS2 Windows DS files from my windows installation to my linux server (is that the correct way btw?)

    When i fire up the DedicatedServerCmd.exe with wine it looks good from what i see in the console/terminal. it switches to running state.

    But i can´t see the server ingame.
    All ports are opened btw.

    Any suggestions?

    Cheers Dan!
     
  12. Shriukan

    Shriukan Touristenfahrten Community AMS2 Club Member

    Joined:
    Sep 23, 2019
    Messages:
    1,293
    Likes Received:
    931
    Would be better if you install via SteamCmd by forcing platformType automatically to windows as shown above or type it manually without the + sign and app_install

    You need to make sure there isn't one single error in the server.cfg file or it will switch to running state but not be able to broadcast being live to Steam.
     
  13. Daniel R.

    Daniel R. New Member AMS2 Club Member

    Joined:
    Mar 21, 2017
    Messages:
    11
    Likes Received:
    5
    Hi, so i did as proposed, when i start up the DedicatedServerCmd.exe via wine i get this...looks normal to me...

    root@pensive-montalcini:~/steamcmd/Automobilista 2 - Dedicated Server# sudo wine DedicatedServerCmd.exe
    [2020-12-07 10:43:10] INFO: Starting up the Dedicated Server Library.
    [2020-12-07 10:43:10] INFO: Server configuration loaded:
    - server build version: 1
    - protocol version: 64 (1.0.0.64)
    - server name: SimProlouge Mini-Cup
    - max session size: 20
    - details: secure, bind IP INADDR_ANY, Steam port 8766, host port 27015, query port 27016, password protected yes
    - whitelist size: 0
    - blacklist size: 0
    - lua api: enabled
    - http api: enabled listening at 127.0.0.1:9000, 1 extra header(s) defined
    - allow empty join: enabled
    - game setup control: enabled
    - sports play : disabled
    Setting breakpad minidump AppID = 1066890
    FillInMachineIDInfo took a total of 42 milliseconds
    [2020-12-07 10:43:10] INFO: HttpApi started
    [2020-12-07 10:43:10] INFO: Loading LuaApi addon 'sms_base'...
    [2020-12-07 10:43:10] INFO: Loading LuaApi addon 'sms_motd'...
    [2020-12-07 10:43:10] INFO: Loading LuaApi addon 'sms_stats'...
    [2020-12-07 10:43:11] INFO: LuaApi started
    [2020-12-07 10:43:11] INFO: Dedicated server is starting...
    [2020-12-07 10:43:11] INFO: Connection to Steam established
    [2020-12-07 10:43:11] INFO: Received public IP 82.165.56.13
    [2020-12-07 10:43:12] INFO: Server logged in with Steam id 90140864289133578 ; server is secure
    [2020-12-07 10:43:12] INFO: Server startup finished: AppId 1066890, public IP 82.165.56.13, Steam id 90140864289133578 ; switching to running state


    I´m really stuck....
     
  14. Wolfgang Herold

    Wolfgang Herold I Like Liveries :) AMS2 Club Member

    Joined:
    Apr 3, 2016
    Messages:
    2,418
    Likes Received:
    1,446
    Dan, you set your http interface to local host.
    If you set it to your public ip, is the server reachable by web interface then ?
     
  15. Shriukan

    Shriukan Touristenfahrten Community AMS2 Club Member

    Joined:
    Sep 23, 2019
    Messages:
    1,293
    Likes Received:
    931
    Trying to access the webAPI through the publicIP address and the port number (http://82.165.56.13:9000) doesn't provide an answer so something is blocking access.
     
  16. Daniel R.

    Daniel R. New Member AMS2 Club Member

    Joined:
    Mar 21, 2017
    Messages:
    11
    Likes Received:
    5
    Thank you, yes, something seems to be blocked. just have to find out now what it is...
     
  17. Daniel R.

    Daniel R. New Member AMS2 Club Member

    Joined:
    Mar 21, 2017
    Messages:
    11
    Likes Received:
    5
    It works now, it was a port I saw when the dedicated server cmd.exe was loading. I opened it, and now it's all good!!

    Thanks everybody
     
    • Like Like x 2
  18. Shriukan

    Shriukan Touristenfahrten Community AMS2 Club Member

    Joined:
    Sep 23, 2019
    Messages:
    1,293
    Likes Received:
    931
    Could you paste your sms_stats.lua file here please? I got a race server and I am working on automating a daily upload to simresults. Upon server maintenance and the results file is detected as pC2. I reinstalled the server but I still get the same issue.
     
  19. Dave Stephenson

    Dave Stephenson Administrator Staff Member AMS2 Club Member

    Joined:
    Feb 13, 2016
    Messages:
    873
    Likes Received:
    1,124
    @Shriukan pretty sure when I checked the simresults code it differentiates the two using content IDs which given the setup on the touristenfahrten server may be an issue depending on how you achieved it
     
  20. Shriukan

    Shriukan Touristenfahrten Community AMS2 Club Member

    Joined:
    Sep 23, 2019
    Messages:
    1,293
    Likes Received:
    931
    This is unrelated to Touristenfahrten :)
    I have a 3rd server where I have sms_stats turned on but never touched the lua. Only turned on the logging of the session in the config file. It logs but for some reason simresults identified the json output as pC2.
    Server is not controlled so people can do as they wish and even apply their settings to it. I will continue testing. Maybe the logfile got cut as it logged only 1000 lines and caused an issue in the detection. Dunno. With a daily backup and removal of the stats i will see if a smaller file with just a race or two will cause the same issue :)
     
    • Like Like x 1

Share This Page