The online racing simulator
Searching in All forums
(67 results)
elmohellno
S2 licensed
Quote from Dygear :

<?php 
onMCIPacket
() {
    
$MCI $this->parent->packets;
    
$Nmb $this->parent->STA->NumP;
    for (
$m 0$m <= $Nmb$m++) {
        for (
$i 0$i <= $MCI[$m]->NumC$i++) {
            
$return[$MCI[$m]->Info[$i]->PLID] = $MCI[$m]->Info[$i];
        }
    }
    return 
$return;
}
?>

I think that is how I would handle it, but that's just me, and I've not tested the code myself.

I am not sure how the php library is so can't say XD.
Understanding and solving the MCI limits [inc examples in various languages]
elmohellno
S2 licensed
Leechers/Non programmers move on. This isn't a source.


"There is no MCI 8 player limit!"
Read the following code until you get it.
for (int i = 0; i < Players.Count; i++)
{
//Do something with MCI[i]
}

Players is a collection which changes constantly as players join and leave. MCI is an array of 8 elements and always is. So when you have 9 players, you are trying to access the 9th element of MCI which doesn't exist which will give you an MCI exception.

"Ok so lets just change all Players.Count to MCI.NumC"
Well MCI.NumC at max can be 8. So if you have 9 players, that last player wont be updated.

"But it would send 8 and then 1!"

So you would be updating the first players stuff with the 9th players when you get the 1.

"Ok so what do we do?"
I did the simplest thing. I added the CompCar Packet struct to the clsPlayer structure. Here is an example of how I changed MCI.
//CompCar is the CompCar packet structure I added to clsPlayer
int idx = 0;
for (int i = 0; i < MCI.NumC; i++)
{
idx = GetPlyIdx(MCI.Info[i].PLID);
Players[idx].CompCar.AngVel = MCI.Info[i].AngVel; //They aren't structures so you cant serialize!
Players[idx].CompCar.Direction = MCI.Info[i].Direction;
Players[idx].CompCar.Heading = MCI.Info[i].Heading;
Players[idx].CompCar.Info = MCI.Info[i].Info;
Players[idx].CompCar.Lap = MCI.Info[i].Lap;
Players[idx].CompCar.Node = MCI.Info[i].Node;
Players[idx].CompCar.PLID = MCI.Info[i].PLID;
Players[idx].CompCar.Position = MCI.Info[i].Position;
Players[idx].CompCar.Speed = MCI.Info[i].Speed;
Players[idx].CompCar.X = MCI.Info[i].X;
Players[idx].CompCar.Y = MCI.Info[i].Y;
Players[idx].CompCar.Z = MCI.Info[i].Z;
}

So now we always have data for the cars in the clsPlayer structure. Now we can access the cars data anywhere. Unlike before were we could only access the cars data from the MCI thread. Now you can rewrite a lot of code and remove most of the MCI stuff and put it in different spots. No more waiting until MCI is executed to engage a target.

This fixes so many problems.

1. Not being able to access car data anywhere but the MCI thread.
2. Out of bounds error from Players being larger than MCI.
3. Lots more (brain fart)


I am working on this, just this should be enough to get ya started.
elmohellno
S2 licensed
take the username, search through connections till you find it. If you find it send them a message.
elmohellno
S2 licensed
Quote from Mikjen :I seen it on another server as well, but u have to be close together, and someone parks near you, they listen as well


Mick


p.s i need a databse making for me insim

Simple check how close people are before dispatching the message.
elmohellno
S2 licensed
Quote from JasonJ :Doesn't disconnect all inSim applications. Although I don't think ours has a handler for this request. You might have to follow through with this on your inSim Lib programmer. I don't know the packet for this request, I really don't have any clue about inSim. Laugh if you will, but who knows the packet name for this so I can look if we even use it?

"Requested TCP packets for position updates"
2 & 1/2 mins held down.. no disconnect on CLC.

This works on every server. Some servers require more then 1 person doing it. (CLC,WS.C,etc)
elmohellno
S2 licensed
What download is the source included in?
elmohellno
S2 licensed
Quote from Evilvan911 :I guess no ones have found yet the solution to fix this mci-error

I did, just waiting to write up an article. So leechers can't copy and paste.

Shaun, msg to connection uses 3 parameters. Msg to all uses 1.
elmohellno
S2 licensed
Can you add barriers with LFS_External? Or insim for that matter?
Last edited by the_angry_angel, . Reason : Removed redundant commentry as quoted post has been deleted.
elmohellno
S2 licensed
Can playerid be 0? Or is it always non zero?
elmohellno
S2 licensed
You get that error because MCI is 8 elements long no matter what. Player idx(cars on track) can go over 8. So when you have a loop going through Players it hits idx 8 but MCI doesn't have that so you are overflowing.

Quote from Sheepy1977 :I think this should fixed the MCI errors.but I still haven't test it yet.

private void MCI_CarInformation(Packets.IS_MCI MCI)
{
try
{

for (int i = 0; i < MCI.NumC; i++)
{
decimal SpeedMS = (decimal)(((MCI.Info[i].Speed / 32768f) * 100f) / 2);
......

In this section,replace all Players.Count with MIC.NumC.

That is a terrible way to fix it. With that players 1-8 will only be able to engage eachother same with 9-16, 17-24 etc.

because the MCI packet sends a max of 8 players data. So if you have 9 people it send 2 packets. 1 with 8 and another with 1.
elmohellno
S2 licensed
Quote from dougie-lampkin :I haven't found a way yet, but there is a way, CCC had it

I guess I will look at the flags.
elmohellno
S2 licensed
Quote from dougie-lampkin :I haven't heard of this problem, car taking over is still as LFS_External default in this project...

if you rent more then 1 car, the last person to rent will be effected by everyone that rented before (Fined, money,etc).


lol I rewrote your whole example dougie.

It goes a lot faster if you don't stick 1000 things in MCI receive :P.

I think I'll post an example of how I rewrote the command system in this section later. Anyone interested? It makes it a lot easier to add more commands and keep them organized.
Last edited by elmohellno, .
elmohellno
S2 licensed
Does the playerid change when they take over a vehicle?
elmohellno
S2 licensed
my friend tried it on mutliple servers and it worked for him. Helps if you have more people doing it too. Its basically a dos.
Dedi server exploit [possible bug]
elmohellno
S2 licensed
If a user holds down Ctrl+T for a min or so it will disconnect insim.
elmohellno
S2 licensed
If you hold Ctrl+T for a minute it disconnects the insim from the server. Can you fix this?
elmohellno
S2 licensed
Quote from dougie-lampkin :Switching to MySQL won't have any effect at all. The only time files are touched is when someone joins the server or leaves the server. They are also backed up every 5 minutes, but again, that's no problem. They're not the problem, it's the MCI array. I did have a look, but it didn't crash for me when I joined a local host 10 times. If it doesn't crash, I can't see what's wrong

Try removing the try-catch statement, and run the app in debug mode. That'll highlight what line it's stopping at.

Well here let me clarify what he was saying.

I switched to MySql just because it is easier to handle then flat files. Also I was getting annoyed that when a person have no cars it doesn't add them to Connections. (Causing many many problems with collisions from a person ingame not being in Connections)

Now there is a 8 Players limit (not connections).

What happens is when you have 9+ people on the track. you have a line like this

for (int i = 0; i < Players.Count; i++)

loop through MCI 9+ times when it itself has only 8 elements. giving you an index out of bounds of array error.

I fixed this by completely rewriting how you handle MCI. (Also my rewrite makes it run faster :P).
FGED GREDG RDFGDR GSFDG