The online racing simulator
#326 - gru
Quote from gru :read this thread
http://www.lfsforum.net/showthread.php?t=43933

also check MCI handler in modded version
http://www.lfsforum.net/showthread.php?t=47913

basicly U have to loop through MCI.Info array instead of Players list
BTW U dont really need clsPlayer class, it only makes code more complicated.
check modded version (link 2), it stores all info in clsConnection

It doesn't make it more complicated, it makes it more readable and easier to get information about a player's car at any point of your work, instead of setting a var, which then you have to check in MCI thread, etc...

But it still isn't something you need to fix the MCI handler.
can someone add in this server login/register system?
Quote from stickylfs :Does anyone knows how to fix the limited 8 player? I want to more people join

By coding your own cruise system.

#332 - gru
Quote from broken :It doesn't make it more complicated, it makes it more readable and easier to get information about a player's car at any point of your work

im not so sure about it. loop through connections list inside of player list loop is not readable and easier IMO
i prefer to store PLID in clsConnection and get whole player object with one method instead of looking for it in 2 lists

Quote from broken :...instead of setting a var, which then you have to check in MCI thread, etc...

sure, of course its better to save speed and position on MCI event so U can have it in any point of code, i just dont see advances
in storing this info in 2 classes
why my changes doesn't work. i use Microsoft Visual Studio 2008.
Quote from Bose321 :That's not a question, but the answer is : Do some tutorials.


I don't see any tutorial of How to fix the 8 player limit for Non-Coders.

-----------------------> Better if we stop writing like this..
Quote from stickylfs :I don't see any tutorial of How to fix the 8 player limit for Non-Coders.

-----------------------> Better if we stop writing like this..

You do have tutorial how to become coder tho.

Quote from gru :im not so sure about it. loop through connections list inside of player list loop is not readable and easier IMO
i prefer to store PLID in clsConnection and get whole player object with one method instead of looking for it in 2 lists


sure, of course its better to save speed and position on MCI event so U can have it in any point of code, i just dont see advances
in storing this info in 2 classes

Then why don't you build a method to get a connection id by PLID, and a Player id by UCID? That's quite simple to code.

Or if you're lazier you can just make a function to convert a clsConnection to clsPlayer and the opposite(that means like 5 lines of code at max).
Quote from stickylfs :I don't see any tutorial of How to fix the 8 player limit for Non-Coders.

-----------------------> Better if we stop writing like this..

In Visual Studio find //Detailed car information

in there will be a code like for (int blah blah Player.Count)

change the Players.Count into MCI.NumC and also do the same for the tracks (find like AS5 and where it says Players.Count put MCI.NumC into there)
Quote from PoVo :In Visual Studio find //Detailed car information

in there will be a code like for (int blah blah Player.Count)

change the Players.Count into MCI.NumC and also do the same for the tracks (find like AS5 and where it says Players.Count put MCI.NumC into there)

There are 2 things with //Detailed car information :

[COLOR=YellowGreen]// Detailed car information packet (max 8 per packet)[/COLOR]
private void MCI_CarInformation(Packets.IS_MCI MCI)
{
try

And

InSim.MCI_Received += new LFS_External.InSim.InSimInterface.MCI_EventHandler(MCI_CarInformation); [COLOR=YellowGreen]// Detailed car information packet (max 8 per packet)[/COLOR]

EDIT: Nevermind I found.. Ill test thanks!
#341 - gru
Quote from broken :Then why don't you build a method to get a connection id by PLID, and a Player id by UCID? That's quite simple to code.
Or if you're lazier you can just make a function to convert a clsConnection to clsPlayer and the opposite(that means like 5 lines of code at max).

cause thats more operations program has to make
1. loop through Players list to get UCID
2. loop through Connections list to get clsConnection object

if U store PLID in clsConnection U can skip step 1 (and remember that U have to handle MCI event few times per second)
ok, U have powerful PC, it will do job anyway, but still

also tell me, how many times U use only clsPlayer?
i bet in most cases U use clsConnection also, so isnt it better to have only one class representing player?
gru, there can be up to 20 players (= 20 PLIDs) per connection, although limited to 3 in multiplayer mode, it still has to be considered in host-side InSim applications such as a cruise app. Even if you spectate AIs upon receiving the NPL, it'll still send a couple of CompCars for that player, depending on your NLI.

But you're still right, it's a better approach to store the PLIDs of a connection within the same structure as the connection itself because all it takes is 1 to 20 additional bytes of RAM per connection, which is nothing.

You don't have to loop through the players list to obtain the associated UCID though, that's part of the NPL.
#343 - gru
You're right, i forgot about AIs, but this system doesn't support it, one PLID per connection
Quote from gru :cause thats more operations program has to make
1. loop through Players list to get UCID
2. loop through Connections list to get clsConnection object

if U store PLID in clsConnection U can skip step 1 (and remember that U have to handle MCI event few times per second)
ok, U have powerful PC, it will do job anyway, but still

also tell me, how many times U use only clsPlayer?
i bet in most cases U use clsConnection also, so isnt it better to have only one class representing player?

That's one of the things I said - get connection id by PLID (for which you will need to store the PLID in the connection, which is also just 1min of editing), and then I said that if you're lazy you can just waste a 1 or 2 more additional operations, which won't really slow down your PC at all. My PC is not powerful at all, and it still handles my almost 1mb application.

E: Tbh, I'm not sure that I understand you fully.

E2: Take a look at this code and tell me how will it slow down your PC..
[COLOR="Blue"]namespace[/COLOR] myApplication
{
[COLOR="Blue"]class[/COLOR] [COLOR="DeepSkyBlue"]misc[/COLOR]
{
[COLOR="Blue"]static public[/COLOR] [COLOR="DeepSkyBlue"]clsPlayer[/COLOR] convertToPlayer([COLOR="DeepSkyBlue"]clsConnection[/COLOR] C)
{
[COLOR="Blue"]for[/COLOR] ([COLOR="Blue"]int[/COLOR] i = 0; i < [COLOR="DeepSkyBlue"]Form1[/COLOR].Players.Count; i++)
{
[COLOR="Blue"]if[/COLOR] ([COLOR="DeepSkyBlue"]Form1[/COLOR].Players[i].UniqueID == C.UniqueID)
{
[COLOR="Blue"]return[/COLOR] Form1.Players[i];
}
}
[COLOR="Blue"]return null[/COLOR];
}
}
}

#345 - gru
ok, lets stop argueing, U use clsPlayer, fine, i joined it with clsConnection, fine too
broken, your implementation loops through the Players, potentially iterating times the number of players - 1, while gru's implementation requires no such computational effort at all. gru's version is faster at the expense of a few bytes of RAM, yours uses less RAM at the expense of a couple of CPU cycles. You won't be able to tell the difference in execution speed, but gru's version is the more efficient one.
Quote from gru :ok, lets stop argueing, U use clsPlayer, fine, i joined it with clsConnection, fine too

Why didn't you say that earlier, lol... Now I see what you mean...

@morpha: Define more efficient.
It's true that we can argue like this forever lol, but let me ask a simple question: How could it be more efficient when it's just making the list bigger.
Example: My clsConnection list has too much variables, and I can't imagine it having player information in it too. It's going to be a pain to read. Also when I need to go through all players I wouldn't need to check a variable if they have left the pits or not, because I wouldn't even have to deal with the ones spectating.

I don't say that my method is more efficient, but I don't think that there is any place for the word efficiency in here anyway... True, he doesn't have 2 lists to worry about, but I have less variables when I need to deal with something.

Depends on what suits you better really..

Just my opinion.
Yes, and what a problem in it?

FGED GREDG RDFGDR GSFDG