Change in "TimeFromStart" since update

Hey guys!

So I’m back at my little game project, and I used the function “TimeFromStart” In a few places, in lack of a better alternative.
Coming back to my project and updating the program, resulted in some weird things happening when I compiled my game.

It seems the function has been changed, to produce a much higher numerical value than before.
Does anyone know the exact change, so that I can change my code accordingly?

Thanks!

Hello,

TimeFromStart (and all time function) has now a better accuracy.
But where do you use TimeFromStart() ?

All time functions have indeed a better accuracy as they are now internally managed using microseconds ( instead of milliseconds ).
It should changes nothing for you but it turns out that I forgot to update the function associated to TimeFromStart.

I’ve fixed that, thanks for pointing it out.
While waiting for the next update, you can divide the result of TimeFromStart by 1000 to convert it to seconds. ( Just do not forget at the next update to remove these /1000 ). :slight_smile:

Thanks for the fast reply Victor!

I used it to jury rig a function for increasing a number over time.
I used it in two places;
One for fading an image:
(Do =TimeFromStart()*150 to the opacity of image)

And the second to continuously rotate an object:
(Do =TimeFromStart()10* to the direction of object)

They had a nice speed before update, now it’s just silly fast :stuck_out_tongue:

They way I use the function (probably not they way people usually use the function), this would mean I get a number 10x higher? So bu dividing my code with 10 should solve the problem then. I’ll try that.

You can use TimeDelta(), it’s better :
Do +TimeDelta()*150 to the opacity of image

I was clearly wrong… Did not turn out as expected.

No, no, 1000x higher : :slight_smile:

But I’m not sure how to use TimeDelta(). What does it derive its time from? Because just changing TimeFromStart to TimeDelta is giving me a constant 0 it seems.

Silly me ^^ Of course you’re right.

Ok, changed all my TimeFromStart() to (TimeFromStart()/1000) and all is back to normal.
I still don’t get how TimeDelta() works tho I’m afraid. When does it start counting and such?

TimeDelta() is the time since last drawn frame, but if you use TimeDelta(), set the operator as + and not = .

Oh, I get it now.
I guess they should only behave differently if lag is affecting the framerate then? But thanks, I’ll try to convert in a near future! Thanks!

Oh, and of course when you want a more controlled number on something that isn’t happening right as the scene starts… I can see why it’s better now.

You can read more about TimeDelta() here : ( At the bottom of the page )

wiki.compilgames.net/doku.ph … s_concepts

Let me know if you do not understand something or if it is badly explained. :slight_smile: