The online racing simulator
Need help, big problem with InSim
1
(27 posts, started )
#1 - KuHS
Need help, big problem with InSim
Hello i'm using LFS External lib, and i have one really really big problem. Ok, then player connects it's everything ok, then is ~+9 players in the server then appears a lot of problems, no errors is giving, just, you drive atm XFG, you drive 1-2 metres and your cash and licence points is resetting to zero or just then you connected to it... Idk what's the problem the InSim gives no error, just problem with players, btw in my server there's a lot of stuff, like bank, shop, energy, maiby that? And i'm added CompCar to my code, i think it's the problem, but anyways, then in the server is 1-5 people everything is ok, nothing disappears. Anybody knows how to fix this problem?
Quote from KuHS :Hello i'm using LFS External lib, and i have one really really big problem. Ok, then player connects it's everything ok, then is ~+9 players in the server then appears a lot of problems, no errors is giving, just, you drive atm XFG, you drive 1-2 metres and your cash and licence points is resetting to zero or just then you connected to it... Idk what's the problem the InSim gives no error, just problem with players, btw in my server there's a lot of stuff, like bank, shop, energy, maiby that? And i'm added CompCar to my code, i think it's the problem, but anyways, then in the server is 1-5 people everything is ok, nothing disappears. Anybody knows how to fix this problem?

looks like the compcar might have an error
#3 - amp88
Each MCI packet can contain information for a maximum of 8 players. If you have 9 players it takes two MCI packets to give you all of their information. If you've got something in your code which needs every player in the server to appear in every MCI packet then this will be what's causing your problem.

Quote from LFS/docs/InSim.txt :struct IS_MCI // Multi Car Info - if more than 8 in race then more than one of these is sent
{
byte Size; // 4 + NumC * 28
byte Type; // ISP_MCI
byte ReqI; // 0 unless this is a reply to an TINY_MCI request
byte NumC; // number of valid CompCar structs in this packet

CompCar Info[8]; // car info for each player, 1 to 8 of these (NumC)
};

#4 - KuHS
How InSim would send 2 or more MCI packets? Thanks for explaining.
Quote from KuHS :How InSim would send 2 or more MCI packets? Thanks for explaining.

It would send 1 MCI packet containing a compcar with the first 8 players, and then a second MCI packet with a compcar containing 1 player. You use "NumC" to determine how many are in each.

Or have I misunderstood your question?
#6 - KuHS
Quote from the_angry_angel :It would send 1 MCI packet containing a compcar with the first 8 players, and then a second MCI packet with a compcar containing 1 player. You use "NumC" to determine how many are in each.

Or have I misunderstood your question?

Ok but then i get players num, how i can send them more packets? And how much packets will need for 14 players? 5, if players num +8 and for others 1 players will send 1 packet?
With 14 players it would send one MCI with the first 8 players, then a second MCI with the next 6. For 21 players it would send one MCI with the first 8, a second with the next 8, and then a final one with the last 5.

You can get a better idea for how it works by using InSimSniffer (see sig). Connect to a host and then do Request > TINY_MCI.
#8 - KuHS
Quote from DarkTimes :With 14 players it would send one MCI with the first 8 players, then a second MCI with the next 6. For 21 players it would send one MCI with the first 8, a second with the next 8, and then a final one with the last 5.

You can get a better idea for how it works by using InSimSniffer (see sig). Connect to a host and then do Request > TINY_MCI.

Ok thanks, but anyways, how i can request more packets? Sorry, but i don't know, i just need a line of code, like example, thanks for helping but at last i need to know how it would be in C# ://
Quote from KuHS :Ok thanks, but anyways, how i can request more packets?

You don't need to request more MCI packets, it will automatically send as many as needed. You just need to modify your MCI handling code, thats all
#10 - KuHS
Quote from the_angry_angel :You don't need to request more MCI packets, it will automatically send as many as needed. You just need to modify your MCI handling code, thats all

Ok, i've got it, but what i would modify?
Quote from KuHS :Ok, i've got it, but what i would modify?

Your MCI handling code.
#12 - KuHS
// Detailed car information packet (max 8 per packet)
private void MCI_CarInformation(Packets.IS_MCI MCI)
{
int idx = 0;
for (int i = 0; i < Connections.Count; i++)
{
idx = GetConnIdx2(MCI.Info[i].PLID);
Connections[idx].CompCar.AngVel = MCI.Info[i].AngVel; //They aren't structures so you cant serialize!
Connections[idx].CompCar.Direction = MCI.Info[i].Direction;
Connections[idx].CompCar.Heading = MCI.Info[i].Heading;
Connections[idx].CompCar.Info = MCI.Info[i].Info;
Connections[idx].CompCar.Lap = MCI.Info[i].Lap;
Connections[idx].CompCar.Node = MCI.Info[i].Node;
Connections[idx].CompCar.PLID = MCI.Info[i].PLID;
Connections[idx].CompCar.Position = MCI.Info[i].Position;
Connections[idx].CompCar.Speed = MCI.Info[i].Speed;
Connections[idx].CompCar.X = MCI.Info[i].X;
Connections[idx].CompCar.Y = MCI.Info[i].Y;
Connections[idx].CompCar.Z = MCI.Info[i].Z;
MCI_Update(MCI.Info[i].PLID); //We want everyone to update before checking them.
}
}

This is my MCI packet code, any idea what's wrong and how to fix it?
Quote from KuHS :
// Detailed car information packet (max 8 per packet)
private void MCI_CarInformation(Packets.IS_MCI MCI)
{
int idx = 0;
for (int i = 0; i < Connections.Count; i++)
{


This is where it goes wrong, the MCI only holds up to 8 packets, but the loop runs up to the number of connections. Should be
for (int i = 0; i < MCI.NumC; i++)

instead
#14 - KIMA
Mistake
Hi all I have such problemma an error.
Here is a picture
MCI Index nohoditsya outside the boarders of the array.
Quote from KIMA :MCI Index ((???)) outside the bounds of the array.

that's a coding error.
#16 - KIMA
There are a MAXIMUM of 8 players in each MCI packet. If your code can only handle there being EXACTLY 8 players but the packet contains information for only 5 players then when your code looks for the 6th player it will not be able to find it (it will go off the end of the array) and cause an error. The solution is to look at the value for NumC in the MCI packet. NumC tells you how many players are in this packet (e.g. if NumC is 4 then you need to look for only 4 players in this packet, not 8).
To KIMA: Привет! Компилятор, который ты используешь, показывает строку, на которой находится эта ошибка?
#19 - KIMA
Quote from shadowww :to kima: Привет! Компилятор, который ты используешь, показывает строку, на которой находится эта ошибка?

А если ты шариш может поможеш мне,а то уже кругом голова.
If the problem is to do with an invalid index of an array (e.g. trying to index the 4th location on an array of size 3) then it is a runtime exception, not an error in the syntax or semantics of the code which can be determined at compile time.

KIMA, please look here.
Quote from shadowww :to kima: Привет! Компилятор, который ты используешь, показывает строку, на которой находится эта ошибка?

Нет не показывает, оно выбивает окно когда на сервер заходит человек 12, можиш нам помочь???
#22 - KIMA
Quote from amp88 :If the problem is to do with an invalid index of an array (e.g. trying to index the 4th location on an array of size 3) then it is a runtime exception, not an error in the syntax or semantics of the code which can be determined at compile time.

KIMA, please look here.

No no-shows, it knocks out the window when the server comes to a man 12, mozhish You Help?
Quote from KIMA :No no-shows, it knocks out the window when the server comes to a man 12, mozhish You Help?

Post your code.
Quote from KIMA :No no-shows, it knocks out the window when the server comes to a man 12, mozhish You Help?

Please, don't use Google Translate. I would suggest you PROMT instead.
#25 - KIMA
Quote from Shadowww :Please, don't use Google Translate. I would suggest you PROMT instead.

And if you Šariš can help me, but it is already around the head.
1

FGED GREDG RDFGDR GSFDG