SA-MP Forums Archive
Multiple timers vs Global timer - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Multiple timers vs Global timer (/showthread.php?tid=643513)



Multiple timers vs Global timer - Dayrion - 21.10.2017

Heello. Before begin, I know there is a lot of topic but I still mixed.

From what I could read and conclude from this is, it's better to have less code but more timers than less timers and more code. On the other hand, I saw answers that argued that too many timers make lag the server and therefore preferred to have fewer timers and more code. I read a lot of answers also that said it depends only on the code and therefore a mix of the two proposals.

What do you think about this crucial question?


Re: Multiple timers vs Global timer - StrikerZ - 21.10.2017

Already asked by me few days ago, the thread contains correct answer
https://sampforum.blast.hk/showthread.php?tid=642611


Re: Multiple timers vs Global timer - TheRohlikar - 21.10.2017

I don't think there is a clear cut answer, which would make us happy. You have to look at this issue from different points of view - like script/gmode you have, system you are working on (=in the code).

I, personally, prefer to have more timers. When you have just "a few of them", you have to be hundred percent sure, that everything in these timers won't get stuck. I believe myself, that I could do good job, but what about server? What about bugs, which can ruin the whole timer or even shut down the server.

Of course more timers can do the same, but you can easily make it "bug-proof", so the timer will kill itself and not the whole server.

Hope you understand my thought.

EDIT: Reading the thread on top, I am changing my mind


Re: Multiple timers vs Global timer - Dayrion - 21.10.2017

Quote:
Originally Posted by Sunehildeep
Посмотреть сообщение
Already asked by me few days ago, the thread contains correct answer
https://sampforum.blast.hk/showthread.php?tid=642611
Your "correct" response is a global timer. ******'s answer is multiple timers.

Quote:
Originally Posted by TheRohlikar
Посмотреть сообщение
I don't think there is a clear cut answer, which would make us happy. You have to look at this issue from different points of view - like script/gmode you have, system you are working on (=in the code).

I, personally, prefer to have more timers. When you have just "a few of them", you have to be hundred percent sure, that everything in these timers won't get stuck. I believe myself, that I could do good job, but what about server? What about bugs, which can ruin the whole timer or even shut down the server.

Of course more timers can do the same, but you can easily make it "bug-proof", so the timer will kill itself and not the whole server.

Hope you understand my thought.

EDIT: Reading the thread on top, I am changing my mind
I understand and have the same logic but a global timer is easy to manage too in case of bug. But yea, I prefer the idea of single timer for every things.
Quote:
Originally Posted by RIDE2DAY
Посмотреть сообщение
Check this out: https://sampforum.blast.hk/showthread.php?tid=641559

Generally, the timer doesn't care but what you put inside it does.
That what ****** and some people said. Less code with multiple timers looks better than more code in less timers.


Re: Multiple timers vs Global timer - Pottus - 21.10.2017

Well, if you are making a zombie system it is good to have a timer for each zombie that way they don't all update at the same time it looks better when they update at random intervals.

It depends on the situation really.