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,453

Post » Sun Oct 28, 2012 10:50 pm

Huh?
B
92
S
31
G
24
Posts: 3,191
Reputation: 32,699

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
125
S
43
G
41
Posts: 849
Reputation: 28,260

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,453

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
399
S
236
G
89
Posts: 24,519
Reputation: 195,351

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,453

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
20
S
5
G
4
Posts: 208
Reputation: 3,985

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
399
S
236
G
89
Posts: 24,519
Reputation: 195,351

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,453


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 5 guests