Just to remove all doubt from my mind, could you explain the logic of your code? As I don't understand it. Here's what I think the logic is:
1: A variable ("X" for example) in the client app equals the number of the "port" on the host computer that the client computer is connected to.
2: The sprite number of the client's player sprite is equal to that variable. ("X")
Is that right? And if it is, does that mean each player connects to a different port on the host computer? How many ports does a computer have?
Yes, right.
Client + Server running on Host computer:
The player opens the client, logs on, and the client checks each port with the server until it gets an open port. When that happens, depending on the port it entered, it is set into the right player category in the system. The character stats are checked and saved in each players' file in the same folder as the server.
The key thing is that all the variables are saved in 1 string. Many times a second, all the client has to do is get one variable which really increases game speed.
Client + Server as Php:
With using php, the client can't track which port, but can look at the data before connecting. So, in Php, make the client look who's online, than insert itself to the player spot after the last person online. After he successfully logs on, it will receive the individual player data from php and use that to load the character. I'm thinking of putting all variables set into one variable so it will run way faster than getting each variable at random times, it will only get one variable.
-Gandolf
Edit: Almost forgot. Each player connects to a different port, and there is a ton of ports. Like 64,000+ .