Page 1 of 59 1231151 ... LastLast
Results 1 to 10 of 583

Thread: Dedicated Server API

  1. #1
    Stepan Vondrak
    Guest

    Dedicated Server API

    Documentation

    At the bottom of this post you will be able to find all dedicated server documents attached. The latest version of these documents is also always available in the root folder of the dedicated server package downloaded from Steam.

    ---

    I am really glad that the community already maintains a basic Dedicated Server HowTo. It is lacking information about the server's API, so I've decided to write some stuff down about it.

    First, why does/will the API even exist...

    DS without the API

    Without the API the functionality of the dedicated server is quite limited. The usage flow is nearly the same as when running a peer to peer multiplayer session, and so are the features. The major usage difference for users is only the session creation, which now requires a special command-line to create a session on a dedicated server instead of a peer to peer session (hopefully maybe one day there will be GUI for that!).

    Joining is then the same, and so is the overall flow of the gameplay on a DS. The "host" is still the creating player until the player disconnects, then it migrates to another player. And the host still controls the gameplay settings.

    So the DS in this form does not provide much more than potentially improved networking. Instead of everyone communicating with everyone else during gameplay, which can be quite tricky and unstable as the session size grows too much, the simulation network traffic is routed through the DS. That should be much more friendly to uplink bandwidth of all players, and evade all kinds of NAT and router problems associated with peer to peer networking, leading to overall more reliable online experience.

    Why the API

    But player expect more from the dedicated server. And that's mostly being able to monitor and control the game from the server, which could mean anything from just deciding who can join the server (which we already support to some extent by password-protection, blacklist and whitelist options), to server rotating tracks, to server running automatic leagues with overall scores as well as live race details displayed on a website.

    Instead of implementing all kinds of those features directly into the server, the aim is to make the server as open as possible, or "moddable". This will allow the community to then implement any additional functionality based on their needs, instead of being restricted to what we might design and code in our unfortunately rather limited time.

    Two API types

    The server implements two kinds of API:

    1. HTTP API, documented in this post

    2. Lua API / scripting, documented in the attached pdf.

    What does the API do

    The API is intended to work in two ways:

    1. It provides information about the server's and gameplay status / other data. The game sends the data to the server, and the API can be used to read the data. This can be split into few sub-categories.
    1a. Static information. Such as self-generated help about the API, or various lists (all known vehicles, tracks, session attributes and so on)
    1b. Server/session/gameplay status. A snapshot of current state of the server, multiplayer game running on it (if any), players connected to the session, and cars racing.
    1c. Events. The server also receives events and provides a history of the events via the API. This range from "game started on the server" to "player joined/left the game" to "John collided with Joe, impact strength 500".

    2. It provides a way for third-party apps to control the server, and via the server control the game. Controlling the game is an optional "mode" of the server, in which it will take over the host's duties. In this mode the host will no longer be significant in the game, lose access to the game's settings, and the server will control the settings instead. How exactly will it behave is then entirely up to the community that writes the "scripts" or whatever else will communicate via the API. It could be any of:
    • GUI tool that will let people allowed to control the server do so via the provided GUI, outside of the game.
    • A simple script that will force specific settings, monitor the events and change the track/vehicle class whenever players return back to the lobby. So a simple track/settings rotation.
    • A script that would monitor chat from players, recognize special commands and act upon them. Players with specific IDs would be allowed to change some settings directly via the commands, non-privileged players could vote for settings changes.
    • Much more complex app implementing an automatic league. It could implement persistent ranking of players, open the server with specific settings when the next league round starts, control who can join the race, archive positional status and various events for post-race review (we won't provide full replays automatically though), and so on.

    Note that all of this is just the ideal goal, and up to the community to implement. We just plan to provide the tools to do so.

    How to enable the HTTP API

    By default the HTTP-based API is disabled. Please read the HowTo for the full list of available setup options.

    To enable the API, change the enableHttpApi setting to true. By default the API will be then available via HTTP at 127.0.0.1:9000 . This can be reconfigured by the options httpApiInterface and httpApiPort .

    API security

    The HTTP API is running on a simple internal HTTP server based on the libwebsockets library. Only http access is enabled, there is no https support (at least not yet). The server also does not implement any other security features yet, there is no password/key-protected access to the API or IP blacklisting/whitelisting. Be aware of that when exposing the access to the API via the server settings. You might want to setup some kind of proxy based on Apache or anything else, and control the access at that level.

    Or just limit it to the computer the server is running on (which is the default) or the local network where the server is hosted, with anything public "sitting behind" the scripts you implement on top of the API. So as a simple example, you could run the server on the same computer as your website, and write a simple PHP script that would access the server's status and present it in a pretty way on the web. And with some additional scripting, it could live-update the car status and display that. Without ever exposing the server's API itself to the public.

    API usage

    The API is a simple HTTP-based thingy, you run HTTP GET queries and it returns responses, mostly JSON-encoded. The JSON responses contain these fields:
    • "result" - for now just "ok", but for some API calls the result could be something else. That will apply mostly to calls that request game changes.
    • "message" - optional user friendly message
    • "response" - JSON object with the actual data returned by the call


    So as an example, assuming the DS is running on your local machine, you could query it with http://127.0.0.1:9000/api/session/st...s&participants . This returns JSON response with the full status, with all attributes of the session itself, as well as its members and participants. The middle of the response might look like this:
    Code:
    {
      "result" : "ok",
      "response" : {
    ...
        "attributes" : {
    ...
          "NumParticipantsDisqualified" : 0,
          "NumParticipantsRetired" : 0,
          "NumParticipantsDNF" : 0,
          "NumParticipantsFinished" : 0
        },
        "members" : [
          {
            "index" : 0,
            "refid" : 19008,
            "steamid" : STEAMID_REMOVED,
            "state" : "Connected",
            "name" : "REMOVED",
            "jointime" : 1432039628,
            "host" : true,
            "attributes" : {
              "VehicleId" : 1023089804,
              "LiveryId" : 64,
              "LoadState" : "ADMIN_STARTED_RACE",
              "RaceStatFlags" : 1073797090,
              "Ping" : 53
            }
          }
        ],
        "participants" : [
          {
            "attributes" : {
              "RefId" : 19008,
              "Name" : "REMOVED",
              "IsPlayer" : 1,
              "GridPosition" : 1,
              "VehicleId" : 1023089804,
              "LiveryId" : 64,
              "RacePosition" : 1,
              "CurrentLap" : 0,
    ...


    API - help

    The endpoint /api/version will return server version details (build, protocol and Lua API).

    The API provides automatically generated help at /api/help URL. This will return the list of all available methods implemented by the API, their parameters, result format and a short description.

    Lists associated with the gameplay and the server data are available at /api/list and its various sub-calls. This can include the list of all session attributes, or track or vehicle lists.
    (attributes and event descriptions have been implemented so far)

    API - status

    You can query the session status at /api/session/status. Without any query parameters it just returns basic data about the session, you can request all session attributes, member list and participant (car) list as well. For more information please check the /api/help.

    API - events

    In addition to current status snapshot the game also reports various events to the server. The server keeps certain amount of the events in its internal log, the size of the log can be configured in server.cfg, in setting eventsLogSize.

    The events log is available via the API at /api/log:
    • /api/log/overview: Returns the number of events stored in the log, and index of the oldest event.
    • /api/log/range: Returns count of events from the logs, starting at index offset. You can use negative offset to request specify the offset relative to the end of the log, so "offset=-100&count=100" would return 100 most recent events. This call also returns the same info as the overview in addition to the events.


    API - controlling the server

    The control mode can be configured by these two variables:
    • allowEmptyJoin: true - this is set to true by default, and will make the server appear in the session browser when it's empty. When someone joins an empty server, the game's setup will start with sessionAttributes, and the first member will become the session's host. When the game is not controlled be the server, the host will then be able to change this setup to anything else. Please refer to /api/list/attributes/session for the list of attributes that can be specified in sessionAttributes, only the ReadWrite or WriteOnly attributes can be set here.
    • controlGameSetup: false - this is set to false by default. If changed to true, the server will take over the game's control. Such server must also have allowEmptyJoin set to true, because it will no longer be joinable via the command-line driven Create flow. When the server controls the game, the host will no longer be able to modify the game's setup in the lobby, instead the server's API can be used to do that.


    Two session attributes fine-tune the game-controlling mode:
    • ServerControlsTrack: If set to non-zero, the server takes over track selection in addition to the game's setup. The host will no longer be able to select the track.
    • ServerControlsVehicle: If set to non-zero, the server takes over vehicle selection in addition to the game's setup. This is not fully implemented yet, so players will still be able to choose their cars even if this is set to true.


    The control API itself is:

    /api/session/set_next_attributes: This modifies "next session attributes". The initial values are set from the config file's sessionAttributes. "Next session attributes" are used when the first player joins an empty server - the game will start with these settings. In addition to that, if the server control's the game's attributes, these will be also applied to the lobby whenever a race is finished and the game loads to the lobby. So in short, if the server is not game controlling, this provides the defaults for empty servers, and if the server is game controlling, this can be also used to modify the setup of the next race, automatically applied when the current race finishes.

    /api/session/set_attribtes: This API call is available only if the server is running in game controlling mode. It modifies the current game's setup while in the lobby.

    /api/session/send_chat: While not directly used to control the game, this can be used to send chat texts to the game from the server. It can be used to welcome new lobby members and send some info about the server to them, or to notify them about any changes applied by the server.

    The set_next_attributes and set_attributes have similar argument structure. But the set_next_attributes command can modify only the session attributes, none of the participant or player arguments will be used (note that the game currently does not define any modifiable player or participant attributes anyway)
    • copy_to_next: Boolean optional argument to set_attributes. This will make any session attribute changes also modify the "next session attributes" list. It defaults to false but you will quite often want to use this, otherwise the set_attributes call modifies only the current lobby settings, and the next lobby will revert back to the "next session attributes". If the session is not in a lobby, then the set_attributes call will still succeed if this argument is set to true, and do the exact same thing as set_next_attributes (since there are not current lobby attributes to modify)
    • refid: RefId of the player to modify if any player attributes are set
    • participantid: Participant id of the participant to modify if any participant attributes are set
    • session_NAME: Set value of session attribute NAME. See /api/list/attributes/session for the list of all valid attribute names and types. Only writable attributes can be set
    • player_NAME: Set value of player attribute NAME. Currently no player attributes are writable
    • participant_NAME: Set value of participant attribute NAME. Currently no participant attributes are writable


    Example:
    Code:
    http://127.0.0.1:9000/api/session/set_attributes?copy_to_next&session_Practice1Length=15&session_RaceLength=10&session_TrackId=1300627020
    (assuming the default local server port is used)
    This will modify the current lobby and the next session attributes to use 15 minute practice 1 session, 10 laps, on Brands Hatch Indy

    Status web

    The internal server also hosts a simple web page at /status. This is similar to information provided by the /api/session/status as well as the event log, but formatted as a simple human-readable web page. It's intended mostly for debugging the server while developing the API, not as something to be made available to the public.

    Documentation
    Last updated 01.03.2016, latest PDF documents are always available in the server tool downloaded from Steam.

    Game Guide: A simple short guide about joining the servers from the browser
    GameGuide.pdf

    User Guide: Server administration and setup information
    UserGuide.pdf

    Scripting Guide: All about Lua scripting
    ScriptingGuide.pdf

    Server Values and Types: Reference with various useful data types / lists: all attributes, events, id lists, enums, flags.
    ServerTypes.pdf
    Last edited by Alexandru Marian; 09-05-2016 at 09:34.

  2. #2
    Stepan Vondrak
    Guest
    Dedicated Server Changelog

    20.5.2015
    Added access to event logs at /api/log/overview and /api/log/range. Descriptions of all available log events have been added to /api/list/events

    21.5.2015
    Added config option httpApiExtraHeaders. This can be used to add extra headers to all responses from the HTTP API server. The sample config adds "Access-Control-Allow-Origin: *".

    25.5.2015
    Added /api/list/vehicles and api/list/tracks. Fixed Unicode JSON formatting sometimes crashing the server in the API. All headers returned by the API now correctly specify the content's charset as UTF-8.

    29.5.2015
    Added /api/list/liveries

    1.6.2015
    Crash in logging fixed

    9.6.2015
    Participant list is cleared when returning back to lobby, the server no longer reports duplicate/obsolete participants from older races.
    Added more methods to /api/list: .../vehicle_groups, .../enums and .../flags (enums and flags also with several subqueries to specific enums and flags)
    Vehicle and livery lists now also include vehicle groups.
    Updated descriptions of various attributes to point to appropriate lists/enums/flags, or list the valid values explicitly where it's just a bunch of strings.

    12.6.2015Updated DS to protocol version 1.0.1.18, matching game patch 1.4

    1.7.2015
    Updated DS to protocol version 1.0.1.20, matching game patch 2.0

    17.7.2015
    Updated DS to protocol version 1.0.1.21, matching game patch 2.5

    22.7.2015
    Updated DS track and vehicle lists to match Ruapuna/Audi/freecar#2 content

    14.8.2015
    The big game-controlling mode updates:
    • Protocol version 1.0.1.27, matching patch 3.0
    • Empty servers are now visible in the session browser if they set the allowEmptyJoin config value to true (defaults to false in code, and to true in the sample config). They use different ping icon to distinguish them from peer to peer session. Non-empty sessions hosted on a server will now also show different ping icon.
    • Implemented game-controlling server mode. In this mode the server takes over the session setup, and those host will no longer be able to modify the setup. These servers use slightly different ping icon, with a tiny lock on the server icon.
    • The server can also be configured to take over the track selection and vehicle selection (vehicle selection restrictions not fully implemented by the game yet)
    • The config variables to control this are allowEmptyJoin, controlGameSetup and sessionAttributes (initial attributes for new sessions), added to sample configs with basic documentation
    • The /api/list/attributes API call now specifies which attributes are ReadOnly (just reported by the game) and which are ReadWrite or WriteOnly (can be modified by the server)
    • Added /api/list/session/set_attributes, /api/list/session/set_next_attributes calls that let the server modify the game's settings
    • Added /api/list/session/send_chat call that lets the server send chat messages to individual or all session members
    • Added /api/list/enums/weather listing valid weather constants used by WeatherSlot* attributes
    • Added new session attributes:
      • ServerControlsSetup (read write, but writes are ignored, in this case it means the server can write this to the game, but it's not modifiable via the API): The value of the controlGameSetup config variable
      • ServerControlsTrack (read write): Does the server also take over track selection?
      • ServerControlsVehicle (read write): Does the server also take over vehicle selection? (not fully implemented by the game yet)
      • Track location (read only): Latitude, Longitude, Altitude
      • Current race date and time (as opposed to starting date/time which already had attributes, read only): CurrentYear, CurrentMonth, CurrentDay, CurrentHour, CurrentMinute
      • Current weather conditions (read only): RaindDensity, WetnessOnPath, WetnessOffPath, WetnessAverage, WetnessPredictedMax, WetnessMaxLevel, TemperatureAmbient, TemperatureTrack, AirPressue
      • Changed attribute VehicleGroupId to VehicleClassId, and all vehicle lists now use classes instead of groups - the multiplayer is changing to use class-based restrictions instead of group-based.
      • Tagged many session attributes as read-write, those can be now modified by the server
    • Added new events:
      • ServerChat: Chat message logged by the server (not implemented yet, the server does not log these
      • PlayerChat: Public chat message sent by a player from the game (actually works!).


    All API changes are documented via the usual /api/help and /api/list calls

    18.9.2015
    • Update to protocol version 1.0.1.29, compatible with patch 4.0
    • Updates to track/vehicle lists to match new content introduced with patch 4.0
    • Introducing Lua API - Lua-based server-side scripting, with several sample addons. This is still work in progress but already quite usable. It will be properly documented later, you will have to experiment for now
    • Major changes to server config, please update your customized config based on the sample
    • The game now respects server running in "controls track", "controls vehicle" and "controls vehicle class" modes, and won't allow players choosing different track/vehicle/class
    • Cleaned up the Weather enum list. The names no longer contain redundant "Weather_" prefixes, and "Weather_Clear1" is now simply called "Clear" (without the prefix or '1' suffix)

    Some basic additional notes about this patch are available in this forum post

    22.9.2015
    Lua addons: separated customized configuration from persistent data saved by the addon. Details in this post.

    23.9.2015
    Fixed server crashing on host migration if Lua API is disabled. Added simple GameGuide.pdf with some information about joining server-hosted sessions from the game.

    24.9.2015
    Documentation updates - added missing Vintage GT3 class to lists, added ServerTypes.pdf doc with the most important lists, significant updates to UserGuide.pdf, including documentation of existing addons.

    6.10.2015
    Documentation updates - more information in ServerTypes.pdf, added ScriptingGuide.pdf.

    7.10.2015
    Executable updates:
    • All platforms: Switched from Steam 1.29a to 1.34
    • Win32: Switched from Visual Studio 2010 to Visual Studio 2012
    • Linux: Tweaked the build and added 32-bit libstdc++ library, there should be no need to copy libraries into lib32 anymore, the Linux build should run as is as long as 32-bit libc is available on the system


    8.10.2015
    • The server processes all session attribute change requests, and changes some attribute combinations that are known to cause issues in the game. It will fixup grid size and player count to always make sense, and disable the "fill with AI" flag if there all grid spots are reserved for players.
    • Tweaked exposed enum/flag lists, values that are not relevant for the server or not implemented in the game have been removed.


    9.10.2015
    • Bumped protocol version to 1.30, compatible with patch 5.0.
    • Addon update - first iteration of the sms_stats history tracking. Not finished yet.
    • Documentation updates - exported new Values and Types doc with updates from previous DS patch. Added information about Extended Session Attributes, Normalization and Stringification to the Scripting Guide.


    9.10.2015
    sms_stats addon updates:
    • Few fixes to history management.
    • UserGuide.pdf now contains sms_stats documentation.
    • The addon is enabled by default in the sample config.


    13.10.2015 - build 70
    • Fixed Lua callback handling events, the event is finalized before the callback happens, so more events generated from the callback now work correctly.
    • Added server build version, printed at startup.
    • Added HTTP API endpoint /api/version, which returns the build version, protocol version and Lua API version.
    • Added Lua builtins GetBuildVersion() and GetProtocolVersion(), updated the Scripting Guide document and bumped the API version to 3.1.


    14.10.2015 - build 71
    Addon sms_stats updates:
    • Added configuration controlling new features: limit history length, enable/disable recording of events and results.
    • Default config limits the history to 50 sessions, with results tracking enabled but events tracking disabled.
    • Added "index" field to session history, to uniquely identify individual sessions even after old ones are discarded.
    • Updated user guide.

    Also fixed GetServerUptimeMs() value jumping significantly after the first tick. Now it also starts at zero (but do not rely on that)

    26.10.2015 - build 72
    HTTP API access levels and filtering rules have been implemented. You can now restrict access to individual API endpoints, IP-based filtering and Basic user authentication are supported. Please refer to UserGuide.pdf and sample configs for more information.
    This build also removes standalone steamclient libraries automatically installed by Steam, and replaces them by libraries included in the server's depot, to prevent latest updates from Valve breaking the server.

    26.10.2015 - Build 73 (built 72 hotfix)
    • Setting "httpApiInterface" to empty string will now bind the server's listen socket to all interfaces. Use this for public HTTP API.
    • Fixed filtering rules in sample server config. Now "private" and "admin" rules correctly end with "reject-password", which responds with correct headers (instead of closing the socket without responding) and triggers password query when accessing the endpoints from a browser.


    28.10.2015 - Build 74
    • Implemented fixup of session attributes. Now if the server requests and attribute change, and the game does not update the attribute, the server will retry the request, while in the lobby. So far only applied to the WeatherSlots attribute when setting it to 0, because the game ignores the request until real weather data are downloaded for the location.
    • Updated vehicle lists in DS and documentation with Japanese Car Pack vehicles.
    • Updated Renault vehicle names missing to "Renault Type" where needed to match the in-game names.


    12.11.2015 - Build 75
    Protocol version 1.31, compatible with game patch 6.0.

    25.11.2015 - Build 77
    Protocol version 1.32, compatible with game patch 6.2.
    Changes:
    • Updated track and vehicle lists with new DLC content.
    • Updated support for VAC bans, servers configured as not secure will now correctly let VAC-banned players join them.
    • The server will no longer allow TrackId to be set to an invalid id, or to id of a track with grid sizes that's too small for the session. When such TrackId is set in the config, it will find a different track with valid grid size instead and use that (and print a warning).
    • The sms_rotate addon and library have been updated to check the config for invalid TrackIds in advance and warn about them.
    • The session size and grid size in the default sample config have been reduced from 32 to 24, to allow for more valid tracks (for example the default Brands track has only 30 grid spots).
    • The documentation and HTTP API/Lua API track lists now include track grid sizes.


    1.12.2015 - Build 78
    Implemented basic in-server profiling. The performance counters are available via HTTP API at /api/performance

    2.12.2015 - Build 79
    Added detailed profiling of game packet resends.

    10.12.2015 - Build 80
    Protocol version 1.33, compatible with game patch 7.0. No other visible changes.

    10.12.2015 - Build 81
    Now really compatible with patch 7.0. OpponentDifficulty added to session properties.

    23.12.2015 - Build 82
    Updated vehicle lists and documentation with Renault DLC.

    26.12.2015 - Build 83
    Added missing vehicle classes to DS lists and documentation. Fixes issues with using some vehicles and their new classes in DS or sms_rotate config (it was not possible to enforce those vehicles or their classes).

    20.01.2016 - Build 84
    Protocol version 1.34, compatible with game patch 8.0. No other visible changes.

    29.01.2016 - Build 85
    Added Stanceworks Track Expansion and Free Car #8 (January DLC content) to DS lists and documentation.

    12.02.2016 - Build 86
    Protocol version 1.35, compatible with game patch 9.0. No other visible changes.

    01.03.2016 - Build 87
    Added US Race Car Pack, Free Car #9 and Liveries #5 (February DLC content) to DS lists and documentation.

    22.03.2016 - Build 88
    Protocol version 1.36, compatible with game patch 10.0. No other visible changes.


    15.04.2016 - Build 89
    Added Free Car #10 to DS lists and documentation.

    06/05/2016 - Build 90
    Added Pagani Nürburgring Combined Track Expansion (May DLC content) to the DS lists and documentation.

    04/11/2016 - Build 91
    Protocol version 1.37, compatible with game patch 11.1. No other visible changes.

    Apps and services utilizing the API
    (please start a new thread dedicated to your work if you think it's worth publishing here, it should be something people can download or use in any other way for their DS, not just your own private thing ; then PM me to get listed here)

    Dedicated Server Live App by Ph0eNiX.

    Project Cars Dedicated Server GUI Launcher (PCDSG) by cogent
    Last edited by Alexandru Marian; 09-05-2016 at 09:32.

  3. #3
    SMS Umer Ahmad's Avatar
    Join Date
    Oct 2011
    Location
    Chicago
    Posts
    3,517
    Platform
    PC
    Reserve 3 and sticky
    i5-3570K+CM Hyper EVO, SLI GTX580 (1.5GB) v337.50, Corsair HX850, Samsung m830 SSD, GSkill 2x4GB 1600, Biostar Z77, win7-64 | Logi G27 | Viewsonic LCD 1080 |

    --PCRA Member http://pcraleague.com/

  4. #4
    WMD Member bmaytum's Avatar
    Join Date
    Apr 2012
    Location
    No. California USA
    Posts
    32
    Platform
    PC
    Thanks for that API info Stefan. I'll check back here as you update with changelogs. And thanks to you and SMS for providing the pCARS Dedicated Server code to the user community.
    Asus Sabertooth Z77 powered by Intel i7-3770K @ 4.2GHz, 2 x 8GB DDR3 @ 1867MHz, Asus 680GTX / 2GB, Logitech G25 Wheel & Pedals.
    Asus P5N32-E SLI mobo, Intel C2D E8400 @ 3.0Ghz, 4 x1GB OCZ DDR2 @ 1067MHz, Asus ENGTX580 / 1536MB.
    Racer name "EZTarget". Also play GRID Autosport, GRID 2, Assetto Corsa, RRRE, TDU 2, Shift2, others.
    Support Project CARS2 HERE ! I am a Silver Level pCARS2 supporter.

  5. #5
    Rookie
    Join Date
    May 2015
    Posts
    1
    Platform
    PC
    Hi Stefan

    Thank you for this Info!

    I plane to develop a Server controller App.

    May I ask how to get Info like this ""VehicleId" : 1023089804," to a human readable one? I mean how can I translate this ID to a name like "BMW Z4 GT3" or even get more attributes like I can get from steam for each user?


    Best regards
    Patrick

  6. #6
    WMD Member bmaytum's Avatar
    Join Date
    Apr 2012
    Location
    No. California USA
    Posts
    32
    Platform
    PC
    @ Stephan:

    I've modified my server.cfg file to attempt enabling the HttpApi, BUT then my DS rejects it. Can you tell me how to fix my server.cfg file please.

    Here's DS output (I masked my WAN IP & Steam ID):

    </code>[2015-05-19 13:54:52] INFO: Starting up the Dedicated Server Library.
    [2015-05-19 13:54:52] WARNING: Unknown config variable 'false', or the variable has invalid type
    [2015-05-19 13:54:52] WARNING: Unknown config variable 'true', or the variable has invalid type
    [2015-05-19 13:54:52] WARNING: Unknown config variable 'warning', or the variable has invalid type
    [2015-05-19 13:54:52] INFO: Server configuration loaded:
    - protocol version: 116 (1.0.1.16)
    - server name: EZ's pCARS Ded Server
    - max session size: 6
    - details: secure, bind IP INADDR_ANY, Steam port 8766, host port 27015, query port 27016, password protected yes
    - whitelist size: 0
    - blacklist size: 0

    Setting breakpad minidump AppID = 234630
    [2015-05-19 13:54:52] INFO: HttpApi disabled
    [2015-05-19 13:54:52] INFO: Dedicated server is starting...
    [2015-05-19 13:54:54] INFO: Connection to Steam established
    [2015-05-19 13:54:54] INFO: Received public IP 50.184.***.***
    [2015-05-19 13:54:54] INFO: Server logged in with Steam id 90095599294313*** ; server is secure
    [2015-05-19 13:54:54] INFO: Server startup finished: AppId 234630, public IP 50.184.***.***.40, Steam id 90095599294313*** ;
    switching to running state</code>

    Here's my server.cfg file:
    <code>"//" : "You can use dummy entries like this to write comments into the config. 'rem' and '#' are also supported as comment entries."

    "//" : "--- Basic server options ---"
    "//" : "- logLevel: logging level of the server. Messages of this severity and more important will be logged. Can be any of debug/info/warning/error."
    "//" : "- eventsLogSize : number of gameplay events stored on the server. Oldest ones will be discarded once the game logs more."
    "//" : "- name: the server's name, this will appear in server browser (when implemented) and will be also the default name of sessions hosted on the server."
    "//" : "- secure: authenticate users with Steam to check VAC ban when set to true."
    "//" : "- password: password required to create sessions on the server as well as to join the sessions, password set in Create options is ignored on DS."
    "//" : "- maxPlayerCount: maximum size of sessions that can be created on this server."
    "//" : "- bindIP: IP address where the server's sockets should be bound. Leave empty for 'all interfaces'."
    "//" : "- steamPost, hostPort, quaryPort: ports used to communicate with Steam and game, they must all be accessible on the public IP of the server."
    "//" : "- sleepWaiting, sleepActive: delay between ticks in milliseconds, when not hosting and when hosting a game, respectively."

    logLevel : "info"
    eventsLogSize : 10000
    name : "EZ's pCARS Ded Server"
    secure : true
    password : "Bo"
    maxPlayerCount : 6
    bindIP : ""
    steamPort : 8766
    hostPort : 27015
    queryPort : 27016
    sleepWaiting : 250
    sleepActive : 10

    "//" : "Blacklist and whitelist is intentionally not included in this basic sample config as they can complicate things a bit."

    "//" : "--- HttpApi configuration ---"
    "//" : "This provides http-based API and basic web-based controls using a built-in http server."
    "//" : "HttpApi is disabled by default, and if you enable it with everything else left to default it will listen only locally on 127.0.0.1:9000"
    "//" : "- enableHttpApi: master enable/disable toggle."
    "//" : "- httpApiLogLevel: similar to logLevel above but only for libwebsockets output. Note that all logging still goes through the main filter, so you won't be able to use more verbose logging here than the main level."
    "//" : "- httpApiInterface: interface name or IP where to bind the local http server providing the API and web-based controls.."
    "//" : "- httpApiPort: port where the local http server listens."

    "//" : enableHttpApi : false
    enableHttpApi : true
    httpApiLogLevel : "warning
    "//" : httpApiLogLevel : "info"
    httpApiInterface : "127.0.0.1"
    httpApiPort : 9000<code/>

    Thanks in advance.
    Last edited by bmaytum; 19-05-2015 at 21:33.
    Asus Sabertooth Z77 powered by Intel i7-3770K @ 4.2GHz, 2 x 8GB DDR3 @ 1867MHz, Asus 680GTX / 2GB, Logitech G25 Wheel & Pedals.
    Asus P5N32-E SLI mobo, Intel C2D E8400 @ 3.0Ghz, 4 x1GB OCZ DDR2 @ 1067MHz, Asus ENGTX580 / 1536MB.
    Racer name "EZTarget". Also play GRID Autosport, GRID 2, Assetto Corsa, RRRE, TDU 2, Shift2, others.
    Support Project CARS2 HERE ! I am a Silver Level pCARS2 supporter.

  7. #7
    Stepan Vondrak
    Guest
    Quote Originally Posted by crashmax View Post
    Hi Stefan

    Thank you for this Info!

    I plane to develop a Server controller App.

    May I ask how to get Info like this ""VehicleId" : 1023089804," to a human readable one? I mean how can I translate this ID to a name like "BMW Z4 GT3" or even get more attributes like I can get from steam for each user?


    Best regards
    Patrick
    That's what the /api/list method is for. Now it knows only about the various attributes, but in the future it will returns car/track lists and other info as well.

  8. #8
    Stepan Vondrak
    Guest
    Quote Originally Posted by bmaytum View Post
    Code:
    "//" : enableHttpApi : false
    enableHttpApi : true
    httpApiLogLevel : "warning
    "//" : httpApiLogLevel : "info"
    httpApiInterface : "127.0.0.1"
    httpApiPort : 9000
    These attempts at commenting out some lines are wrong.

    The config format is still JSON object, so key-value pairs in format
    Code:
    key : value
    You can't comment a key-value pair out by prepending it with "//" :, then you have A:B:C in the file which completely confuses the parser. It's just that when the key is "//", the value is ignored. But "//" : key : value does not make any sense to the server. So just remove the lines where you tried to comment-out the original values.

    Also the "warning" value is missing a quote.

  9. #9
    Stepan Vondrak
    Guest
    In an hour or two a new update to the DS will be published. This adds access to event logs at /api/log/overview and /api/log/range. A range of log events might look like this:

    Code:
    ...
          {
            "index" : 7,
            "time" : 1432133017,
            "name" : "StateChanged",
            "attributes" : {
              "PreviousState" : "Loading",
              "NewState" : "Race"
            }
          },
          {
            "index" : 8,
            "time" : 1432133017,
            "name" : "ParticipantCreated",
            "refid" : 21952,
            "participantid" : 0,
            "attributes" : {
              "Name" : "Stouie",
              "IsPlayer" : 1,
              "VehicleId" : 1023089804,
              "LiveryId" : 64
            }
          },
          {
            "index" : 9,
            "time" : 1432133024,
            "name" : "State",
            "refid" : 21952,
            "participantid" : 0,
            "attributes" : {
              "PreviousState" : "InGarage",
              "NewState" : "ExitingPits"
            }
          },
          {
            "index" : 10,
            "time" : 1432133037,
            "name" : "State",
            "refid" : 21952,
            "participantid" : 0,
            "attributes" : {
              "PreviousState" : "ExitingPits",
              "NewState" : "Racing"
            }
          },
          {
            "index" : 11,
            "time" : 1432133040,
            "name" : "Impact",
            "refid" : 21952,
            "participantid" : 0,
            "attributes" : {
              "OtherParticipantId" : -1,
              "CollisionMagnitude" : 830
            }
          },
    ...
    Or in English - loading finished, my car was created, I exited the pits and hit the wall.

    All available log events are documented at /api/list/events. For example the "Impact" event has entry:
    Code:
    ...
          {
            "name" : "Impact",
            "type" : "Participant",
            "description" : "Participant collided with something. Always reported by the local participant (player or AI). Because of the assymetric nature of physical collisions in MP the other participant might report (a similar) event too",
            "attributes" : [
              {
                "name" : "OtherParticipantId",
                "type" : "int32",
                "description" : "Other participant's id, or -1 if not collided into a participant"
              },
              {
                "name" : "CollisionMagnitude",
                "type" : "int32",
                "description" : "Magnitude of the impact. Value reported by physics * 1000"
              }
            ]
          },
    ...
    The following 2 users likes this Post: RomKnight, Umer Ahmad


  10. #10
    WMD Member
    Join Date
    Oct 2011
    Posts
    69
    Are there Steam public ID for drivers to have his uniqid, because on steam we can change our name, it can cause confusion.
    Last edited by Ph0eNiX; 20-05-2015 at 17:13.

Similar Threads

  1. Dedicated Server
    By OzDeaDMeaT in forum Multiplayer
    Replies: 9
    Last Post: 14-09-2015, 14:02
  2. Dedicated server browser is down
    By optimalspieler in forum PC - Technical Help & Support
    Replies: 4
    Last Post: 23-05-2015, 08:41
  3. Dedicated Server Browser Not Working
    By flyoffacliff in forum Multiplayer
    Replies: 0
    Last Post: 17-05-2015, 02:59
  4. Dedicated Server High Latency
    By Winpoks in forum Multiplayer
    Replies: 2
    Last Post: 09-05-2015, 06:24
  5. Dedicated Server - HTTP API Request
    By Ph0eNiX in forum PC - Technical Help & Support
    Replies: 3
    Last Post: 08-05-2015, 11:18

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •