[System] Smooth Timers

Zwiebelchen

You can change this now in User CP.
Reaction score
60
Okay first of: This patch tool is awesome and works.

Second: I tested waits now on Bnet (with only me as a player, though ... couldnt make other people to join >_>), and they worked the same as in single player.

I tested it via the following trigger:
Code:
Nahkampfinitialisierung
    Ereignisse
        TriggerAddEventMapInit()
    Lokale Variablen
        t = (TimerCreate()) <timer>
        i = 0 <int>
    Bedingungen
    Aktionen
        TimerStart(t,9.0,false,c_timeGame)
        While()
            Conditions
                Comparison(i,<=,256)
            Actions
                Wait(0.0,c_timeGame)
                IncrementInteger(i,+,1)
        TriggerDebugOutput(1,"This should show 1:",true)
        TriggerDebugOutput(1,(FixedToText((TimerGetRemaining(t)),c_fixedPrecisionAny)),true)
It returned "1" in both singleplayer and singleplayer-bnet games.

However, something is really odd about that: When I changed the code to this, it returned "0" for some reason: Any idea why?
Code:
Nahkampfinitialisierung
    Ereignisse
        TriggerAddEventMapInit()
    Lokale Variablen
        t = (TimerCreate()) <timer>
        i = 0 <int>
    Bedingungen
    Aktionen
        TimerStart(t,9.0,false,c_timeGame)
        While()
            Conditions
                Comparison(i,<=,256)
            Actions
                Wait(0.0312,c_timeGame)
                IncrementInteger(i,+,1)
        TriggerDebugOutput(1,"This should show 1:",true)
        TriggerDebugOutput(1,(FixedToText((TimerGetRemaining(t)),c_fixedPrecisionAny)),true)

PS: Sorry for this gui trigger stuff, but I didnt find out how to convert triggers to galaxy yet.
 

Saldu

New Member
Reaction score
1
My only guess would be that since you can't have 0.03125 as a real entered there since the real input is limited to 4 digits after comma, it can't display 7.9872 as a result for some reason, but I'm at a loss for that reason too.
 

Zwiebelchen

You can change this now in User CP.
Reaction score
60
The reason for that problem was already found; I posted everything I found out about waits in the other thread. But thanks for your comment.
 

Marsunpaisti

New Member
Reaction score
0
Im having problems getting this to work. I tried to experiment around with these timers, and I'm not really sure if I used them properly. First of all I tried to copy the example you had in the original post but when im saving the map, galaxy editor tells me there is a syntax error on the line where there is the "newsmoothtimer(test,5)" thing.
 

Steel

Software Engineer
Reaction score
109
Steel said:
I was going to try this but got side tracked with my latest tutorial so someone in their spare time can try running this. The minimum time you can wait is 0.03125s, this is tested and proven, we know this. But that is just a minimum, the fastest. This means you can have something wait 0.03126s. So you could potentially have triggers running at the intervals of:

  • 0.03125
  • 0.03126
  • 0.03127
  • 0.03128
    ....

With careful coding and tweaking some numbers you could have several triggers running in parallel to execute code at a much faster rate.

If you have one trigger starting at the fastest delay possible 0.03125s and the next starting at 0.04678s (rounded up) you effectively double the number of waits you get to execute with your data¹. If you create another split you can end up with these figures: 0.03125, 0.03907, 0.04689, 0.05471¹. This now breaks the limitation of 1/32 executions per second and effectively increases it to 1/128 executions per second.

Now remember I'm just speculating here. I don't know if parallel time triggers will work or what their effect on the game they would have. The thing people seem to be focused on is interval clicks. Like everything executes in batches of 0.03125, I don't know if that is true or not. If you can actually have a wait time between 0.03125 and 0.0625, the next minimum wait time, you can execute more than this mysterious minimum value.

[Note: If the numbers get cut off to rounding, then round all of the minimum waits to a linear progression so they all are going in unison.]

¹ With proper rounding lets say we run two triggers in parallel starting at 0.03126, 0.04689. The interval difference here is 0.01563s. The starting point for our thread can be 0 seconds since we can execute a command upon initialization since these would be two actively running triggers. If you're going to nitpick and say what if this is at map initialization? The first instance of thread 2 would not execute, everything else though would be the same.

Thread 1 - 0.00000
Thread 2 - 0.01563
Thread 1 - 0.03126
Thread 2 - 0.04689
Thread 1 - 0.06252
Thread 2 - 0.07815
Thread 1 - 0.09378
Thread 2 - 0.10941
Thread 1 - 0.12504
Thread 2 - 0.14067
Thread 1 - 0.15630
Thread 2 - 0.17193
Thread 1 - 0.18756
Thread 2 - 0.20319
Thread 1 - 0.21882
Thread 2 - 0.23445
Thread 1 - 0.25008
Thread 2 - 0.26571
Thread 1 - 0.28134
Thread 2 - 0.29697
Thread 1 - 0.31260
Thread 2 - 0.32823
Thread 1 - 0.34386
Thread 2 - 0.35949
Thread 1 - 0.37512
Thread 2 - 0.39075
Thread 1 - 0.40638
Thread 2 - 0.42201
Thread 1 - 0.43764
Thread 2 - 0.45327
Thread 1 - 0.46890
Thread 2 - 0.48453 (32 executions here)
Thread 1 - 0.50016

33 executions in 0.050016 seconds

Originally posted on TDG's forum.

Have fun.
 

Marsunpaisti

New Member
Reaction score
0
Here is the map I was trying to import the smooth timer into.
 

Attachments

  • Galaxy racing 0.1a.zip
    73.9 KB · Views: 259

Builder Bob

Live free or don't
Reaction score
249
Does this system actually work as intended? I'm trying to create a smooth sliding motion for a unit, but it appears just as choppy with this system as with a .0625 timer.

Adding a line to display the game time every time the smooth timer starts a new tick shows it constantly expires twice with the same game time.

Example:
0
0
0.0625
0.0625
0.125
0.125
0.1875
0.1875
etc.

Can anyone confirm this system works and that I'm just doing something wrong? If not, can you point me in the right direction on how to achieve smooth sliding?
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • 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
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top