QUESTION Sending race status to socket

Discussion in 'Apps' started by Sk_Panda, Nov 15, 2021.

  1. Sk_Panda

    Sk_Panda New Member

    Joined:
    Apr 19, 2021
    Messages:
    7
    Likes Received:
    0
    Hi everyone! I've been lurking for a long time, but I think this is my first post :)

    I would like to "export" in real time data about the race status. Mainly the data I would need to create a standings table, a fastest lap popup, and so on.

    My first thought was to send the data from an AC app using RabbitMQ (but I can't get it to work in Python 3.3.5) or a socket (but I got a "ImportError: No module named '_socket'" error).

    I also thought about hooking into AC Server Manager, but I would like to avoid to have to install my software on a server. I intend to send the data from my AC (client) to a server I'm writing, who will then do things to that info and show it on a web page, but I'm perfectly fine with having all this software on my machine.

    However, I just need to have the data, and I have no special interest in making an app of my own, so if you could advice me on how to either fix my python or get the data from something that is already available, it would be great! Thank you in advance!
     
  2. fughettaboutit

    fughettaboutit aka leBluem

    Joined:
    Jul 21, 2014
    Messages:
    1,117
    Likes Received:
    379
    This race_out file and laps are new after every race:
    upload_2021-11-15_12-45-31.png
     
    Last edited: Nov 15, 2021
  3. Sk_Panda

    Sk_Panda New Member

    Joined:
    Apr 19, 2021
    Messages:
    7
    Likes Received:
    0
    Thank you for the info, I didn't know about that! However, I want that info in real time, not at the end of the session...

    I wish to create a sort of "live timing" screen, similar to that of AC Server Manager, but I want it to be available in any race mode, not only online. I've been trying to do it from scratch, but Python is not my forte (I'm an experienced programmer, but I did close to nothing with Python) and the 3.3.5 that AC uses is usually not supported in any library I can find...
     
  4. fughettaboutit

    fughettaboutit aka leBluem

    Joined:
    Jul 21, 2014
    Messages:
    1,117
    Likes Received:
    379
  5. fughettaboutit

    fughettaboutit aka leBluem

    Joined:
    Jul 21, 2014
    Messages:
    1,117
    Likes Received:
    379
    basically what you do is using MapViewOfFile() on those three 'files':
    Local\acpmf_physics
    Local\acpmf_graphics
    Local\acpmf_static
     
    Last edited: Nov 15, 2021
  6. Sk_Panda

    Sk_Panda New Member

    Joined:
    Apr 19, 2021
    Messages:
    7
    Likes Received:
    0
    Thanks a lot, I'll look into that!
     
  7. Sk_Panda

    Sk_Panda New Member

    Joined:
    Apr 19, 2021
    Messages:
    7
    Likes Received:
    0
    Apparently it's not that either. I need real-time data about all the cars; shared memory apparently only exposes info about the player's car.

    Essentially, I need the kind of data that is retrieved by ACTV. ACTV is open source, so I could study that code and retrieve the data. But I need to make it available outside the game. How can I do that?
     
  8. fughettaboutit

    fughettaboutit aka leBluem

    Joined:
    Jul 21, 2014
    Messages:
    1,117
    Likes Received:
    379
    Last edited: Nov 15, 2021
    Sk_Panda likes this.
  9. fughettaboutit

    fughettaboutit aka leBluem

    Joined:
    Jul 21, 2014
    Messages:
    1,117
    Likes Received:
    379
    do smth like this in acUpdate() of your python app:
    Code:
    #include acsys
    ...
    def acUpdate(deltaT):
        ...
        for carId in range(0, ac.getCarsCount()):
            if ac.isConnected(carId):
                ac.log(str( ac.getCarState(carId, acsys.CS.LapTime)  ))
    
     
    Sk_Panda likes this.
  10. fughettaboutit

    fughettaboutit aka leBluem

    Joined:
    Jul 21, 2014
    Messages:
    1,117
    Likes Received:
    379
    your probably better off to just use acti, once you get it working :)
     
  11. fughettaboutit

    fughettaboutit aka leBluem

    Joined:
    Jul 21, 2014
    Messages:
    1,117
    Likes Received:
    379
  12. fughettaboutit

    fughettaboutit aka leBluem

    Joined:
    Jul 21, 2014
    Messages:
    1,117
    Likes Received:
    379
    oh and as you can see with acti, it provides its own module "_socket.pyd" ...
     
  13. Sk_Panda

    Sk_Panda New Member

    Joined:
    Apr 19, 2021
    Messages:
    7
    Likes Received:
    0
    I managed to get the sockets working. I'm afraid the key was to install Python 3.3.5 on my machine, which would make my app hard to distribute. Is it possible that acti's installer also takes care of that?
     
  14. fughettaboutit

    fughettaboutit aka leBluem

    Joined:
    Jul 21, 2014
    Messages:
    1,117
    Likes Received:
    379
    Use only some single modules, copy to your app folder (they have it separated by 32/64bit versions in stdlib/stdlib64 folders), i have no idea how acti installer works, i unpacked manually (motec you must install properly thou to work)
     
    Last edited: Nov 19, 2021
    Sk_Panda likes this.
  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