Unless the engineering process and destruction process for the Prius is majorly different to that of a "normal" car, then the fact the the Prius gives out a fraction of the emmisions of the "normal" car, then it must gain something. Even though in the bigger picture this is not as much as if you just take the emissions of the car running into account.
Plus, how do we know that something else the Prius is doing (emmitting, causing, anything really) is not damaging something else that we have not measured or even know about yet. If we all moved NOW to a Prius, we may find that all those hybrid cars cause something else to break somewhere in the environment. (I don't know what, but you know what I mean).
Also remember, that LFS can send more than 1 LFS packet in an actual packet. For example, you may receive 40 bytes, but byte(0) = 20. This means the rest of the packet is another (or more) seperate LFS packet (or packets), so byte(20) could = 4 and those 4 bytes are and IS_TINY for something else.
There is also the really horrid version where you don't get enough data in the actual packet. I have had this 3 times in all the time I have been playing with InSim v4 and I have yet to write the code to deal with it.
Basically, you would get 13 bytes actual, and byte(0) = 20. This means you have to wait for the next receive event to fire and add the first 7 bytes onto the end of the last set of bytes, and then deal with the next lot.
I haven't worked out yet where I want to save the first lot and I haven't yet worked out how to test it. As I say, it has happened to me 3 times now so I know it is possible, but I program by trial and error and with it only happening every so often, debugging and getting it working would take ages. So I haven't bothered yet. But I will..... soon...
No, the very first byte is the length of the LFS packet and the second is the LFS packet type.
So if you receive (physically) 20 bytes, and byte(0) = 20, then you know you have the full packet. Then you check byte(1) to see what type of LFS packet it is. In this case it should be 2 as that equals ISP_VER.
Edit: also remember LFS is sending you (and expecting from you) bytes, so an integer is broken down into 4 bytes which you have to convert to a type that VB knows how to deal with. Characters are easy because they are just 1 byte anyway and that corresponds to their ASCII value. ie 97 = a. This is why working with a string is not the best way, but it does work in places.
If it is, then I don't think you are best working with the bytes in a string like that. This is my DataArrival routine:
Private Sub myWinsock_DataArrival(ByVal bytestotal As Long) ReDim bytFull(bytestotal) As Byte
myWinsock.GetData bytFull Call checkdatain(bytFull) End Sub
The checkdatain routine checks to make sure the right number of bytes has been received and if not splits it up into "LFS packets" or saves it and waits for more to be recieved. That last bit of code I posted is part of a "processpacket" routine which is called by checkdatain when it gets a full and complete LFS packet. The "processpacket" routine is just basically a big CASE statement which checks the second byte to see which LFS packet it is.
Its just a list control that I use instead of a ListBox, however recently I have been favouring the ListView anyway. Just imagine it is a list.
OK, start at the beginning then, this is how I decode the response to the InSim ISP_VER:
Firstly, I assume you have the packet recieved and fully checked to ensure you have a full "LFS packet". So you will have an array of bytes with a length of 20 bytes. So byte 0 = 20, byte 1 = 2.
To get LFS version and product use this
Dim txtstring As String
For loopy = 4 To 17 If packetin(loopy) <> 0 Then txtstring = txtstring + Chr(packetin(loopy)) End If Next
I also don't like using the libraries because that means there is a part of the code which I did not write and therefore don't fully understand. To this end, I stripped one library (edit: remembered, it was this one) down and I now manually decode and encode my packets. I know it is not the best programming practice, but I understand the code and, imho, it is easy to understand.
Here is how I encode a simple packet (this is a IS_REO packet that I send to LFS. akgrid is a 3rd party list control):
Dim bytData(0 To 35) As Byte Dim loopy As Long For loopy = 0 To 35 bytData(loopy) = 0 Next
bytData(0) = 36 bytData(1) = 36 bytData(2) = 0 bytData(3) = akGrid2.Rows For loopy = 1 To akGrid2.Rows bytData(loopy + 3) = Val(akGrid2.TextMatrix(loopy, 4)) Next myWinsock.SendData (bytData)
The main issue with decoding the packets is in converting the bytes to VB6 types. I don't have them all yet, because I don't use some, but is there anything inparticular you are after. I could post the code I use.
Otherwise, do like I did and get a library and work out how it works so you can do it yourself without the library.
Just tested and when "Voluntary added mass" = 0 kg the "Added mass position (front)" is greyed out and it makes no difference to the cars weight distribution when you move it.
This was tested offline. Maybe when online a server can force the mass and you do not see it. I can't test this 'cos my server is off.
I noticed this bug at our last league race (OLFSL 3 by 500servers - 19:26, 03 Jun 2007 - Fernbay Rallycrss Rev - 35 laps). During the race, I left and decided to watch the race in the Progress window. But it was very strange. There were about 15 in the race, only 3 were shown with positions, 1 was spectating (which he was) and the rest were all showing as "in pits".
Also, during the race, the positions of the three racers that had positions shown moved randomly all over the place.
I took screenshots as different times during the race (one on lap 16 and one on lap 18) and they are attached.
The race server was on Patch W at the time (with no test patches).
I know, don't worry I am just testing at the moment. And even when this is complete I do not intend releasing it to the masses - only a select few
This is the type of thing I need! I am not, by any means, an expert programmer. I know what I need to do when I get less data than I need - wait for some more and then add on the bits I am missing. BUT I can guarantee that it will not work if I code it and just wait for it to happen. I need to test it and make sure, and I can only do that when it happens.
I will try this, because the one thing I am so far unable to do is find out and change how big the receive buffer is. If I can do this, then I can test it and then I will know I am covered when it occurs.
Thanks, and yes that is exactly what I do. I have the routine that receives data from the TCP stream which passes the array of bytes received to a routine which checks the first byte ("size") and then checks it against the size of bytes received on the stream.
As you know, there are three possiblities:
1. The size received matches the size of the LFS packet. I then pass the data to the process routine. The process routine only knows how to deal with full and complete LFS packets.
2. The size received is greater than the size of the LFS packet. In this case, I pass the first LFS packet to the process routine and then re-process the rest of the actual data received.
3. The size received is less than the size of the LFS packet. In this case I know that I need to wait for more data and then add it to the end, and then process it. I have as yet, never encountered this case. All I have here is a message box waiting to pop up and say "Not enough data received".
Last night, I connected to a very full server, which had about 23 people connected and people joining and leaving and talking and pitting and racing and everything. Now, apart from my PC having some issues and my application not being able to keep up with where everybody was (but I know this is a limitation of what I have coded) then I never saw case 3 as described above.
I then connected to another server with about 7 racers and I got the same results again.
Like I say, I do not deny that this is not possible, I am just saying that I would have expected to have seen it by now with the amount of testing I have done.
I have been using the new insim over TCP/IP for quite some time now, including connecting to a local guest, a local host and a remote host over the internet and have yet to experience the "not receiving enough data" and have never yet had to buffer the received data and wait for some more to finish the LFS Packet.
Now, I am using VB6 with its standard WinSock control and it fires a routine called _DataArrival when data is received from the TCP socket. I do not know if this function somehow compensates for the fact that TCP can break up the initial "packet".
Getting a few LFS packets in altogether happens all the time and I have been able to accomodate this (as I had it happening and could test and debug it until it worked). However, with the split packet, I have never had it so I have not worked how what to do with it. I am of course looking for it and I just have a message box which will pop up the first time it happens!
Don't get me wrong, I fully understand the reasons that it can and will happen, I just wonder if VB6 compensates already.
I think I may have found a bug in InSim. I have a program which can talk to InSim and the first thing it does with received packets is check the amount of bytes received against byte 0 and byte 1 (using a lookup table) to ensure it has received enough or not.
This works fine everywhere apart from one place - when I start a multiplayer replay. I haven't tried it with a single player replay yet as I have been scratching my head hard to make sure I am not missing anything obvious (apologies again, if I have )
When I start a multiplayer replay I get a packet which is 40 bytes long (0 to 39) and the first two bytes are as follows:
byte(0) = 40
byte(1) = 10
The rest of the bytes from 2 to 39 are all = 0.
Now, this packet seems to be an ISP_ISM, but this should be 8 bytes in size, so I expect byte(0) to be 8 not 40. I can't see any LFS packets that are 40 bytes and there is nothing in the rest of the packet which gives me any clue as to what it is.
Can anyone else confirm this before Scawen takes a look? I am using W29.
AI dont have UCIDs so when the the connection that created them leaves, I would expect the AI to leave also. I can not confirm this at this moment, but I am fairly sure this will happen.
struct IS_RES // RESult (qualify or confirmed finish) { byte Size; // 84 byte Type; // [COLOR=red]ISP_PFL[/COLOR] byte ReqI; // 0 byte PLID; // player's unique id (0 = player left before result was sent)
byte Type should have ISP_RES not ISP_PFL as the comment.
Phew, I am glad you understand my reasons for re-posting.
The reason I ask for this is because I am writing a race control app which will be used for the hosts that watch and manage league races. By the term "host" I mean a guest connecting to the server with admin rights who then just spectates the entire race and ensures that rules etc are followed. In our league, the "hosts" are not hosts in the LFS sense of the word, they are guests who log on with admin rights. (I hope this makes sense so far).
Currently, re-ordering a race to start in the correct order is done by everyone joining in the correct order. The IS_REO function would simplify this immensly and streamline the hosting process.
I would be perfectly happy for an admin to be able to re-order the race, but I can see that there could be issues if there were multiple admins all trying to re-order the race at the same time. Perhaps only the first admin to connect could do the re-ordering or the admin with the lowest UCID only.
If not, then I will have to get the hosts to know the IP address of the server they are "hosting" and connect as the proper host.
I think that is enough uses of the word host now!
Can anyone else think of any issues this may cause?