RequestAnimationFrame = Every Tick?

Discussion and feedback on Construct 2

Post » Sun Oct 28, 2012 9:31 pm

Is Every Tick RequestAnimationFrame?

B
40
S
11
G
4
Posts: 665
Reputation: 8,403

Post » Sun Oct 28, 2012 10:50 pm

Huh?
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Mon Oct 29, 2012 1:11 am

Uh, I don't think so. Every tick = CPU ticks.
http://en.wikipedia.org/wiki/CPU_time
B
106
S
35
G
37
Posts: 798
Reputation: 25,215

Post » Mon Oct 29, 2012 10:35 am

Oh okay :)

I though Ticks are Frame rate dependent, which is why we always type * dt
B
40
S
11
G
4
Posts: 665
Reputation: 8,403

Post » Mon Oct 29, 2012 2:43 pm

@Schoening - I'm not sure what your original question is actually asking, but in browsers which do support it, the main game loop is driven by requestAnimationFrame (otherwise a simple timer if not supported).

@andreyin - I think CPU ticks usually refers to a single cycle, i.e. 1 out of the 3,000,000,000 cycles per second in a 3GHz processor.

All you really need to know about "Every tick" is it aims to run 60 times a second, but if the system is slow it could run less frequently.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Mon Oct 29, 2012 8:33 pm

Sorry for asking many questions :)

Just interested because I learn a lot of JS at the moment.

And thanks for the answer ^^
B
40
S
11
G
4
Posts: 665
Reputation: 8,403

Post » Mon Oct 29, 2012 10:48 pm

[QUOTE=Ashley] @Schoening - I'm not sure what your original question is actually asking, but in browsers which do support it, the main game loop is driven by requestAnimationFrame (otherwise a simple timer if not supported).

@andreyin - I think CPU ticks usually refers to a single cycle, i.e. 1 out of the 3,000,000,000 cycles per second in a 3GHz processor.

All you really need to know about "Every tick" is it aims to run 60 times a second, but if the system is slow it could run less frequently.[/QUOTE]

That still amazes me, 3 MILLION cycles a SECOND! I love technology.

Carry on.
B
19
S
5
G
4
Posts: 208
Reputation: 3,960

Post » Mon Oct 29, 2012 11:22 pm

[QUOTE=vandinz]That still amazes me, 3 MILLION cycles a SECOND! I love technology.[/QUOTE]

Billion ;)
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Tue Oct 30, 2012 6:28 am

I made a quick demo comparing JavaScript ServerSide to ClientSide Speed:

Client:
http://dl.dropbox.com/u/53738503/LoopTest.html

Server:
http://dl.dropbox.com/u/53738503/TestSocket1/index.html
B
40
S
11
G
4
Posts: 665
Reputation: 8,403


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 11 guests