1. Do you need support for Assetto Corsa Competizione? Please use the proper forum below and ALWAYS zip and attach the WHOLE "Logs" folder in your c:\users\*youruser*\AppData\Local\AC2\Saved. The "AppData" folder is hidden by default, check "Hidden items" in your Windows view properties. If you report a crash, ALWAYS zip and attach the WHOLE "Crashes" folder in the same directory. Do not post "I have the same issue" in an existing thread with a game crash, always open your own thread. Do not PM developers and staff members for personal troubleshooting and support.
  2. As part of our continuous maintenance and improvements to Assetto Corsa Competizione we will be releasing small updates on a regular basis during the esports season which might not go through the usual announcement process detailing the changes until a later version update where these changes will be listed retrospectively.
  3. If ACC doesn't start with an error or the executable is missing, please add your entire Steam directory to the exceptions in your antivirus software, run a Steam integrity check or reinstall the game altogether. Make sure you add the User/Documents/Assetto Corsa Competizione folder to your antivirus/Defender exceptions and exclude it from any file sharing app (GDrive, OneDrive or Dropbox)! The Corsair iCue software is also known to conflict with Input Device initialization, if the game does not start up and you have such devices, please try disabling the iCue software and try again. [file:unknown] [line: 95] secure crt: invalid error is a sign of antivirus interference, while [Pak chunk signing mismatch on chunk] indicates a corrupted installation that requires game file verification.
  4. When reporting an issue with saved games, please always zip and attach your entire User/Documents/Assetto Corsa Competizione/Savegame folder, along with the logs and the crash folder (when reporting related to a crash).

About that maybe-server-api

Discussion in 'Chit Chat Room' started by Minolin, Jun 11, 2015.

  1. Minolin

    Minolin Staff Member KS Dev Team

    A step backwards: How does the track data look like, is it binary/compressed? Could we easily read/parse such stuff? (the server currently doesn't have track data, just the checksums)
     
  2. nonnex

    nonnex Alien

    True, well could be a point for the API wishlist.
     
  3. If you're adding this to the wishlist, why not directly add an info "isIntoPitLane" (0/1) to the "ACSP_CAR_UPDATE" ? then you can tell if anyone is taking his drive trough when that value is set to "1" and on the current "velocity" param (must > 0 for the entire timeframe the car is in the pitlane). Or i'm missing something?
     
    nonnex likes this.
  4. Stereo

    Stereo Alien

    For that aspect it's binary and not really ideal for partial lookups (since it's designed to just load into video memory and be a bunch of objects the renderer understands) It'd probably be possible to do it if you really needed to.
     
  5. nonnex

    nonnex Alien

    but it there must be some event that can be hooked up by runtime to get information about the cars racing state. If its currently not possible to get the state somehow, then its missing and should be added.
    The slowdown does also not come from nowere. It could be an own parameter or added to an existing packet.

    [[PARAM]:0-3|msec] for different states.

    Example: PITTING:int|millisec
    :0 (normal) | 0
    :1 (entering) | time (starts passing pit entering line, stops entering box)
    :2 (pitting) | time (netto in box)
    :3 (leaving) | time (start leaving box, stops passing pit leaving line)


    The sum of times (entering,pitting,leaving) would giv an info about the total time remained in the pit area.
    The total or single informations could also be used for additional processing
    For example:
    Penalty for hanging around too long in pits and watching the girls. :)
     
    Last edited: Jul 21, 2015
  6. there are the following possibilities as I see them:
    1. check that the total length is sane before executing the commands (this would be for free, computationally-wise)
    2. Use a magic number at the end of a command (slight increase of bandwidth, but computationally low-cost, needs to be implemented at server)
    3. Use a checksum / or even CRC to protect the messages from being modified (slight increase of bandwidth, computationally relatively expensive)

    I tend to think that 1) should already be enough to capture the most common mistakes. You can also do some boundary checks, but it may be difficult to guess valid ranges....
     
    Alessandro Greghi and Minolin like this.
  7. Minolin

    Minolin Staff Member KS Dev Team

    I've played around a bit to understand how the messaging really looks like and how it could work, which ended in a good part of creating the fake server. Then I realized that this one might in fact be useful for testing purposes (redirector, but also plugin developers and maybe even the Lord himself*) and I improved the GUI a bit more.
    Currently I stopped after two outgoing messages (after all this could look really different after 1.2 release) and need to implement the way back so we can read 1 or 2 messages from the plugin. But the overall concept and gui shouldn't change that much, I'm quite satisfied so far.

    Maybe you're already interested to see and use it for tests or debugging. The attached solution contains Stefano's acRemoteServerUDP_Example (which is a usual plugin) next to my acServerFake (Which is a simple GUI program). The project are setup in a way they both start on debug (F5 or newcomers), but they are completly independant executables.

    The plugin is currently just listening, but you'll see the output when a message is sent (and what values are understood). The fake-server looks like this:
    upload_2015-7-22_16-58-19.png

    Simply click a Event-Type and press "send" to get the data over the wire. In the example you can see (logviewer below) that I first tried to send without opening the UDP channel, then sent a new-session-event and a collision-event.
    Every sent event logs a human readable string representation and the binary stream that is to be sent (for comparison).

    The plugin did receive both messages like this:
    upload_2015-7-22_17-1-48.png

    So you can see the acServerFake can at least send UDP-data in a way the plugin can understand (which is not necessarily equal to what the server would sent, though).

    --------------

    My observations so far:

    1. we have to take care of the string handling; ASCII+UTF-32 are mixed up. I think it's absolutely correct this way, as this is just a shadow copy of the data broadcasted between client & server. Chat + driver names need to be unicode; all the other stuff doesn't and will be 4 times smaller this way. We just have to take care of this; in the best case it's hidden inside the one language dependant framework (you really don't want to do and update the deserialization in every single plugin)
    2. I have no idea who will start communication and how the server generally handles this. UDP is tricky, maybe it's possible that we can talk about a super-simple, 1 byte PING-PINGBACK event that both ends can send whenever they want?
    3. Overall this looks really good. Exciting and enjoyable so far.
     

    Attached Files:

  8. f_deutsch

    f_deutsch Hardcore Simmer

    Do we know yet what data will be coming per each different event?
     
  9. Minolin

    Minolin Staff Member KS Dev Team

    We know what is processed in the sample, so probably yes. At least more or less.
    I'll write a little summary once I've finished the other way round. But I can say it really looks nice so far.
     
  10. f_deutsch

    f_deutsch Hardcore Simmer

    Fantastic ! Thanks for your dedication on this Minolin.

    I asked on this thread before if there will be the inclusion of a guid for the drive session on all the driver's events. This in a way to be able to keep a log of what happen on each session and a way to identify and group the events on them.
     
  11. Not sure why we need this? Don't we get a signal whenever a new session starts, so we are able to see when a new session starts? Stefano also said something about json reports, but I didn't see them in the UDP API. So probably they are saved on the file system...
     
  12. Minolin

    Minolin Staff Member KS Dev Team

    Yep & yep
     
  13. f_deutsch

    f_deutsch Hardcore Simmer

    We do. But what if we did not get it? In this case the plugin is not considered to work in a stateless mode but in statefull. I am not sure if that would be the best approach. Just asking.
     
  14. Minolin

    Minolin Staff Member KS Dev Team

    When the next session starts, your plugin's NewSession() event is raised. You can guid as much as you want.
    Not sure for the first one, but I could imagine that you'll get the newsession at once
     
  15. You mean that you might loose the UDP packages? I know it does happen over a real network, but I think (hope) it's not an issue when server and client run on the same machine. But in principle you're right, the save side is TCP, but this would mean more overhead as well.
     
  16. nonnex

    nonnex Alien

    never mind
     
    Last edited: Jul 22, 2015
  17. f_deutsch

    f_deutsch Hardcore Simmer

    That is my concern. In an ideal situation this should not happen, but it may. I agree TCP should not be the way to go considering performance issues, but is safer. If we go UDP we may consider some scenarios.
     
  18. Minolin

    Minolin Staff Member KS Dev Team

    uh, 30 clients with 100Hz is quite a thing - and you have to keep in mind that we're cpu-taxing the same machine that runs N "real" acservers.
    But tbh. I didn't even think about UDP fail safety. First it's really unlikely on the same machine. Then we maybe could detect a missing msg, but what then? Create a "please resend X" logic on both sides? Na, don't think so.

    -------

    Promised a little overview. Please keep in mind that I don't have more than the sample-project, and that nobody said this actually works. So there may be some fantasy or notyetimplemented stuff we don't receive with 1.2

    Server->plugin messages

    New Session (example: Qualifying ended, race is a new session now)

    Parameters:
    - string name (no idea, maybe the server's name?)
    - byte type (probably the same numeric type like in the config.ini)
    - unsigned short time of day (probably in minutes)
    - unsigned short laps (lapcount, if race)
    - unsigned short waittime (time before the green light, maybe also Qualifying "stay-in-pits" time)
    - byte ambient temperature
    - byte road temperature
    - string weather


    Collisions (2 subtypes: collision with environment / other car)
    - byte car_id (probably the same we know from the python API)
    - optional: byte other_car_id (when subtype == collision-with-car)
    - float speed (relative speed between both cars / environment)
    - vector3xfloat world position (same as in python)
    - vector3xfloat relative position (local position vector, maybe car_id-center vs. point of impact)


    Car info (may be requested by ACSP_GET_CAR_INFO)
    - byte car_id (again python api)
    - bool isConnectd (= is a player sitting in there?)
    - Unicode model (car model)
    - Unicode skin (car skin)
    - Unicode driver name
    - Unicode driver team
    - Unicode guid (hopefully SteamId64)

    Car update (can be requested per car_id + interval)
    - byte car_id (again python api)
    - vector3xfloat world position
    - vector3xfloat velocity
    - byte gear
    - unsigned short engine_rpm

    New connection (new driver is connecting)
    - Unicode driver name
    - Unicode guid (hopefully SteamId64)
    - byte car_id (again python api)
    - Unicode model (car model)
    - Unicode skin (car skin)

    Connection closed (driver disconnected)
    - Unicode driver name
    - Unicode guid (hopefully SteamId64)
    - byte car_id (again python api)
    - Unicode model (car model)
    - Unicode skin (car skin)

    Lap completed
    - byte car_id
    - unsigned int laptime (miliseconds?)
    - byte cuts (probably how many tyres off track dependant on the config.ini setting)
    - included: complete, current leaderboard (byte car_id / uint best time / byte laps driven)
    - float grip level


    Plugin->server messages
    Get car info (probably returns the car info once)
    - byte car_id

    Enable realtime report (server will send "car update" every x ms)
    - byte car_id
    - unsigned short interval (in miliseconds)

    ---------

    Those are C# datatypes, I hope you can translate them into whatever you program in.
    byte = 8bit Integer
    short = 16bit Integer
    float = 32bit decimal
    vector3xfloat = simple struct, you can also read three floats (x,y,z where y = height) in a row
    string = ASCII
    Unicode=UTF-32

    --------

    The messages come in binary; the first byte always identifies the message type. Strings and unicode fields just have a byte that defines the length; then the text.

    --------

    You can see this is getting somewhere. Pretty sensible events, only the newsession lacks a "end-of-race"-event. But this is made up by a wonderful "lap completed" one, including leaderboard and cuts (!).
    I hope this can help you efficiently.
     
    never_eat_yellow_snow1 and tabis like this.
  19. f_deutsch

    f_deutsch Hardcore Simmer

    Looking good, thanks Minolin.

    Things I would like to have added, and hope they will be.

    Car info (may be requested by ACSP_GET_CAR_INFO)
    - spline (0 to 1, like python api)

    NEW Offtrack (driver off track)
    - byte car_id (probably the same we know from the python API)
    - byte tyres_off (number of tyres of the track)

    NEW LostControl (similar to iRacing event when car spun)
    - byte car_id (again python api)
     
  20. Minolin

    Minolin Staff Member KS Dev Team

    Yes please, incredible useful and efficient. But I'm afraid this won't happen with 1.2 release, because the SplinePos isn't part of the netcode (but is calculated on the client based on the world position and known track).
    Stefano indicated that this could happen, but of course it's not just adding something the server already knows into the UDP stuff.

    I still think it's worth it, almost every python app where I've browsed the code had used the SplinePos.

    Offtrack would be very nice, yes. There will be two kinds of alternative cutting systems: new ways in detection (like cutters), but I think the ones who will shine just generate alternative consequences (like PLP). The latter can and should use the Kunos detection system. But I'm almost sure the server doesn't know about tyres out, again. I think the Lord already gave us everything the server broadcasts into that car update event. So everything we want additionally has to be uploaded by the client and sent over network.
     
    f_deutsch likes this.

Share This Page

  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