MX Bikes Official Forum

General Category => Documentation => Topic started by: PiBoSo on October 04, 2014, 10:46:03 AM

Title: Live Timing
Post by: PiBoSo on October 04, 2014, 10:46:03 AM
It is possible to connect to a dedicated server to receive live race data.
The feature is off by default and must be enabled:
http://forum.mx-bikes.com/index.php?topic=197.0
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", followed by two parameter strings to start receiving data.
First parameter: "0" or "1". If set to "1", the track centerline and the track position of the bikes are sent, too.
Second Parameter: "0", "1" or "2". If set to "1", contacts between bikes are sent. If set to "2", then contacts with walls are sent, too.

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.

Example source code can be downloaded at this link: http://www.kartracing-pro.com/downloads/livetiming.c


Messages data format

EVENT
Type
- OPENPRACTICE
- RACE
- STRAIGHTRHYTHM
Name
Track
Track Length ( meters )
Allowed Categories and Bikes
Empty string

ENTRY
Race Number
Name
Bike Name
Bike Short Name
Categories
GUID
Extra Data
Empty string

ENTRYREMOVE
Race Number
Empty string

Open Practice:
SESSION
Session
- WAITING
- OPENPRACTICE
State
Length
Empty string

Race:
SESSION
Session
- WAITING
- PRACTICE
- PRE-QUALIFY
- QUALIFYPRACTICE
- QUALIFY
- WARMUP
- RACE1
- RACE2
State
if session = practice ( PRACTICE, PRE-QUALIFY, QUALIFYPRACTICE, WARMUP )
- INPROGRESS
- COMPLETE
else if session = race ( QUALIFY, RACE1, RACE2 )
- SIGHTINGLAP
- PRESTART
- STARTSEQUENCE
- INPROGRESS
- RACEOVER
- COMPLETE
endif
Length ( minutes if practice, minutes + laps or L laps if race )
Empty string

WEATHER
Conditions
- CLEAR
- CLOUDY
- RAINY
Air Temperature
Empty string

DRIVERSTATUS
Race Number
State
- DNS
- RET
- DSQ
Reason ( empty if state is not DSQ )
- JUMPSTART
- TOOMANYOFFENCES
- DIRECTOR
Empty string

BESTLAP
Race Number
Session Time ( milliseconds )
Lap Time ( milliseconds )
Lap Number
Split 1 ( milliseconds )
Split 2 ( milliseconds )
Average Speed ( meters/s )
Empty string

LASTLAP
Race Number
Session Time ( milliseconds )
Lap Time ( milliseconds )
Lap Number
Split 1 ( milliseconds )
Split 2 ( milliseconds )
Average Speed ( meters/s )
Empty string

PENALTY
Race Number
Penalty Number
Type
- TIME
Penalty Time ( seconds )
Offence
- JUMPSTART
- CUTTING
Empty string

LAP
Race Number
Lap Invalid
Session Time ( milliseconds )
Lap Time ( milliseconds )
Split 1 ( milliseconds )
Split 2 ( milliseconds )
Average Speed ( meters/s )
Empty string

SPLIT
Race Number
Split Number
Split Time ( milliseconds )
Empty string

HOLESHOT
Race Number
Holeshot Time ( milliseconds )
Empty string

CLASSIFICATION
Session
Status
Session Timer ( milliseconds )
Session Length ( minutes )
Session Lap
Number of Laps
Classification Type ( 0 -> none; 1 -> practice; 2 -> race )
if "Classification Type" is 1 or 2
Start Entry
Number of Entries
for each entry:
Race Number
if "Classification Type" is 1
Best Lap ( milliseconds )
Lap Number
Total Laps
Gap ( milliseconds, -- if zero )
Average Speed ( meters/s )
else
Race Time ( milliseconds ) or Status
- DNS
- DSQ
Lap Number
Gap ( milliseconds or L if lapped )
endelse
Bike Status
- TRK: on track
- PIT: in the pits
endfor
endif
Empty string after the last entry

TRACKDATA
Start / Finish Longitudinal Position
Split 1 Longitudinal Position
Split 2 Longitudinal Position
Holeshot Longitudinal Position ( -1 if missing )
Number of Segments
Empty string

Always sent after TRACKDATA:
TRACKSEGMENT
Segment Number
Type ( 0 = straight, 1 = curve )
Length ( meters )
Radius ( meters )
Angle ( degrees )
Start Position X ( meters )
Start Position z ( meters )
Height ( meters )
Empty string

TRACKPOSITION
for each entry on track:
Race Number
Position X ( meters )
Position Y ( meters )
Position Z ( meters )
endfor
Empty string after the last entry

CONTACT
Time ( milliseconds )
Race Number 1 ( -1 for a wall )
Race Number 2 ( -1 for a wall )
Relative Impact Velocity ( meters/s )
Empty string

END
Empty string
Title: Re: Live Timing
Post by: Niko Mouk on March 16, 2016, 01:57:16 PM
This is a bit blur,
Do you have an exemple somewhere to allow me doing something like I did here : MXS LiveTiming (http://msx-concept.com/livetiming/)
Title: Re: Live Timing
Post by: PizzaChet on March 16, 2016, 05:49:41 PM
Speaking of timing, I ran a bunch of laps online on Holjes on the SM bike and I don't see my time up there. I've done several sessions, some alone. I do see my times for Forest and Practice Track Short however.
Title: Re: Live Timing
Post by: Steven on March 17, 2016, 10:48:05 AM
Quote from: Niko Mouk on March 16, 2016, 01:57:16 PM
This is a bit blur,
Do you have an exemple somewhere to allow me doing something like I did here : MXS LiveTiming (http://msx-concept.com/livetiming/)

Could you be a bit more specific? I just started trying around with this, maybe I can help.
What have you tried so far? And what did you have to do to get your site to work with MXS? (By the way your link doesn't work as it is.)
Title: Re: Live Timing
Post by: Niko Mouk on March 17, 2016, 11:34:10 AM
Yep I inverted 2 letters, it's http://mxs-concept.com/livetiming/ (http://mxs-concept.com/livetiming/)

I don't understand the way you can receive, for my livetiming on mxsimulator I think the strategy is totally different, the game server is writting a text file with all info as they come (rider 2 pass the second checkpoint for exemple) and I'm reading into that file.
Next at the end of the race a command send this file where I want to decode it and display championship results ie.
Title: Re: Live Timing
Post by: Steven on March 18, 2016, 01:23:20 PM
Ah ok, here you have to connect to the server that sends the information (track, players, split times and so on) to you. UDP is used for that.
I don't know about your "qualifications". Are you just looking for some example code or how to do it at all?
Title: Re: Live Timing
Post by: Niko Mouk on March 18, 2016, 03:23:15 PM
Maybe I have to understand if it will needed or not for the races and championships we will do. At the moment I think I'll focus myself on track making as the game is a bit poor at this level.  ;)
Title: Re: Live Timing
Post by: Umpossible on June 25, 2018, 12:26:14 PM
Can anybody help me with this? I'm looking to get live timing off of the Weekend Warriors FLCS2 server. Preferably, if it's possible I would love to be able to connect and download all the information from the server over the past week that it's been running but I doubt that's possible, or i could say that it's probably umpossible haha. 
Title: Re: Live Timing
Post by: iNsane on June 25, 2018, 01:26:42 PM
Quote from: Umpossible on June 25, 2018, 12:26:14 PM
Can anybody help me with this? I'm looking to get live timing off of the Weekend Warriors FLCS2 server. Preferably, if it's possible I would love to be able to connect and download all the information from the server over the past week that it's been running but I doubt that's possible, or i could say that it's probably umpossible haha.

well I didn't even enabled live in my server config file tbh., never saw a reasonable point behind that

Edit // enabled it now but I can't even connect to the port i defined there, dunno
Title: Re: Live Timing
Post by: PiBoSo on December 03, 2019, 02:27:20 PM
First post updated to add a parameter to the "START" command, that allows to receive the track centerline and bikes' track position, too.
Title: Re: Live Timing
Post by: PiBoSo on September 09, 2020, 11:36:25 PM
First post updated to add the messages data format.
Title: Re: Live Timing
Post by: MxWayGamer on September 14, 2020, 10:17:56 AM
Thanks for the new informations about blocs.
Could you add Empty string after every blocs ? It will be easier to process them.
Title: Re: Live Timing
Post by: PiBoSo on September 14, 2020, 10:57:53 AM
Quote from: MxWayGamer on September 14, 2020, 10:17:56 AMThanks for the new informations about blocs.
Could you add Empty string after every blocs ? It will be easier to process them.

Thank you for the suggestion.
Empty strings will be added in the next MX Bikes update.
Title: Re: Live Timing
Post by: MxWayGamer on September 14, 2020, 12:11:57 PM
Quote from: PiBoSo on September 14, 2020, 10:57:53 AMThank you for the suggestion.
Empty strings will be added in the next MX Bikes update.

Thanks ! It will be clearer than testing every line if it's bloc names to know if it's new bloc or not.
Title: Re: Live Timing
Post by: MxWayGamer on September 15, 2020, 10:19:00 AM
Is it possible to add session informations (Number of lap and Duration) in the live timing bloc ?

Example :
SESSIONSETUP
Number of lap
Duration
Title: Re: Live Timing
Post by: Ruubs on September 15, 2020, 07:00:45 PM
Quote from: MxWayGamer on September 15, 2020, 10:19:00 AMIs it possible to add session informations (Number of lap and Duration) in the live timing bloc ?

Example :
SESSIONSETUP
Number of lap
Duration

If what you're saying is a suggestion for B15, don't mind me.
If it is not a suggestion for B15; MXB currently doesn't support races based on minutes and laps (however I do believe that's been implemented for B15 already). You can get the session time though. For races, it'll display the minutes left, and for practice it'll show the total time that has passed since the start of te session.

You can get this information from the classification section, then look for session timer.
Title: Re: Live Timing
Post by: MxWayGamer on September 15, 2020, 07:55:28 PM
Quote from: Ruubs on September 15, 2020, 07:00:45 PMIf what you're saying is a suggestion for B15, don't mind me.
If it is not a suggestion for B15; MXB currently doesn't support races based on minutes and laps (however I do believe that's been implemented for B15 already). You can get the session time though. For races, it'll display the minutes left, and for practice it'll show the total time that has passed since the start of te session.

You can get this information from the classification section, then look for session timer.

The problem with the session timer in classification, it gives the time since the begining of the session, for race too. So it's hard to create countdown on live timing dashboard because it's not possible to get the configuration of the session.

For the race, it's the same. It's possible to get the current lap of the first player, but not the number of lap for the full race. So, it's not possible to display : "Lap 5/15" now.

In my example, I have add two lines 'Number of lap' and 'Duration' but as you said, it's not possible to create session defined by this two parameters in the same time, so the bloc could be more than :

SESSIONSETUP
TYPE
- Duration
- Lap
Number of lap OR Duration

Concrete example :
SESSIONSETUP
LAP
15

Title: Re: Live Timing
Post by: iNsane on September 15, 2020, 08:03:46 PM
You could get the max laps per server from my or the official server page

Simple XML or JSON parse should do the trick
Title: Re: Live Timing
Post by: MxWayGamer on September 15, 2020, 09:11:12 PM
Quote from: iNsane | WW on September 15, 2020, 08:03:46 PMYou could get the max laps per server from my or the official server page

Simple XML or JSON parse should do the trick

It's very ugly to use other website to get information when you directly can exchange informations with the server. For example : If official server page is down, my live timing will be down ...
Title: Re: Live Timing
Post by: PiBoSo on November 02, 2020, 12:19:31 AM
First post updated with the latest messages data format:
- added an empty string at the end of each message
- added "type" to EVENT
- added "Extra Data" to ENTRY
- added "Average Speed" to LAP
- added the session length and laps to CLASSIFICATION
- PREQUALIFY has been changed to PRE-QUALIFY

A link to example source code has been added, too.
Title: Re: Live Timing
Post by: Resolute Kraken on February 17, 2021, 06:14:03 AM
Can the HOLESHOT be added as a new MSG?

Would also help if the ENTRY record contained a status if the player was disconnected.  For example, if you connect to live timing during a practice session, and a player had already disconnected, you will never receive the ENTRYREMOVE MSG, but they are sent in the ENTRY MSG until the session changes.
Title: Re: Live Timing
Post by: PiBoSo on February 17, 2021, 03:54:40 PM
Quote from: Resolute Kraken on February 17, 2021, 06:14:03 AMCan the HOLESHOT be added as a new MSG?

Would also help if the ENTRY record contained a status if the player was disconnected.  For example, if you connect to live timing during a practice session, and a player had already disconnected, you will never receive the ENTRYREMOVE MSG, but they are sent in the ENTRY MSG until the session changes.

The HOLESHOT message will be added to the next MX Bikes update.

Please note that entries and clients are not the same.
The ENTRYREMOVE message is only sent when the client that disconnects has not recorded any lap.
Title: Re: Live Timing
Post by: Resolute Kraken on February 17, 2021, 06:12:27 PM
Quote from: PiBoSo on February 17, 2021, 03:54:40 PMPlease note that entries and clients are not the same.
The ENTRYREMOVE message is only sent when the client that disconnects has not recorded any lap.

Thanks, but the connected clients are not sent in any of the messages.  So, we can't tell who is connected or not if they did record a lap.  This would be helpful to know so we can tell which clients are connected and valid to send remote admin commands to.
Title: Re: Live Timing
Post by: Resolute Kraken on February 17, 2021, 06:22:57 PM
Would you be able to update the CLASSIFICATION when a split is crossed by a player instead of only at the start/finish? 

Currently, you do not have accurate results in live timing and in the game (replay screen or MaxHud plugin) until the player has crossed the start/finish for the second time.  This is especially bad on tracks such as Mantua or Washington where the start/finish is far away from the start gate.  So, you end up not getting updated classifications until almost the end of the 2nd lap because they have only crossed the start/finish 2 times. 

If you included the split times in the timing and update of the classifications, the live timing would be much more useful to streamers and players as the results would update 3 times per lap - at each split and the start/finish.

Also, splits are not posted until the rider starts the first "official" lap as well.  Again, for a track like Manuta, the start gate is right after the start/finish.  It would be nice to know who is in the lead on the first lap from the start gate to start/finish.  If you report the splits, even though this isn't an officially recorded lap, then we could at least get the current results on that first lap.
Title: Re: Live Timing
Post by: Niko Mouk on March 30, 2021, 02:30:57 PM
Quote from: Resolute Kraken on February 17, 2021, 06:22:57 PMWould you be able to update the CLASSIFICATION when a split is crossed by a player instead of only at the start/finish?

+1

Depending on how large the data is, it could be updated after each checkpoint too. Just like in MX Sim. It is not normal you have to wait 2 laps to know your position, even if I can understand the simulation side where IRL you can see the pitboard in one and only location. But for the live spectating  it's needed.
Title: Re: Live Timing
Post by: Resolute Kraken on May 11, 2021, 02:11:40 AM
Were any new features added to live timing or remote admin for B16?  I saw that it now reports the MSG for HOLESHOT.  Is there anything else?
Title: Re: Live Timing
Post by: PiBoSo on May 26, 2021, 12:14:02 AM
First post updated:
- added info on how to receive the contact messages
- added the HOLESHOT and CONTACT messages data format
Title: Re: Live Timing
Post by: PiBoSo on February 03, 2022, 12:55:12 AM
First post updated:
- changed the START command parameters
- added "Length" to SESSION
- added "Holeshot" to TRACKDATA
Title: Re: Live Timing
Post by: PiBoSo on August 23, 2023, 11:53:56 AM
First post updated:
- changed the DRIVERSTATUS and CLASSIFICATION messages data format
Title: Re: Live Timing
Post by: paridudey on April 12, 2024, 11:49:55 AM
Step into a World of Enchantment with Noida Escorts
Noida escorts invite you to experience a world of pleasure. Their exquisite call girls are on standby to fulfill all your desires without crossing any lines - your happiness and satisfaction are of utmost importance to them. Self-confident and steadfast, they strive to ensure you never feel uncomfortable during any encounter or adventure - be it intimate or adventurous.

Noida Escort Service and experience an exhilarating encounter that exceeds all your expectations. These sophisticated companions understand your needs and are capable of meeting every one of them - be it for fun and excitement or relaxation after a hard day's work, our beautiful escorts offer the ideal way to unwind.

Independent Escorts Noida is always on call 24/7 and can be reached either through our website or mobile apps. With reliable and discrete services that guarantee an unforgettable encounter - no matter if it be for just an evening date or lasting romance - our experienced escorts guarantee unforgettable encounters every time.

Love And Sex Full Enjoyment with Hot Noida Call Girls!
Noida call girls know exactly how to please their clients, with knowledge of all the unique ways of disbursing pleasure in distinct ways. These stunning beauties are always ready to fulfill all your fantasies and desires in an inconspicuous way, seducing gestures and killer smiles enough to entice any gentleman. These ladies are extremely dedicated to their work and always strive to exceed expectations - whether it's fun and excitement you seek or simply someone to talk to, these girls would be more than willing to assist.

No matter if you want an unforgettable night or just someone to keep you company Independent Call Girls Noida can deliver. Available 24/7 and eager to fulfill all of your desires, these stunning ladies will do whatever it takes to meet them all. Additionally, they are very empathetic towards all of your needs and wishes; should you ever find yourself feeling down, they will try their hardest to cheer you up.

Elite gentlemen looking for romantic and mature experiences turn to Call girls in Noida who offer high-profile escort services as the first choice. Their looks are meticulously maintained while being educated with sharp minds - an attractive combination. Are you searching for a reputable escort's agency in Noida? Look no further - here you will find only trained sensual experts ready to meet their clients' sensual desires and leave them elated. These girls are professional yet discreet so can keep all your secrets secure.

Noida escorts || Noida call girls || Russian Call Girls Noida || delhi escorts || ghaziabad escorts || greater noida escorts || darjeeling escorts || gangtok escorts || siliguri escorts || udaipur escorts || raipur escorts || jodhpur escorts || visakhapatnam escorts || surajkund escorts || vaishali escorts || indirapuram escorts || crossings republik escorts || kaushambi escorts || vasundhara escorts || tilak nagar escorts || kirti nagar escorts || dhaula kuan escorts || patparganj escorts ||
Title: Re: Live Timing
Post by: Domsaleo on April 17, 2024, 01:32:26 PM
Could anyone give me some information on how to implement this? I have several servers and would like to use live timing on my website. No idea where to start with this.