02.01.2012, 19:25
hm..
*90 players
*25 FPS
= OnPlayerUpdate called 2250 times.
send the textdraw a) in a timer called once a second, and b) using TextDrawShowForAll() instead of sending the same stuff to each player individually (the calculation is done far to often. intead of 1, its calculated 2250 times). it wont make a difference to the network bandwidth usage, but it saves you some CPU usag.
oh, use the Profiler to find out which callback uses the most CPU time. then you know what to optimize.
pawn Code:
public OnPlayerUpdate(playerid)
{
new strings[15];
format(strings, 15, "%d/100",GetOnLinePlayers());
TextDrawSetString(players, strings);
TextDrawShowForPlayer(playerid, players);
return 1;
}
*25 FPS
= OnPlayerUpdate called 2250 times.
send the textdraw a) in a timer called once a second, and b) using TextDrawShowForAll() instead of sending the same stuff to each player individually (the calculation is done far to often. intead of 1, its calculated 2250 times). it wont make a difference to the network bandwidth usage, but it saves you some CPU usag.
oh, use the Profiler to find out which callback uses the most CPU time. then you know what to optimize.