True Deltatime

Discussion and feedback on Construct 2

Post » Thu Mar 24, 2011 3:01 am

I do believe I've found out how to get a true delta time, and it doesn't even require an update.
http://dl.dropbox.com/u/10316081/truedt.capx
http://dl.dropbox.com/u/10316081/truedt/index.html

First number number is dt
Second is FPS generated from it
Third is the internal fps expression.
Click to add another circle.

EDIT: Would everyone be willing to test these in your browser?
"Get Time" Delta
http://dl.dropbox.com/u/10316081/truedt/index.html
"Get Milliseconds" Delta
http://dl.dropbox.com/u/10316081/truedttest/index.html

I can't offer the .capx for the second one. I had to monkey rig construct to make it.
B
51
S
10
G
7
Posts: 184
Reputation: 6,825

Post » Thu Mar 24, 2011 6:22 pm

That's interesting, it looks like some browsers have a high resolution timer on their ordinary time expression. I didn't realise they did that! I only tried Firefox 4 though.

Have you tested this on a range of browsers? I'm not sure if all modern browsers implement this.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Thu Mar 24, 2011 8:06 pm

I'm a regular Chrome user, and it works fine there. I couldn't tell you about the rest. But I originally got the idea from studying a list of javascript time commands. I realized while toying around with it that I was getting a much more precise number than expected. I wonder if getmiliseconds() could offer a universal solution if there's compatibility issues with the way I have it implemented now.

EDIT: Chrome version is 11.0.696.16 beta
B
51
S
10
G
7
Posts: 184
Reputation: 6,825


Return to Construct 2 General

Who is online

Users browsing this forum: Lordshiva1948, MonDieu and 17 guests