Author Topic: Live Timing  (Read 6601 times)

PiBoSo

  • Administrator
  • Hero Member
  • *****
  • Posts: 1885
    • View Profile
    • Email
Live Timing
« on: October 08, 2012, 08:27:43 PM »
It is possible to connect to a dedicated server to receive live race data.
Only 1 client can connect to the server.

Communication is made with UDP sockets and strings terminated with "\n".

Send "CONNECT" followed by the connection password ( empty string if no password ).
Reply:
OK -> connected
FULL -> another client is already connected
WRONGPASSWORD -> wrong password

Send "START" to start receiving data.
Data format is "MSG" followed by the message ID and then a stream of strings.
Send "ACK" followed by the message ID after each MSG.

Send "KEEPALIVE" every 15 seconds to keep the connection active.
The server sends "ALIVE" to report that the connection is active.

Send "DISCONNECT" to correctly close the connection.
« Last Edit: May 11, 2014, 05:04:23 PM by PiBoSo »

NOP

  • Newbie
  • *
  • Posts: 33
    • View Profile
Re: Live Timing
« Reply #1 on: October 09, 2012, 12:04:35 PM »
I have some problems.
After connecting to server i get
"MSG 0 SESSION WAITING" (newlines removed)
i send ack and server goes silent (not counting "ALIVE" messages)
after connecting to server i'm getting
"MSG 1 SESSION QUALIFY INPROGRESS WEATHER CLEAR 0.0 0.0 ENTRY 4 NOP. B F100 B F100"
each time after that i send (i think i didn't cock this up) "ACK\n" and "1\n" (ID + '\n').
But server keeps sending same "MSG 1..." even if another client joins session (and this message is constantly repeated).
\
Nevermind my bad.
« Last Edit: October 09, 2012, 12:31:47 PM by NOP »

PiBoSo

  • Administrator
  • Hero Member
  • *****
  • Posts: 1885
    • View Profile
    • Email
Re: Live Timing
« Reply #2 on: October 09, 2012, 12:35:21 PM »
I have some problems.
After connecting to server i get
"MSG 0 SESSION WAITING" (newlines removed)
i send ack and server goes silent (not counting "ALIVE" messages)
after connecting to server i'm getting
"MSG 1 SESSION QUALIFY INPROGRESS WEATHER CLEAR 0.0 0.0 ENTRY 4 NOP. B F100 B F100"
each time after that i send (i think i didn't cock this up) "ACK\n" and "1\n" (ID + '\n').
But server keeps sending same "MSG 1..." even if another client joins session (and this message is constantly repeated).
\
Nevermind my bad.

Good to know you solved the problem.

NOP

  • Newbie
  • *
  • Posts: 33
    • View Profile
Re: Live Timing
« Reply #3 on: October 09, 2012, 01:26:55 PM »
...
Good to know you solved the problem.
Now i feel compelled to explain.
What i think i did was send one message "ACK\n" and then next message ID + '\n'. Proper way was to send one message "ACK\n" + ID + '\n'. And it seems to work.

For people wondering what is Live Timing, it's some very basic data about karts times in splits and on start meta line. There is also some info about track and session.
Maybe it will find some use in leagues to present players more statistics (like consistency of drivers), or give server admins a bit more knowledge about what is going on in server. Or maybe i just don't get it  :P.
« Last Edit: October 09, 2012, 01:36:25 PM by NOP »

PiBoSo

  • Administrator
  • Hero Member
  • *****
  • Posts: 1885
    • View Profile
    • Email
Re: Live Timing
« Reply #4 on: October 09, 2012, 02:03:42 PM »
For people wondering what is Live Timing, it's some very basic data about karts times in splits and on start meta line. There is also some info about track and session.
Maybe it will find some use in leagues to present players more statistics (like consistency of drivers), or give server admins a bit more knowledge about what is going on in server. Or maybe i just don't get it  :P.

The idea is to give the possibility to stream race data to a web page or to an application ( like many real-life live timing services ).
It was kept simple to be as flexible as possible.
« Last Edit: October 09, 2012, 02:13:43 PM by PiBoSo »

dibu

  • Hero Member
  • *****
  • Posts: 680
    • View Profile
Re: Live Timing
« Reply #5 on: October 09, 2012, 03:43:42 PM »
NOP will you code something for public use?  Maybe it's also worth to have a look at GameQ ( http://gameq.sourceforge.net/ ). Possibly a profile for KRP can be added.

This morning I also played around with the live timing but very basicly. I mainly used Netcat (nc.exe) for testing.

NOP

  • Newbie
  • *
  • Posts: 33
    • View Profile
Re: Live Timing
« Reply #6 on: October 09, 2012, 04:17:39 PM »
Well i was doing app but i don't know how much sense is in doing something that will be visible only to one person. I guess i can slap some GUI and add data logging but i don't see big point to be honest.

dibu

  • Hero Member
  • *****
  • Posts: 680
    • View Profile
Re: Live Timing
« Reply #7 on: October 09, 2012, 05:35:25 PM »
You are right, but you know if there is a new toy we have to play with it until it gets boring  ;)
I just thought maybe you have already a quick and dirty tool for testing. Everything is better than nc.exe and a hexeditor  ;D


Aritz

  • Hero Member
  • *****
  • Posts: 1308
    • View Profile
Re: Live Timing
« Reply #8 on: October 09, 2012, 05:55:13 PM »
It will be interesting to have some kind of races/championships administration plugin for websites:

http://www.liveforspeed.es/modules.php?nombre_carrera=Vuelta al cole 6.0&op=modload&name=liga&file=consulta_carrera

NOP

  • Newbie
  • *
  • Posts: 33
    • View Profile
Re: Live Timing
« Reply #9 on: October 09, 2012, 06:13:16 PM »
I'am completely green if it comes to writing websites... but it would be neat thing too learn.
For now dibu if you want i will wrap my program with some user interface to make it a bit easier to use and maybe you will find it useful.

dibu

  • Hero Member
  • *****
  • Posts: 680
    • View Profile
Re: Live Timing
« Reply #10 on: October 09, 2012, 06:17:06 PM »
Same for me with the websites  ::)
If it's not too much work, I would be happy to get your program  :)

PiBoSo

  • Administrator
  • Hero Member
  • *****
  • Posts: 1885
    • View Profile
    • Email
Re: Live Timing
« Reply #11 on: October 09, 2012, 06:18:11 PM »
It will be interesting to have some kind of races/championships administration plugin for websites:

http://www.liveforspeed.es/modules.php?nombre_carrera=Vuelta al cole 6.0&op=modload&name=liga&file=consulta_carrera

What technology is used for that website?

NOP

  • Newbie
  • *
  • Posts: 33
    • View Profile
Re: Live Timing
« Reply #12 on: October 09, 2012, 07:51:37 PM »
Ok simple Live Timing logger
http://www.sendspace.pl/file/6b436eaacde80195c061e9d

Before starting server add configuration
[live]
enable = 1; 1 to enable live timing
port = 10660; the UDP port
password = admin

Start server, start logger if you didnt change anything click "connect" button.
Connection state should change to "OK". If it says "FULL" close program and try again after more than 15 seconds.

Messages from server will appear "Server data" label.
All messages are logged into text file. Slight difference is that rather than saving newlines '\n' I'm changing them to '|' sign. It keeps log file a bit more redable and still allows for easy parsing (file is open for writing and immediately closed).

If i didn't cocked something there will be also displayed times of sectors.

Aritz

  • Hero Member
  • *****
  • Posts: 1308
    • View Profile
Re: Live Timing
« Reply #13 on: October 09, 2012, 08:01:02 PM »
It will be interesting to have some kind of races/championships administration plugin for websites:

http://www.liveforspeed.es/modules.php?nombre_carrera=Vuelta al cole 6.0&op=modload&name=liga&file=consulta_carrera

What technology is used for that website?

-Waiting for an answer-

dibu

  • Hero Member
  • *****
  • Posts: 680
    • View Profile
Re: Live Timing
« Reply #14 on: October 10, 2012, 05:49:51 AM »
Thank you NOP  :)
I just did a quick test and it works. In the log all MSG are properly ACKed. The splits and the laptime shows up. I'll do some more testing in the evening.