The online racing simulator
0.6A1 InSim.txt and LYT.txt
1
(49 posts, started )
0.6A1 InSim.txt and LYT.txt
Hello Programmers.

Sorry, I just realised I forgot to put the new InSim.txt in the patch. Here it is attached, along with the LYT file specification.
Attached files
InSim.txt - 67.4 KB - 877 views
LYT.TXT - 6.7 KB - 740 views
InSim libraries will need some serious updates with version 5. Thanks for the admin commands stuff, I already feel safer. Hopefully I could test it toning, to see e.g. what "set if user is an admin" actually means, if this byte just uses 0 and 1...
Yes, that byte should just be 0 or 1.
Because some "admin" commands are available to non-admins if guest selection is enabled, like /track=bl3
Fifth line reads
// InSim for Live for Speed : 0.5Z

should be
// InSim for Live for Speed : 0.6A(1)

.

Sixteenth line reads
// INSIM VERSION NUMBER (updated for version 0.5Z30)

should that not be
// INSIM VERSION NUMBER (updated for version 0.6A1)

also?

Thank you very much for the IS_ACR packet. That's a great help!
Scawen, I have one incompatibility issue, sorry to bother you again. Almost all the new packet types (layout/hit/contact) are optional, requested on InSim connect. The only exception is the ISP_ACR admin command packet, which is always sent. Unfortunately the library I use is detecting it as bad packet type, assuming communication error, leading to disconnect. Maybe a short-sighted assumption, but it worked very well for 2.5 years.

Of course I updated the library and I will think how to make it better future-proof, but all the current Airio versions will cease to function properly after server update to 0.6, which will happen soon, I guess. So, please, is there any chance to make the ISP_ACR packet also optional, that must be required during InSim connect? It would help help a lot now. Thanks for reading.

PS: I guess the demo/tweaked/private bits of server state did not make it to your intended features list?
PRISM did not have this problem, I don't think anyway, but then the packet handling code was made by Victor.
Well, yeah, I'm trying to explain this weird approach in a bit more detail here.
No... InSim is specifically designed so that you can continue to read without knowing all packet types. I will not make all new packets optional.

Any programmers out there, please read this post I made on the other thread. Very important in case your code doesn't handle the rare but very real situation of split packets.

http://www.lfsforum.net/showthread.php?p=1603154#post1603154
Alright.
Quote from EQ Worry :PS: I guess the demo/tweaked/private bits of server state did not make it to your intended features list?

I wonder if this could be one of the last-minute small updates for the official patch. I promise, this is the last time I mention it, also I have no more ideas/requests (well, for this patch at least).

Now I remember a long-existing thing, the "unknown car id" displayed sometimes. I wonder if that could be related to the fact that often cars are send to /spec right after pitting (Shift+P) by InSim apps, e.g. to prevent repeated midrace rejoins from pits. Maybe a small lag would cause some LFS pitting routine to be delayed for so long that when it runs the car is not in the pits anymore, but spectating? Just an idea though.

Again, thanks for all the updates!
I just invented a new engine by spawning poles at the car's position and let the collision system propulse the car to up to 47kph!

only thing i wish, was on OBH and HLV that it is actual speed not closing speed...
Quote from T3charmy :only thing i wish, was on OBH and HLV that it is actual speed not closing speed...

If I see correctly, HLV has no speed, only CON and OBH have it. And, maybe I am too tired, but what use would be the actual speed? The closing speed describes impact severity, which seems to be the perfect measure of contacts with other cars and objects.
Quote from EQ Worry :If I see correctly, HLV has no speed, only CON and OBH have it. And, maybe I am too tired, but what use would be the actual speed? The closing speed describes impact severity, which seems to be the perfect measure of contacts with other cars and objects.

yea, IDK why i said HLV, i mean CON and OBH, by actual speed, I meant the speed that the user was going, when he, hit the object :P
Look more closely at the packets - there is a value "Speed" in the CarContact and CarContOBJ structures.
As the previous topic about insim changes is locked ill post it here.
I would like a small change to this

struct IS_AXI // AutoX Info
{
byte Size; // 40
byte Type; // ISP_AXI
byte ReqI; // 0 unless this is a reply to an TINY_AXI request
byte Zero;

byte AXStart; // autocross start position
byte NumCP; // number of checkpoints
word NumO; // number of objects

[B]char LName[32];[/B] // the name of the layout last loaded [B](if loaded locally)[/B]
};

Is it possible to make it so when a remote player loads a layout, we can get the name of it? Because i want to store layout name and use it.
Quote from Scawen :Look more closely at the packets - there is a value "Speed" in the CarContact and CarContOBJ structures.

Oh wow, I didn't even see those *facepalm*
Quote from EQ Worry :PS: I guess the demo/tweaked/private bits of server state did not make it to your intended features list?

These were on my list for a while, but there were a few ways of doing it and I couldn't decide the best way. Some of these flags are stored in different ways. In the end, I came to a point where I couldn't do any more after this 3 months push. I'm tired. Also, in the few days before an official patch I can't take any chances. So... sorry, the flags and demo status are not there for 0.6B.

Quote from EQ Worry :Now I remember a long-existing thing, the "unknown car id" displayed sometimes. I wonder if that could be related to the fact that often cars are send to /spec right after pitting (Shift+P) by InSim apps, e.g. to prevent repeated midrace rejoins from pits. Maybe a small lag would cause some LFS pitting routine to be delayed for so long that when it runs the car is not in the pits anymore, but spectating? Just an idea though.

I thought that was fixed. Though my memory is a bit vague at this point. I thought it was worked out and sorted out. Have you seen that error coming up in any of the recent test patches?
Quote from Scawen :I thought that was fixed. Though my memory is a bit vague at this point. I thought it was worked out and sorted out. Have you seen that error coming up in any of the recent test patches?

I remember happening that too in the recent test patches, I don't know if it depends on the client or host LFS version though.
Quote from Scawen :These were on my list for a while, but there were a few ways of doing it and I couldn't decide the best way. ... I'm tired. So... sorry, the flags and demo status are not there for 0.6B.

Thanks for getting back to the matter. I understand, it was required too late and it's not as easy as it may seem. It would be great though to keep it as a future feature. The tweaked bit could be used to e.g. disable lap time storing (maybe also for LFSW). Demo bit would allow easy detection of demo-compatible host setup, which is now impossible (or at least complicated). One final thing missing is a report of currently allowed cars on host, many people find it strange this important info is not in fact available. Also, reporting things as vote, midrace join, car reset, etc. only on race starts is not ideal, I think, it all should be part of server state info state (with cars, demo, ...), sent on every change. Just my feeling though.

Quote from Scawen :I thought that was fixed. Though my memory is a bit vague at this point. I thought it was worked out and sorted out. Have you seen that error coming up in any of the recent test patches?

I'm afraid I did not have as much time to be on patched servers, also rarely some such server got full enough. Last thing I remember was you mentioning that you're not sure why this message appears. Now I believe it happens only after pitting, when the car is quickly sent to spectate by an InSim. Just a feeling though.

Thanks again for all the InSim updates, some look really promising and some make me (and other server admins, I hope) feel safer. But I'm afraid the real hard test will start only when official patch is out and the current applications are extended to apply the new principles. Problems may appear then, when there are thousands of actions taking place. But so far everything looks good to me.

Final note, thanks for mentioning the split packet problem. (A friend of mine also mentioned the opposite may happen, two LFS InSim packets arriving combined.) While my library handled the 2nd case correctly, the 1st was actually not handled at all. Fortunately the code update was not too complicated, if anyone's interested, I could post the few lines of (supposedly correct) split/joined packet handling C# code here for review/discussion.
Quote from EQ Worry :Fortunately the code update was not too complicated, if anyone's interested, I could post the few lines of (supposedly correct) split/joined packet handling C# code here for review/discussion.

Go ahead And indeed thanks to the devs for all these nice updates
OK, just the packet(s) reading code, merging and splitting them as needed:

byte[] buff = new byte[256]; // number of bytes read stored in bts
int bts = tcp.Receive(buff, 1, SocketFlags.None); // InSim packet length stored in buff[0]
if (bts == 0) { return new byte[0]; } // disconnect
while (buff[0] > bts) // read from TCP until packet length
bts += tcp.Receive(buff, bts, buff[0] - bts, SocketFlags.None); // read only one packet
Array.Resize(ref buff, bts);
return buff;

No guarantees though that this is 100% correct, I may have overlooked something.
I've noticed this also earlier, though there are no doubt exceptions: Posting any code makes the thread die!
Quote from EQ Worry :I've noticed this also earlier, though there are no doubt exceptions: Posting any code makes the thread die!

Everyone is off and busy coding.

Thanks for the code snippet. It's useful boilerplate to hang on to.
Quote from EQ Worry :I've noticed this also earlier, though there are no doubt exceptions: Posting any code makes the thread die!

Sorry, forgot about the thread because I've been quite busy this weekend. Lets check it

I think Scawen wrote something about invalid packet sizes before. Shouldn't they be ignored if not dividable by 4? In my code (which is slightly different) I added this check:


byte[] buff = new byte[256]; // number of bytes read stored in bts
int bts = tcp.Receive(buff, 1, SocketFlags.None); // InSim packet length stored in buff[0]
if (bts == 0) { return new byte[0]; } // disconnect
[COLOR="Red"]if (buff[0] % 4 != 0) { return new byte[0]; } // disconnect (invalid packet size)[/COLOR]
while (buff[0] > bts) // read from TCP until packet length
bts += tcp.Receive(buff, bts, buff[0] - bts, SocketFlags.None); // read only one packet
Array.Resize(ref buff, bts);
return buff;

1

0.6A1 InSim.txt and LYT.txt
(49 posts, started )
FGED GREDG RDFGDR GSFDG