The online racing simulator
Connection number/Unique ID question (InSim)
Hi!

I'm developing an InSim application which will be used in the hungarian league.
I have a question about these connection numbers and unique IDs.

1. As I understand unique IDs are used to identify racers who are not spectating, i.e. joined the race (they may be in the garage, though), and those who simply spectate do not have a Unique ID. The questions are: what if someone spectates and then rejoins the race? Will he get the same unique ID or is it undefined? If someone leaves the race, will the other unique IDs be affected in any way (I guess not)?

2. Connection IDs. Now, if I'm not misunderstanding something, the host has always the connection number 0, and others get the next integer number as they join (1,2,3...). If someone disconnects, then every connection number remains the same, except for the last connection (player with the biggest connection number), whose connection number will be changed to that of the disconnected player. Am I right? Question is - what if several players disconnect at the same time? Since LFS uses UDP packets, my InSim program may receive the packets in wrong order, so it may go out of sync (wrong updating of connection numbers). If that's the case, how can I make it work (to be in sync again)?

Thanks in advance
It's been a while, but i'll try to answer:

1. UniqueIDs do not change if someone leaves the race (unlike PlayerNum). I don't think there is any guarantee to get the same ID should someone leave and then come back. In such a case, your program should update its list when it receives the NPL packets.

2. Your description is correct. It is possible that the UDP packets gets out of sync. To check for this, you can verify the Total field of the CNL packet. If it is different than OldTotal-1, then more than 1 left the server. In this case, you would have to ask for new NCN packets for everyone (loop for 1 to n, send ("NCN",x) ).
ok, thanks for answering, I haven't thought of using the Total field of the CNL packet yet, so it was useful info

FGED GREDG RDFGDR GSFDG