How fast can a timer go?
I recently learned through a small series of tests that GS cannot have a timer that does something every 0.01 (which is a centisecond (one hundredth of a second) seconds or faster. It can do things every 0.1 second (which is a decisecond (one tenth of a second)) and slower. This becomes a problem for the game I'm currently working on because I need the timer to increase a game attribute by o.o1 seconds every 0.01 seconds, but it can only do it every 0.1 seconds. If this is as fast as the timer can do things, than I think the creators of the GS software should really improve upon it because some gamers like to speed run games, which means that they attempt to beat the game or a certain percentage of the game as quickly as possible to try to get a world record just for bragging rights. Speed runs are timed in either centiseconds or milliseconds (which is a thousandth of a second (o.oo1 seconds)). It's just a suggestion. My thanks in advance if you do improve this.
Best Answer
-
colander Posts: 1,610
I read some time ago it takes GS 0.02 seconds to preform an action like change an attribute. There is a thread "Timers are for Chumps" it is worth a read. Keep in mind GS is continually being updated and this may not be such an issue anymore. To get a definitive answer you can always shoot an email to GS and or attend the Monthly Meetup and talk about it there.
Answers
Thanks for the info colander. I appreciate your quick response, too!
The time attribute goes to 14 decimal places (minus the number of whole places), more than enough for a 0.01 timer.
Out of interest I just did a test in the attached project and the quickest it will update a single attribute is every 0.035 seconds. A lower time will squeeze a couple more updates out of it but it won't update every time. I don't know if it is the timer, updating the attribute or both but seems to be the limit.
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
You can drive an attribute to a much higher temporal resolution . . .
Link: https://www.mediafire.com/?6qbl5dl4btvfd09
@Socks I was reading it wrong I am thinking he is trying to use a Timer to do something which is what he says in the first two lines not just display a timer, stop watch, etc.
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
I know how to display the timer, but I was asking how I could get it to go faster.
I know it does, but when I was testing it, I didn't notice any difference in any times after 0.1 seconds. For example, 0.0000001 seconds acted the same as 0.1 seconds, which is what was confusing me because it didn't seem like GS does anything faster than 0.1 seconds. Even though you can type more than 0.1 seconds in the timer, it still only does 0.1 when playing the game.
Maybe I am confused as to what it is you're trying to achieve, I thought you were trying to increase an attribute by 0.01 every 0.01 seconds, which is quite straightforward, in fact there is already a built-in attribute that already increases by 0.01 every 0.01 seconds (self.time or game.time), I'd just use this - or if you want, use this to drive something else.
By 'more' do you mean 'less' ?
@Socks I didn't know about the attribute self.time, so now that you mention it, I could give it a try. As for the 'more' or 'less', I was saying that in the text box for the timer (to tell it after, for, or every how many seconds), you could type 0.00000000000001 seconds or some crazy number like that, but when you tested the game, it still only added o.01 seconds every 0.1 seconds, instead of the amount that was typed in the text box (in this example, 0.00000000000001). I hope this clears things up! I'll check out that attribute and see if that helps.