11.01.2010, 19:22
Hi, every body !
I’ve scripted for three month, I have my own server and I have a problem : I have lags when we are more than 20 people.
For instance, when someone write down something and that he send it, everybody around him see what he wrote at once, but the player himself must wait a few seconds before seeing his own message. It often happens when the player get a warning message that says that a car has not been correctly deleted. (I read on your forum that it could come from the trains, but I don’t have any train). I have a function on GameModInit () that create all my vehicles with a AddStaticVehicleEx and with a respawn delay = -1 (I tried others respawn delay and I also used AddStaticVehicle and CreateVehicle).
I also sometimes use DestroyVehicule and CreateVehicule, for instance when we park the cars.
When there are 22/23 players online, the script begin using more and more CPU.
I scripted everything with MySQL to manage my data. I have 7 SetTimer in OnGameModeInit() (1 second, 2 seconds, 5 seconds, 1 minute, 5 minutes, 30 minutes and 60 minutes). In those Timers, we have a “For” loop from 0 to MAX_PLAYERS_CURRENT (MAX_PLAYERS_CURRENT is the last connected ID) and we call some functions that are quite “heavy”. I removed the timers to try to solve my problems, but it doesn’t work. I don’t have a lot of “For” loops.
I also optimized the server's memory and it just uses 200 Mo and it doesn’t change. You also have to now that we use a VPS Debian.
It makes a month that I try to find solutions, but my server is still lagging.
Thanks for reading !
Minimicro
I’ve scripted for three month, I have my own server and I have a problem : I have lags when we are more than 20 people.
For instance, when someone write down something and that he send it, everybody around him see what he wrote at once, but the player himself must wait a few seconds before seeing his own message. It often happens when the player get a warning message that says that a car has not been correctly deleted. (I read on your forum that it could come from the trains, but I don’t have any train). I have a function on GameModInit () that create all my vehicles with a AddStaticVehicleEx and with a respawn delay = -1 (I tried others respawn delay and I also used AddStaticVehicle and CreateVehicle).
I also sometimes use DestroyVehicule and CreateVehicule, for instance when we park the cars.
When there are 22/23 players online, the script begin using more and more CPU.
I scripted everything with MySQL to manage my data. I have 7 SetTimer in OnGameModeInit() (1 second, 2 seconds, 5 seconds, 1 minute, 5 minutes, 30 minutes and 60 minutes). In those Timers, we have a “For” loop from 0 to MAX_PLAYERS_CURRENT (MAX_PLAYERS_CURRENT is the last connected ID) and we call some functions that are quite “heavy”. I removed the timers to try to solve my problems, but it doesn’t work. I don’t have a lot of “For” loops.
I also optimized the server's memory and it just uses 200 Mo and it doesn’t change. You also have to now that we use a VPS Debian.
It makes a month that I try to find solutions, but my server is still lagging.
Thanks for reading !
Minimicro