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

Liveview - webbased tool providing live track map and live timing

Discussion in 'Automobilista 2 - General Discussion' started by viper4r, Jul 6, 2020.

  1. viper4r

    viper4r Active Member AMS2 Club Member

    Joined:
    Mar 5, 2020
    Messages:
    144
    Likes Received:
    50
    5 years ago a good friend and I started a small project to build up some javascript knowledge.
    The goal was to request the Dedicated Server HTTP API of Project CARS and show the vehicles moving as markers on a Google map.
    Now 5 years later the tool is grown and has some more features. It is maybe not the best code, because we started the project with little knowledge, but it is working ;-)

    The tool is called Liveview and is a web page providing the live track map, live timing and some other stuff by using DS HTTP API or CREST2 (Shared Memory API). It supports the Project CARS games and AMS2.
    If somebody is interested in, here is some more info about on Github -> Link

    You need at least an own webserver for this tool, but you can first watch a Demo here .
    Click OK to the Google Maps warning and then click on the "Load from URL" button to load a recorded session. The tables for drivers, tracks and cars are activated by the buttons in the top menu and then there is always a down arrow at the right side of each table to expand it.
    You can click through the tracks in the track table to see where they are for example.

    This project it is still a playground for us, which means there are features which are not working or are heavily WIP, for example the Replay and Statistics buttons are not working. Further we are two guys with very limited time for this hobby, because of work, family etc.
    We try to react quickly when changes in the game APIs occur or when new cars and tracks are added, but fixing other bugs and adding new features is more on the long-term side.

    If you are still interested and want to use it on your own web server, follow the Usage section in the github README.

    Liveview Screenshot.jpg

     
    Last edited: Jul 6, 2020
    • Like Like x 4
    • Winner Winner x 1
    • Useful Useful x 1
  2. Micropitt

    Micropitt Mediocre driver doing mediocre laps AMS2 Club Member

    Joined:
    Jun 16, 2020
    Messages:
    728
    Likes Received:
    544
    I wonder if that could be done with a Raspberry Pi?
     
  3. viper4r

    viper4r Active Member AMS2 Club Member

    Joined:
    Mar 5, 2020
    Messages:
    144
    Likes Received:
    50
    Javascript is executed client side, which means in your Browser.
    On server side where the website is hosted the performance impact should be minimal.
    But the first question is what you want to do on the Raspberry, hosting the website with an Apache under Raspbian for example or open the website in a Browser?
     
  4. Micropitt

    Micropitt Mediocre driver doing mediocre laps AMS2 Club Member

    Joined:
    Jun 16, 2020
    Messages:
    728
    Likes Received:
    544
    It would be easy to run Apache in Raspbian. I don't need it to be accessible from the outside, just from my internal network. So, I could just run the raspberry Pi as a webserver in my internal network and connect to it with my browser. Would that work?
     
  5. viper4r

    viper4r Active Member AMS2 Club Member

    Joined:
    Mar 5, 2020
    Messages:
    144
    Likes Received:
    50
    Normally it should work.
    I have it on an Ubuntu Apache in my internal network.
    If you want to use it for Shared Memory API you need additionally the small tool CREST2 on your gaming system, which reads the data from memory and provides it as a small web server.
    This small webserver is then requested by liveview.
    There are some communication schemes in the Github README for better understanding.
     
    • Like Like x 1
  6. Dams

    Dams Member

    Joined:
    Apr 1, 2020
    Messages:
    32
    Likes Received:
    3
    Hello
    nice live timming but does it record all the participants? even if we don't record.
    he does not read the old times of sms_data_stats.json?
     
  7. viper4r

    viper4r Active Member AMS2 Club Member

    Joined:
    Mar 5, 2020
    Messages:
    144
    Likes Received:
    50
    Sorry, but I do not fully understand the questions.
    I try to answer:
    The tool gets the data only via HTTP Requests from Dedicated Server HTTP API or from CREST2, which is another tool which converts the SharedMemory data to HTTP readable.
    Liveview reads the data for all participants (name, position, timing, car, ...) and you can record the data with the tool, save as file and replay it again by loading the file.
    But you cannot open/read other files.
     
  8. Dams

    Dams Member

    Joined:
    Apr 1, 2020
    Messages:
    32
    Likes Received:
    3
    Thank you for you answer
    Sorry my English is very bad
     
  9. viper4r

    viper4r Active Member AMS2 Club Member

    Joined:
    Mar 5, 2020
    Messages:
    144
    Likes Received:
    50
  10. TeTeT

    TeTeT New Member AMS2 Club Member

    Joined:
    Mar 12, 2016
    Messages:
    9
    Likes Received:
    3
  11. viper4r

    viper4r Active Member AMS2 Club Member

    Joined:
    Mar 5, 2020
    Messages:
    144
    Likes Received:
    50
    Do you have configured the node proxy settings in the liveview config? :
    eckhchri/pcars-ds-liveview

    Update:
    I think I have it.
    You configured localhost:4480 as node proxy URL.
    This cannot work, because the web app is running in Javascript, which is executed on the system where your Chrome with the web app is running, and the node proxy executes the code on the web server.
    In most cases web server and Chrome are running on different systems and then you cannot use localhost.
    You have to use tetet.de:4480 in the web app config.
     
    Last edited: Dec 19, 2020
  12. TeTeT

    TeTeT New Member AMS2 Club Member

    Joined:
    Mar 12, 2016
    Messages:
    9
    Likes Received:
    3
    Thanks a lot for digging that out! With tetet.de:4480 as node proxy host I get one step further: 0 - NO_PARTICIPANT is shown on the map. But when I logon the server and start the Nordschleife I'm still seeing the default view and no drivers or such. The proxy gets the member and participant info though. Maybe something's incompatible with AMS2?
     
  13. viper4r

    viper4r Active Member AMS2 Club Member

    Joined:
    Mar 5, 2020
    Messages:
    144
    Likes Received:
    50
    Can you send me a Private Message with your liveview config.js, then I can check it again.
    Can you click on the Data button on the top during a test and check what is happening there?
    And open the Chrome developer console and check the log if there are any errors.
    Further you can first test it without Node Proxy to reduce the possibility of errors.
    Setup the liveview config.js to access your DS directly.
     
    Last edited: Dec 21, 2020
  14. viper4r

    viper4r Active Member AMS2 Club Member

    Joined:
    Mar 5, 2020
    Messages:
    144
    Likes Received:
    50
    I tested the current AMS2 Beta and the current liveview master from github with and without node proxy and both are working with my DS.
    It seems there is really something misconfigured or special in your case and we have to find the cause of the problem.

    I think the best way is using the Chrome developer tools.
    Please check the "Console" and "Network" Tab for errors during your test.

    Do you know how to open it in Chrome?

    Further you should higher the WORKERDELAY_DSDATA value to 500 at least to reduce the logging in the dev tools.
     
    Last edited: Dec 21, 2020
  15. TeTeT

    TeTeT New Member AMS2 Club Member

    Joined:
    Mar 12, 2016
    Messages:
    9
    Likes Received:
    3
    Hi @viper4r ,

    thanks a lot for your support. I probably have mixed https and http in my previous attempts. I now ensured to use Project Cars - live view. (https://github.com/eckhchri/pcars-ds-liveview) instead of https and it displays the idling car in the pits. Thanks a lot again!

    Now the next question will be - can I persist the live data in a MongoDB? I guess intercepting the lap times and driver names from the node proxy would work best?

    Cheers
     
  16. Petrolhead

    Petrolhead Member AMS2 Club Member

    Joined:
    Mar 1, 2020
    Messages:
    217
    Likes Received:
    21
    Ok a noob question. I have uploaded the files to my domain and now need to edit the config.js file.

    I have posts open on my router but unsure what to enter in the config file replacing the "mydomaininams2.com" do I simply put my external static ip in there
     
  17. viper4r

    viper4r Active Member AMS2 Club Member

    Joined:
    Mar 5, 2020
    Messages:
    144
    Likes Received:
    50
    The DsAMS2ServerURL is the ip address or DNS name of your AMS2 Dedicated Server HTTP API.
    Liveview is written in Javascript, that means the code is executed by the browser, which opens Liveview. It is not relevant where the website is hosted, in your home network or on a webspace in the Internet, it doesn't matter.
    If your AMS2 DS is in your home network and the client where you open Liveview in the browser is also in your home network, you can set the local ip address of the AMS2 DS system.
    If someone opens the website from outside of your network, you have to use your external ip.
    I don't know if it is also working if DS and Liveview are in your home network and you use the external ip, because you want to use it locally and from the internet for other users. This is maybe depending on your Internet router.
    In my case I used a DNS name and I have an own DNS-Server in my network, where this name is resolved to my local ip address and from Internet it is resolved to the external ip address.
    Or you use the DNS-Name of your external ip address and in your local client where Liveview is running you can overwrite it via C:\Windows\System32\drivers\etc\hosts file. But I am not sure if it is still working, because I think Browsers partly already use other DNS-servers and I don't know if the hosts file is still used.
     
  18. Ombra79

    Ombra79 New Member

    Joined:
    Mar 9, 2023
    Messages:
    8
    Likes Received:
    0
    hi i'm an admin of an small simracing community and i want use a livetiming..this tool work? we have a dedicated server for other sim... can you instruction me i am totaly noob...thank you
     
  19. viper4r

    viper4r Active Member AMS2 Club Member

    Joined:
    Mar 5, 2020
    Messages:
    144
    Likes Received:
    50
    Hi,
    I have not tested the Dedicated Server mode for a long time, because I have only used it in CREST mode.
    But it should work.
    First of all you need an own webserver and know how to handle it ;-), then you download the sources from github:
    https://github.com/eckhchri/pcars-ds-liveview/archive/refs/heads/master.zip
    Then you extract it to your webserver and follow the instructions from: Usage
    In the config.js you have to change at least:
    The settings needed on the Dedicated Server config are described here: Troubleshooting
    If you have problems I need it more in detail, what exactly goes wrong.
     

Share This Page