The online racing simulator
Quote from Soeren Scharf :hello Scawen,

would it be possible to include the absolute time into the LAP/SPX packets? If a program wants to calculate the gap between 2 cars, it would have to add up the times of all driven laps. But this is not possible if the program is missing the start of the race (eg. if a spectator connected to the server after some laps).

regards Sören

That would be a nice addition. I was planning a pitboard app for on my laptop (which I keep next to me while I race), but such a field would make it very easy and simple.
I also got 2 questions about OutGauge. What is the difference with OG_FULLBEAM and OG_HEADLIGHTS, and shouldn't OG_SIGNAL_L and OG_SIGNAL_R both be enabled when you've pressed 9 (hazard lights on).
I would prefer a requestable package for all players with the current time. (One with all players or one request and some packages.
Quote from MoHaX :Please tell me why do you ask InSim for features that could (and should!) be implemented by user software? Scawen, please just keep it simple, because if you will follow such requests InSim became something complex and unflexible. It isn't InSim job to calculate total race time, gap between cars (if someone request a requestable packet with gap calculation between any two cars, will you implement it?), total amount of pitstops, best acceleration, best drift score and many many other features that lazy programmers could request from you.

LAZY PROGRAMMERS! None of us can do the work if we don't have the information to do it with. The flag packet is needed, we can't really do that by our selfs (Let's keep this with in reason) we could find out if the player has pitted, or is pitting in, ect. But we would have to map out an polygon for each pit entrance, exit, and pit area. It would take far more time that Scawen to wip up an InSim packet for it. I would not say that any one around here is lazy. Their are some things we simply can not do with out some of the insim packets. Please, don't call any of us lazy. I take a real issue with that.
Quote from Soeren Scharf :hello Scawen,

would it be possible to include the absolute time into the LAP/SPX packets? If a program wants to calculate the gap between 2 cars, it would have to add up the times of all driven laps. But this is not possible if the program is missing the start of the race (eg. if a spectator connected to the server after some laps).

regards Sören

Lap and Node of each car is sent in MCI pack. So you have the position of each driver in the race (Lap * 1000 + Node f.e.). Simply store this information with the time and you can calculate the gap when ever you want to.
No need to add up the times of all driven laps.
Quote from MoHaX :Please tell me why do you ask InSim for features that could (and should!) be implemented by user software? Scawen, please just keep it simple, because if you will follow such requests InSim became something complex and unflexible. It isn't InSim job to calculate total race time, gap between cars (if someone request a requestable packet with gap calculation between any two cars, will you implement it?), total amount of pitstops, best acceleration, best drift score and many many other features that lazy programmers could request from you.

In principle you are right. And I agree that Scawen should not waste time by implementing things that we can calculate ourself. And I would calculate absolute time myself if I could but I can't. So an exact explanation only for you:
- to calculate gap times you need absolute times.
- to calculate absolute times you need to add up all past laps.
- to add all past laps you are required to be connected at the start of the race
- if a spectator tool (eg. LfS TV director) connects during the middle of the race, it has missed all past laps and therefore no chance to calculate the absolute time.
Maybe I have missed a differnent way how to do this, but if you know it better, then kindly please tell me instead of just calling me lazy. Also I have not asked Scawen to implement gap calculation. Read my post again and think before you write, but never call me lazy.

Quote from riskredruM :Lap and Node of each car is sent in MCI pack. So you have the position of each driver in the race (Lap * 1000 + Node f.e.). Simply store this information with the time and you can calculate the gap when ever you want to.
No need to add up the times of all driven laps.

you mean the arrival time of the MCI packet? Well, indeed a very exact calculation.

regards
On top of that... Why waste the traffic needed for NLP/MCI if you only want the gaps at the splits?
Quote from Kegetys :Could the insim password also be separated from the server password? Many insim app users now seem to be confused what it means when the connection is rejected due to some old password they used for a server.

Maybe the password setting could be in the options, or maybe insim connections coming from localhost (127.*) could always be allowed without providing a password (An application running on the same machine could read the password from the config file or memory anyway so security wise it would not be much different).

This seems to be a good idea, having thought about it I can't see any problem with allowing 127.0.0.1 to connect without password. It's not a security risk as any program that can connect with that IP, already has access to your hard drive. Are there any other IP addresses than 127.0.0.1 (as you said 127.*) ?

Quote from Soeren Scharf :would it be possible to include the absolute time into the LAP/SPX packets? If a program wants to calculate the gap between 2 cars, it would have to add up the times of all driven laps. But this is not possible if the program is missing the start of the race (eg. if a spectator connected to the server after some laps).

It seems like a reasonable request, it's only an extra 4 bytes in a lap packet. You mean : a number in there : total time since the race started?

I was thinking about the times, MSHT is very wasteful. Should I convert to a simple unsigned "milliseconds" for all the MSHT times? I feel bad for doing this now as it's another change, but if that is to be done, now is better than later... what do you think? MSHT is inefficient, you cannot do maths with it, and it cannot represent times longer than an hour (which can cause bugs in some cases). It is in LAP / SPX / PSF / FIN / RES - and the FIN and RES also have an hours byte that could be removed in that case.

Quote from CLRS530 :I would prefer a requestable package for all players with the current time. (One with all players or one request and some packages.

I'm not sure what you mean. You can get the current race time in a SMALL_RTP packet. Hmm, that is in hundredths. Maybe that should be milliseconds as well, I want InSim to be clean and consistent now, and that's why all the changes have been made.

Quote from MoHaX :Please tell me why do you ask InSim for features that could (and should!) be implemented by user software? Scawen, please just keep it simple, because if you will follow such requests InSim became something complex and unflexible. It isn't InSim job to calculate total race time, gap between cars (if someone request a requestable packet with gap calculation between any two cars, will you implement it?), total amount of pitstops, best acceleration, best drift score and many many other features that lazy programmers could request from you.

No, Soeren is only asking for the "elapsed race time" at the point when the player passes a lap or split. It seems reasonable and won't cost in bandwidth. LFS of course knows the elapsed time but that isn't send in the packets.

Now is the time to get it right. I don't want to cause an upset by an InSim rewrite in future. This had to be done once now that InSim has "grown up" from just a local camera positioner with a few race tracking packets thrown in. It needed the rewrite, and it's looking a lot better now.
Quote from Scawen :Are there any other IP addresses than 127.0.0.1 (as you said 127.*) ?

The whole 127.0.0.0 - 127.255.255.255 range is reserved for local loopback (~16 million addresses just for that, and now they complain about running out of free addresses :tilt. 127.0.0.1 is the most commonly used though and that alone would propably be enough.
Quote from Scawen :I'm not sure what you mean. You can get the current race time in a SMALL_RTP packet. Hmm, that is in hundredths. Maybe that should be milliseconds as well, I want InSim to be clean and consistent now, and that's why all the changes have been made.

Thanks Scawen good to know and my post you quote was an answer to Soeren because I don´t think adding the current total time to SPX or LAP is necessary. And yes RTP is what he needs, hadn´t it in mind for this.


time in ms:
I would prefer it because you have a faster access and I also have to convert it to milliseconds sometimes. Convert it back to MSHT is the easier part and you mostly only need it for output, so only one time.
But RTP does not give you the exact gap between to drivers because of the transmission delay...
Quote :Originally Posted by Scawen
....
It seems like a reasonable request, it's only an extra 4 bytes in a lap packet. You mean : a number in there : total time since the race started?
...
...
No, Soeren is only asking for the "elapsed race time" at the point when the player passes a lap or split. It seems reasonable and won't cost in bandwidth. LFS of course knows the elapsed time but that isn't send in the packets.
...

this is excatly, what I am asking for

Quote :Originally Posted by Scawen
...
I was thinking about the times, MSHT is very wasteful. Should I convert to a simple unsigned "milliseconds" for all the MSHT times? I feel bad for doing this now as it's another change, but if that is to be done, now is better than later... what do you think?
...

I totally agree with you, putting milliseconds into a double word is sufficient for 49 days until overflow. And we could do maths with it. So if you do not deal with MSHT internally, then change to milliseconds, in other words: as a programmer I would just use, what I use internally and copy it into the packet (for other readers: this is an opinion, not a request). But there might be a lot of insim developers now crying, so the decision is yours.

regards
Sören
maintaining connection documentation bug?
Quote :// MAINTAINING THE CONNECTION - IMPORTANT
// ==========================

// If InSim does not receive a packet for 70 seconds, it will close your connection.
// To open it again you would need to send another InSimInit packet.

// LFS will send a blank IS_TINY packet like this every 30 seconds :

// ReqI : 0
// SubT : TINY_NONE (keep alive packet)

// You should reply with a blank IS_TINY packet :

// ReqI : 0
// SubT : TINY_NONE (has no effect other than resetting the timeout)

reqi is not 0, but 255 ?

Not that this is a problem, I just echo the packet back if [1]==tiny and [3]==tinynone...

27.4.2007 21:18:45 - timeout ack sent, reqi: 255
27.4.2007 21:19:15 - timeout ack sent, reqi: 255
27.4.2007 21:19:45 - timeout ack sent, reqi: 255
27.4.2007 21:20:15 - timeout ack sent, reqi: 255
27.4.2007 21:20:45 - timeout ack sent, reqi: 255
27.4.2007 21:21:15 - timeout ack sent, reqi: 255
27.4.2007 21:21:45 - timeout ack sent, reqi: 255

Is this a bug or did I do something wrong? I used W17 in hotlap mode

Sometimes I get the following error when sending MTC...


IS_MTC - invalid message
IS_MTC - could not find destination

I printed some debug info and it comes in this case from the following message


MTC->LFS:
size=72
type=14
reqi=0
zero=0
ucid=0
plid=0
text=Best split 1: ^3^7Aqu^4ili^7fer ^8(XFR) - 0:22.640

..but it should be ok as the connections and racers are...


Connections: [1 pcs]
#0: [] - [] - UCID=0 1 (host)
Racers: [1 pcs]
1: [^7Aqu^4ili^7fer] - [XFR] - UCID=0, PLID=2

The person with UCID=0/PLID=2 should get it, but since I send it with PLID=0, LFS should use UCID, which is 0 here. Right? It is really annoying as it happens only 1/100 messages I send and rest work ok. The same message works in most cases but sometimes I get that.

It would be nice if LFS also printed the UCID/PLID values in the error message if it cannot match anybody. Like...
"IS_MTC - could not find destination (UCID=0, PLID=0)"
Quote from Aquilifer :The person with UCID=0/PLID=2 should get it, but since I send it with PLID=0, LFS should use UCID, which is 0 here. Right? It is really annoying as it happens only 1/100 messages I send and rest work ok. The same message works in most cases but sometimes I get that.

It would be nice if LFS also printed the UCID/PLID values in the error message if it cannot match anybody. Like...
"IS_MTC - could not find destination (UCID=0, PLID=0)"

Just a couple of questions before I look into it.

1) Are you using UDP or TCP?
2) Is the message text filled with zeros all the way to the end of the packet? It should be as LFS probably checks that the end byte is zero.
Quote from Scawen :Just a couple of questions before I look into it.

1) Are you using UDP or TCP?
2) Is the message text filled with zeros all the way to the end of the packet? It should be as LFS probably checks that the end byte is zero.

1) all UDP
2) Hmmm.. nope. It just puts the end zero and leaves rest of it. So it must be full of what ever nonsense there is in the memory. It could explain why it fails so rarely, if the end byte happens to be zero usually.
I try that fix tomorrow...err today (is the clock that much?).

It's just that from the error I got impression it cannot find the connection where to send it. Very hard to confirm if it works after that (if it works). You can test very long but still cannot be sure that it never happens. (=easier to prove if something fails than proving it never fails)

BTW: Is this the case with all the char arrays in insim packets? (except the license plate)
Yes having looked in the code this is definitely the error.

"Could not find destination" was a misleading message, as it just didn't bother to look for the destination after finding the message was invalid. I've fixed that now and changed the message to say "last byte of message must be zero". This is the same in IS_MST and IS_MTC. It's a safety check so your program can't make LFS crash when it does a string copy.

By the way, I plan to make UDP multiple connections acceptable, which will be helpful for people making local computer InSim programs, where UDP should usually be lossless.


To All Programmers :

A note about timing, it will definitely not be released fully this week, there is too much to do still. Patch X release should be around Friday 11 May or a week later on Friday 18 May.

I will do those small InSim changes I've mentioned and give you a hopefully final InSim version this week. But the changes will be small :

Change MSHT times to milliseconds
Add elapsed time to LAP / SPX
Allow >1 UDP connection
127.x.x.x no password required
Small documentation bug
-
(MonkOnHotTinRoof) DELETED by MonkOnHotTinRoof
Yep. I tested by planting a non zero byte to 64th place and it fails always then. So I guess it's solved then.

Thanks
Ah lol had this error many times in older versions of LFS mainly in the debug version of my program.
Never understood it
Those things should been documented
Quote from MonkOnHotTinRoof :Gave up on custom buttons ?

No, I'm just waiting for a couple of days spare to do them. That system isn't so much a "change" but something new added. I've got a lot to do and get tested as quickly as possible, bug sheet to clear, etc. Hopefully there's time after that to do the programmable buttons.
Quote :Are there any other IP addresses than 127.0.0.1 (as you said 127.*) ?

Half of the 127.* range (and also 128.* range) used to be reserved for LAN use, but a few years ago the specification changed to free the range up for use in the future as internet WAN addresses. It will probably be a few more years until they are used though - however, in light of that, I would limit loopback to 127.0.0.1.

The only two remaining LAN addressess I can think of are 10.*.*.* and 192.168.*.*
See http://www.rfc-editor.org/rfc/rfc3330.txt Section 2 (Special-Use IPv4 Addresses)

One issue with no password from 127.* would be shared hosts. Hosts that have multiple instances of LFS running on different ports for reselling purposes specifically. User permissions (should) prevent users from reading each others password but unless each instance of LFS runs in its own chroot jail, they would share the loopback.
According to that document my post is slightly innacurate, to save you the hassle it says 127.0.0.0/8 (or 127.*) should be loopback. I was confused with the 128.* range.

Anarchi-H does raise a valid point for the dedicated host though, local loop back needs to be secure for shared hosters like Franky.
I noticed this change from insim v3.

In insim v3 if you typed e.g "/mso test", you would get into insim mso message "/mso test" (well actually another mso with "test" too). In insim v4 you get only mso with "test". This is not really a big problem as you can test that there is no player name before the actual text. But it would be better if the following flag was added...

Maybe a flag could be put into the MSO packet to tell if it came from the 'owner' of the LFS which is running this insim? Or even better if the connection (NCN) had an "IOwnYou" type flag for similar purpose. Or is there some other easy way to tell which connection owns this insim?
(in server use you could assume host is always the 1st connection, but not so in client tool)
Quote from Scawen :
I will do those small InSim changes I've mentioned and give you a hopefully final InSim version this week. But the changes will be small :

Change MSHT times to milliseconds
Add elapsed time to LAP / SPX
Allow >1 UDP connection
127.x.x.x no password required
Small documentation bug

Can we clarify the 127.0.0.1 no password situation.

Currently InSim listens on the specified IP or 0.0.0.0, thus what's being proposed is the checking the source IP is 127.0.0.1 and ignoring any password, yes?

I'm not sure this is really a good idea. It's going to cause security problems for hosters (such as myself and many others) that run multiple LFS instances on the same server (IP) under different security contexts for different admins.

If anything it would be better to have a dedicated InSim password IMHO.

Just my 2c anyway.
Rob
I couldnt decide quite where the best place was for this, but..

Is anyone else having "fun" with the SMALL_VTA? Specifically when a vote occurs and goes through, I /appear/ to receive a SMALL_SSG instead Another dumb moment, I suspect?
This thread is closed

FGED GREDG RDFGDR GSFDG