• Welcome to Kart Racing Pro Official Forum. Please login or sign up.
 
June 20, 2019, 11:38:12 am

News:

Please read the FORUM RULES


Live Timing

Started by PiBoSo, October 08, 2012, 10:27:43 pm

Previous topic - Next topic

PiBoSo

October 08, 2012, 10:27:43 pm Last Edit: May 11, 2014, 07:04:23 pm by PiBoSo
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.

NOP

October 09, 2012, 02:04:35 pm #1 Last Edit: October 09, 2012, 02:31:47 pm by NOP
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.

PiBoSo

Quote from: NOP on October 09, 2012, 02: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.


Good to know you solved the problem.

NOP

October 09, 2012, 03:26:55 pm #3 Last Edit: October 09, 2012, 03:36:25 pm by NOP
Quote from: PiBoSo on October 09, 2012, 02:35:21 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.

PiBoSo

October 09, 2012, 04:03:42 pm #4 Last Edit: October 09, 2012, 04:13:43 pm by PiBoSo
Quote from: NOP on October 09, 2012, 03:26:55 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.

dibu

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

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

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

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

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

Same for me with the websites  ::)
If it's not too much work, I would be happy to get your program  :)

PiBoSo

Quote from: Aritz on October 09, 2012, 07: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


What technology is used for that website?

NOP

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


dibu

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.