System Timer Ticker

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
>>what it points to never gets removed
I don't really get it.

In my oppinion(noob oppinion), nulling it or not will just make no difference. It won't flaw the system nor creating any lags.
 

emjlr3

Change can be a good thing
Reaction score
395
it wont make a difference, but it is not needed, so why do it

the infinitesimal amount of time it saves does not matter, agreed, but still, why do it if its not needed

the same reason you do not need to null variables pointing to say heroes that will remain in the game always, they will always be there, thus their allocation will be as well, nulling is so you remove the memory that is spent keeping that so

Cohadar may be able to explain it better, I hardly know what I am talking about
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
>>I hardly know what I am talking about
True... I just understand a few lines.

"The super duper small amount of time, save it or not doesn't matter."
 

Cohadar

master of fugue
Reaction score
209
what it points to never gets removed, so nulling it would do nothing

This is the correct answer.
The triggers inside TT are never destroyed, they are simply recycled over and over.
Since swap is simply pointing to recycled triggers it does not need to be nulled.

Basically the same reason you do not need to null timers when you use CSSafety.

EDIT:
I could explain you the whole story with how handles in wc3 work, about reference counters and all that technical stuff but basically all you need to know is:
When something is never destroyed -> you do not need to null it.

The most famous example would be a local trigger inside InitTrig
JASS:
public function InitTrig takes nothing returns nothing
    local trigger trig = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( trig , EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( trig , Condition( function Conditions ) )
    call TriggerAddAction( trig , function Actions )
    //set trig  = null // no need to null this since trigger is active during the whole game
endfunction
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
So, is it because the index is keeping recycling?
 

Cohadar

master of fugue
Reaction score
209
So, is it because the index is keeping recycling?

Ok let me try to explain this in non-programmerish way.

Lets say TT uses 4 triggers at some point and that those triggers got this values from the game:


0x10003, 0x10007, 0x1000A, 0x1000C

At some point user function that called trigger 0x1000A stops and we need to remove it from the system
0x10003, 0x10007, 0x1000A, 0x1000C

But instead of deleting the 0x1000A I recycle it,
I use swap variable to move it to the end of trigger array
0x10003, 0x10007, 0x1000C, 0x1000A

After that 0x10007 trigger also stops
0x10003, 0x1000C, 0x10007, 0x1000A

But after some time you use TT_Start again and instead of creating a new trigger you reactivate the old one

0x10003, 0x1000C, 0x10007, 0x1000A

Ok but what happens if there are 5 user functions active at same time?
Simple we create a new one and add it to the array.
0x10003, 0x1000C, 0x10007, 0x1000A, 0x1000F

After that recycling process continues..

Ok but how many of these can be active at the same time?
Theoretically if you have 12 players and they all cast a spell that uses TT at the same time you can have 12 active triggers inside system.
Add a couple of other things that might use TT (like physics engine and similar) and you easily get to 20 triggers.
The demo map contains 60 heroes that use TT at the same time with no lag.
 

cr4xzZz

Also known as azwraith_ftL.
Reaction score
51
> //set trig = null // no need to null this since trigger is active during the whole game
Hmm, you learn something new every day... ^^
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
>>Ok let me try to explain this in non-programmerish way.
Sorry but truly, I am not a programmer.
I'm just a small girl.

>>But instead of deleting the 0x1000A I recycle it,
I wonder how you do it.. lol..
How you recycle it? (In which part of your code? That non-nulling?)

Edit -
>>When something is never destroyed -> you do not need to null it.
I see. I would like to listen the big theory about warcraft handle. lol :p
It is better if you tell me how nulling works in warcraft. (Or even in programming world)
 

emjlr3

Change can be a good thing
Reaction score
395
why is this not approved?

useful - yes
bugs - no?
used - yes
 

Sooda

Diversity enchants
Reaction score
318
> This method fails if PERIOD > 0.1 second

Is it because if PERIOD would be > 0.1 then newly added userFuncs would need to wait more time until timer again expires? When PERIOD is <= 0.1 then waiting would be not noticeable for players?

> onDestroy functions works with TT, right?

Yes, but don' t add waits into method (not even possible?).

JASS line from TT Demo map

JASS:
    set data.ticks = R2I(distance / (SLIDE_SPEED*PERIOD))

These suggested PERIODS are for map maker who decides how smooth (Performance consuming) effects (Slide, Life Drain kind of effects, DotA Hook ability hook effect) he wants for his map.
Now something pretty clever what you have done. That PERIOD is used by ability function itself to calculate how much should unit be moved when using PERIOD X (X would be random PERIOD from suggested ones). By doing that ability maker can know should unit be moved less (when PERIOD is smaller) per tick or more (when PERIOD is bigger).
As much I understand there is no contradiction between different PERIODS so far ability maker takes into consideration PERIOD like Cohadar did in his example ability.
This system is very well thought trough. Everything looks pretty perfect. Well done Cohadar.

EDIT:
Your TT System gave me inspiration and I modified your system to use boolexpr. It now dosn' t require triggers.
Only downside is that I need to find better native what can execute boolexpr. Not time to search now. It works currently maybe little slower than yours or at same speed (I repeat everything depends how fast boolexpr can be executed). I named this system Lightning :D
JASS:
library Lightning initializer Init
    globals
        public constant real TIMEOUT = .03125
        constant player playerX = Player(0)
        boolexpr array boolexprz
        integer array structIdz
        integer instance = 0
        integer enumStructId = 0
        timer mainTimer = CreateTimer()
        group placeHolder = CreateGroup()
    endglobals


    private function Handle takes nothing returns nothing
        local boolean bl = false
        local integer n = 0
    
        loop
            exitwhen n &gt; instance
                set enumStructId = structIdz[n]
                call GroupEnumUnitsOfPlayer(placeHolder,playerX,boolexprz[n])
                if FirstOfGroup(placeHolder) != null then
                    call GroupClear(placeHolder)
                    set boolexprz[n] = boolexprz[instance]
                    set structIdz[n] = structIdz[instance]
                    set instance = instance - 1
                else
                    set n = n + 1
                endif
        endloop
    endfunction

    public function New takes boolexpr bx, integer structId returns nothing
        set instance = instance + 1
        set boolexprz[instance] = bx
        set structIdz[instance] = structId
    endfunction
    
    public function EnumStruct takes nothing returns integer
        return enumStructId
    endfunction

//===========================================================================
    public function Init takes nothing returns nothing
        call TimerStart(mainTimer,TIMEOUT,true, function Handle)
    endfunction
endlibrary

It' s your system concept. Demo map also (With your TT Demo map ability using Lightning)
 

Attachments

  • Lightning v2.w3x
    36 KB · Views: 253

Cohadar

master of fugue
Reaction score
209
Ye I had a similar idea while I was experimenting with different beta versions of TT.

Lets do a little compare:
JASS:

call TT_Start(function PeriodicFunc, data) // TT
call Lightning_New(Condition( function PeriodicFunc), data) // Lightning


I think it is obvious why I chose the first one.

Besides no matter what you do you can make it only as fast as TT,
you cannot make it faster.
I use the same trigger technique Vexorian used inside vJass to run interfaces and inheritance, if there was a faster way to do it we would know, trust me.
 

duyen

New Member
Reaction score
214
Ye I had a similar idea while I was experimenting with different beta versions of TT.

Lets do a little compare:
JASS:

call TT_Start(function PeriodicFunc, data) // TT
call Lightning_New(Condition( function PeriodicFunc), data) // Lightning


I think it is obvious why I chose the first one.

Besides no matter what you do you can make it only as fast as TT,
you cannot make it faster.
I use the same trigger technique Vexorian used inside vJass to run interfaces and inheritance, if there was a faster way to do it we would know, trust me.

For 1 less word :confused:
 

emjlr3

Change can be a good thing
Reaction score
395
and the fact that it is not any faster, for the most part of what matters
 

Magentix

if (OP.statement == false) postCount++;
Reaction score
107
// One Timer to rule them all, One Timer to find them,
// One Timer to call them all and in the jass bind them
// In the land of warcraft where the desyncs lie.

<3 J.R.R. Tolkien


What if I have TT (period: 0.04) in my map and I need a periodic (0.04) event at some point.

Do I:
A) Create a periodic trigger and add actions
B) Create a periodic timer and add a callback
C) Call a TT with only userFunc and null data?
 

emjlr3

Change can be a good thing
Reaction score
395
er, create your struct and set your data

call TT_Start(struct, funtion actions_function)

it does realy explain this in the Read Me....
 

Magentix

if (OP.statement == false) postCount++;
Reaction score
107
No, you misunderstood:

I use spells with TT, all on a 0.04 timer.
At some point, I need a periodic event to start, without any struct data.

Do I:
A) Create a periodic trigger and add actions
B) Create a periodic timer and add a callback
C) Call a TT with only userFunc and null data?

(Since I don't need any external data (bar some globals) to be used inside the callback)


EDIT for more clarification:

Which one is the fastest, assuming I'm already using TT inside my map (and thus have a 0.04 timer running already)?
JASS:
//THIS,
call TimerStart(t,0.04,true,function TimerCallback)

// THIS
call TT_Start(function TimerCallback,-1)

// OR THIS?
call TriggerRegisterTimerEvent(T,0.04,true)
call TriggerAddAction(T,function TimerCallback)
 

Joker(Div)

Always Here..
Reaction score
86
The first one.

Timers > Triggers

TT = A slower timer that allows struct passing

So Timers > TT > Trigger

I'm not a 100%, but I think I'm right.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top