Time between enterFrame events


thanks looking

i trying understand why flash player in browser takes long return between frames.

 

i have target frame rate @ 60 fps.

when enter frame, need (gpu , cpu) tasks. takes 5 ms.

upon leaving frame mark time left, upon getting next enterframe event, record current time.

what notice time between framerate events longer should be.

for example log.

 

enterframe - render: 3  timeupdate: 2  total time: 5  time app: 20  desired frame rate: 60

enterframe - render: 4  timeupdate: 1  total time: 5  time app: 19  desired frame rate: 60

enterframe - render: 4  timeupdate: 1  total time: 5  time app: 20  desired frame rate: 60

enterframe - render: 4  timeupdate: 1  total time: 5  time app: 16  desired frame rate: 60

 

so effective frame rate total time take plus amount of time app next enterframe event.

5 + 19 = 24 ms ~ 41 fps

 

what hope 16.77 ms minus last time took update , render last frame.

 

any clues on why taking long?

things correct this?

 

this seems relatively recent problem.

i running on window 10, in version 23.0.0.162 in firefox version 49.0.2 on virtualreality rated pc.

 

bob

this excerpt (flash game development: in social, mobile , 3d world)

 

everything done flash player uses cpu/gpu.  means displayed in game , every bit of code executes in game requires processing cpu/gpu.  in addition, if swf's frame rate greater zero, when there nothing on-stage , no code executing, game still uses cpu/gpu. 

 

that is, if open flash pro, save fla , publish swf, game still uses cpu/gpu when runs.  empty stage swf no code repeatedly using cpu/gpu.

 

for example, if game's frame rate 24, 24 times per second (if host computer/device can cope frame rate), flash player following

 

1. checks events completed previous 1/24 second.

2. executes listener function code, if there any, events.

3. if have code on frame entered, code execute.

4. dispatches event.enter_frame event listeners event.

5. display rendered.

 

and, not flash player has do.  if create object (i.e., anything) @ time, flash player has allocate memory object , has store object reference , value, if assigned when created.  if there no available memory flash allocates more memory.

 

but, that's not flash player has do. before allocates new memory, checks objects can removed memory.  if finds any, marks them removal and, on subsequent clock cycle, clears part of memory. 

 

and best (or worst) yet come.  marking of objects removal dizzying multi-step process involves checking each , every object exists , counting references each , every existing object.  objects 0 references marked removing (sweeping in flash parlance) , (eventually) cleared memory.

 

other steps 3 (game code) , 5 (the graphics displayed), of not consider other steps impact our game's performance.  however, time required complete 5 steps determine if game runs smoothly or not.  if time required complete 5 steps greater 1/fps second, frame remain on-stage longer 1/fps second. put few of frames back-to-back , game appears stutter.

 

there 2 main points want convey in section:

1.  there lot going on in basic flash game , of uses cpu/gpu.

2.  memory management has impact, not on memory, on cpu/gpu.

 

after seeing flash player many times per second, amazing that, many game players, there no noticeable performance problems flash games.  however, increasing number of computer users, using relatively weak computing devices mobiles, having problems flash games (and else flash).



More discussions in ActionScript 3


adobe

Comments

Popular posts from this blog

Reader DC

AdobeIDの作り方

Adobe InDesign CC 2017 has stopped working