|
![]() |
|
Thread Tools | Display Modes |
![]() |
#1 |
Banned
![]() Join Date: Jul 2012
Location: Germany
Posts: 1,225
Reputation: 234
|
![]()
Hello,
So, i have a Log script, it offers you to log each players location every X seconds. When a player spawns it sets a timer that will log the location of the player and repeat that until he dies or disconnects. I have been wondering what the differences in memory usage and overall performance are if i would use a global timer that loops through all players.Is anyone able to share his/her knowledge, would be great to know. And if anyone wonders why i don't test it myself, i can't, because i ain't got no players to test it with D: greetings Marcel |
![]() |
![]() |
![]() |
#2 |
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Nov 2009
Location: Greece,Athens
Posts: 1,682
Reputation: 362
|
![]()
Per player timer will be created at your will which means it will be created at login/register(?) and killed at disconnect(?). A global timer will have to do a check to see if there is any player online and then if he is not dead and if he is registered/logged(?) so it really use any performance data already to make checking.( not really extreme waste but whatever). I may be wrong.
|
![]() |
![]() |
![]() |
#3 |
Banned
![]() Join Date: Jul 2012
Location: Germany
Posts: 1,225
Reputation: 234
|
![]()
Yeah that is right, but i was wondering how much just the running of the timer matters, let us say there is 1000 player timers running, doesn't that affect the server (ast least the memory consumption??)?
|
![]() |
![]() |
![]() |
#4 |
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Nov 2009
Location: Greece,Athens
Posts: 1,682
Reputation: 362
|
![]()
It doesn't really depends on how many timers you have but how often you use it I mean if you have 1000 timers that are used every 1 second then good luck.BOOM.
|
![]() |
![]() |
![]() |
#5 |
Banned
![]() Join Date: Jul 2012
Location: Germany
Posts: 1,225
Reputation: 234
|
![]()
Well, that's exactly why i am worried
|
![]() |
![]() |
![]() |
#6 |
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Nov 2009
Location: Greece,Athens
Posts: 1,682
Reputation: 362
|
![]()
Also do not forget that if you make a global timer it MUST be killed when server closes until next restart. So imagine already how much damage you can done with one global timer that checks every 2 seconds without any reason(no player online?/everyone is dead?/no one registered-logged?). At least per player will be killed everytime player disconnects so its more efficient.
|
![]() |
![]() |
![]() |
#7 |
Banned
![]() Join Date: Jul 2012
Location: Germany
Posts: 1,225
Reputation: 234
|
![]()
I don't really get what you mean, the tiemr doesn't live longer than the server does, ofcause.
And running isn't really a problem, because if there is no players anyways, no one will need the servers power. But what actually might be an interesting idea, is switching from per player timers to a global timer when a certain amount of online players ahs been reached, so i could balance it. |
![]() |
![]() |
![]() |
#8 | |
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Nov 2009
Location: Greece,Athens
Posts: 1,682
Reputation: 362
|
![]() Quote:
|
|
![]() |
![]() |
![]() |
#9 |
Banned
![]() Join Date: Jul 2012
Location: Germany
Posts: 1,225
Reputation: 234
|
![]()
Pretty easy, no timer needed
PHP Code:
![]() |
![]() |
![]() |
![]() |
#10 | |
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Nov 2009
Location: Greece,Athens
Posts: 1,682
Reputation: 362
|
![]() Quote:
Global timer will take time to execute FOR ALL PLAYERS and it night cause sync problem. Per player timers are smaller chopped timers so it will reduce sync problems. However, there are more posts like yours on forums and you should check them Apologizing for writing in a hurry but I am from phone. Hope I helped cheers. |
|
![]() |
![]() |
![]() |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Which is better Per Player Timer or Global timer? (issue with timer) | Dokins | Scripting Help | 4 | 07/06/2016 10:50 AM |
Question about timer for a player. | Stoyanov | Scripting Help | 2 | 23/09/2015 08:26 PM |
Timer i all players to one player? | Admigo | Scripting Help | 7 | 25/08/2012 11:03 PM |
timer for all players? | Evation | Scripting Help | 4 | 30/05/2012 04:01 AM |
A timer that loops through all players or a timer for each player? | x-cutter | Help Archive | 2 | 28/05/2011 04:35 PM |