What's The Standard Timer System Nowadays?

Discussion in 'JASS Zone' started by WolfieeifloW, Jun 14, 2011.

  1. WolfieeifloW

    WolfieeifloW WEHZ Helper

    Ratings:
    +372 / 0 / -0
    Hey there TH.net!
    I've finally broken down, and am going to re-learn timers.

    My current task, which is why I require a timer, is something like this:
    A passive spell, where when the hero attacks, it has a chance to increase Strength for a short period.
    Since there's no easy way of doing this with a spell, I've decided to just trigger it.

    Now, my question.
    What timer is the most efficient, while being quite user-friendly.

    I remember back when I used to code a lot, I used TimerUtils.
    But, as you probably know, now everyone and their mother wants to release their timer system.
    So I'm just wondering what timer system is the standard nowadays?
     
  2. luorax

    luorax Invasion in Duskwood

    Ratings:
    +67 / 0 / -0
    Well, I think TimerUtils is still efficient enough and user-friendly. I'd suggest you to use it.
     
  3. emjlr3

    emjlr3 Change can be a good thing Staff Member

    Ratings:
    +396 / 0 / -0
    T32 is as fast as it gets, but has more limitations and will require more specific coding practices to use. If you're map gets really big it will eventually suffer from the op-limit

    TimerUtils is user friendly and slower

    A few more exist, but most, aside from TimerUtils, share the same limitations and burden of use as T32, so they aren't really worth mentioning

    At the end of the day it really only matters which you want to use. They are all fast enough, given GCP (good coding practices).

    People will argue that T32 is plenty user friendly, and it really is, with a few concessions, but nothing is easier then TimerUtils.

    For longer intervals I use TimerUtils. For periodic intervals I tend to just use a struct stack and a timer/spell. While a marginally slower approach then T32 when multiple spells are running simultaneously, its more universally acceptable and cuts down on code bloat.

    This could very well turn into a large system debate, once Nestherus and Bribe show up, but I don't think you can really argue much with the aforementioned.
     
  4. tommerbob

    tommerbob Minecraft. :D

    Ratings:
    +110 / 0 / -0
    I'm definitely no expert, but I like TimerUtils. It's simple, easy-to-use, and gets the job done.
     
  5. Solmyr

    Solmyr Active Member

    Ratings:
    +30 / 0 / -0
  6. WolfieeifloW

    WolfieeifloW WEHZ Helper

    Ratings:
    +372 / 0 / -0
    What's considered low/high frequency?
    I remember TimerUtils being like 0.0325 I think?

    Also, what's 'timeout'?
     
  7. Solmyr

    Solmyr Active Member

    Ratings:
    +30 / 0 / -0
    Timeout is the interval at which a timer expires. Low-frequency timers are those that don't expire frequently (used for stuff such as spell durations), while high-frequency are those that expire much more frequently (used for stuff such as moving units).

    TimerUtils simply provides you with a way to recycle timers and attach data to them. You can specify the timeout as you wish. Timer32 uses a timeout of 0.03125 seconds by default.

    Try reading this tutorial.
     
    • Like Like x 1
  8. Magthridon96

    Magthridon96 Member

    Ratings:
    +2 / 0 / -0
    For loops, T32 is very efficient and lightweight.

    TimerUtils may be useful too, but since you have to continuously call Get/SetTimerData to retrieve/set the instance of the struct, T32 definitely WINS here.
     
  9. Romek

    Romek Super Moderator Staff Member

    Ratings:
    +961 / 0 / -0
    It's all up to personal preference, really.
    I'd recommend using T32 for high-frequency stuff (slides, projectiles, etc), and TimerUtils for everything else.
    Each of them are as efficient as they get, for their uses.

    > TimedLoop
    Lol.
     
  10. Nestharus

    Nestharus o-o

    Ratings:
    +83 / 0 / -0
    The only other one is TimerQueue, which is for low frequency constant times.
     
  11. luorax

    luorax Invasion in Duskwood

    Ratings:
    +67 / 0 / -0
    T32 difinitely LOSES here. Check Romek's post (well, I was lazy to write it down before)
     
  12. tooltiperror

    tooltiperror Super Moderator Staff Member

    Ratings:
    +233 / 0 / -0
    Do you understand what you are saying, luorax?

    You seem to not understand T32 at all.
     
  13. luorax

    luorax Invasion in Duskwood

    Ratings:
    +67 / 0 / -0
    Nope, I'm totally retarded. But I still don't know why should he use T32 to create a buff, that's removed after 5 seconds, without no periodic effect, or something like that.
     
  14. Sevion

    Sevion The DIY Ninja

    Ratings:
    +423 / 0 / -0
    Simple answer:

    Use T32 for high frequency callbacks.

    Use TimerUtils for low frequency callbacks.

    End of Story.
     
  15. Nestharus

    Nestharus o-o

    Ratings:
    +83 / 0 / -0
    And use TimerQueue for constant low frequency callbacks : o
     
  16. Magthridon96

    Magthridon96 Member

    Ratings:
    +2 / 0 / -0
    Exactly.
     

Share This Page