View Full Version : 31 fps still optimum frame rate in AS3?
jpixels
05-29-2007, 04:32 PM
I know 31 or 33 frames per second was optimal for AS2 but is it faster in AS3? It seems you can get away with 60 fps everything is smooth
senocular
05-29-2007, 04:50 PM
31 comes from a Flash 5 Mac bug. That has long since been fixed.
24 or 30 is typical. Flex builder defaults at 24 while apps like Captivate, Acrobat Connect and Adobe Presenter use 30.
30 is good, but if you're worried about performance it would be a good idea to go lower like 24 or even lower than that if it works for you (many animations/cartoons do well with lower FPS which is why you see the default in the Flash IDE as being a lot lower). The lower the frame rate the more consistent playback will be across multiple clients (and the better it will play for slower machines)
Aquilonian
05-29-2007, 05:05 PM
But the motion will be strange
jjcorreia
05-29-2007, 08:07 PM
31 comes from a Flash 5 Mac bug. That has long since been fixed.
Wow you remember that? I was actually the one who discovered and announced the +1 fps solution at Flash Forward 2001 NYC. Got a really nice ovation for it (as well as a few authors who lied about giving proper credit in their forthcoming books :puzzled:) . Think I still got the slides archived somewhere. Brings me back a bit:smirk:
Dazzer
05-29-2007, 10:47 PM
I feel so n00b now. I remember [edited] Trial Version 5. But that is it...
oops - runs -
devonair
05-29-2007, 11:03 PM
Wow you remember that? I was actually the one who discovered and announced the +1 fps solution at Flash Forward 2001 NYC. Got a really nice ovation for it (as well as a few authors who lied about giving proper credit in their forthcoming books :puzzled:) . Think I still got the slides archived somewhere. Brings me back a bit:smirk:
That was you?? Holy crap.. I've been using 31 ever since then.. Every time I see it used (like in many of the help file examples eg.) I can't help but think "There's another old timer.." Small Flash world....
awflasher
05-30-2007, 02:21 AM
jjcorreia is a flash old guy ^_^
jjcorreia
05-30-2007, 04:20 PM
That was you?? Holy crap.. I've been using 31 ever since then.. Every time I see it used (like in many of the help file examples eg.) I can't help but think "There's another old timer.." Small Flash world....
Yup :). I found my presentation notes in fact. Its at the end under "Leveling the Playing Field": http://jacobcorreia.com/misc/flashforward/2001/
Sadly, as I mentioned other devs went off and wrote books and tried to take the credit for themselves; claiming they ran tests and discovered the fixes; even after promising they would credit me for discovering it. :sigh: oh well.
You cant imagine how happy people were when they saw it worked. It was an especially annoying issue because FlashForwards internet rooms always had iMacs, so when devs would share their work it would look like crap and was sometimes a bit embarrassing. Whats humorous is the reason everyone gave for the fps difference was that 'macs just cant process fast enough' :D, which I blew away with the 60 fps demo where the mac actually outperformed the pc by 1 or 2 fps (I was a mac user at the time). Funny that it became a trend even after the players were upgraded and it wasnt really needed as much anymore.
devonair
05-31-2007, 06:21 AM
Wow.. now, that's a blast from the past.. Can't speak for everyone, but I know for me, 31 just became force of habit. I figured video is 24 - 30 and you gotta expect to drop a frame or two depending on the end user's machine, so 31 just always seemed a reasonable frame rate even well after the bug was fixed.. Heck I still have it set as my default frame rate even in CS3... Funny meeting you here... :cool:
FizixMan
05-31-2007, 10:51 AM
120fps FTW!
gvozden
05-31-2007, 12:53 PM
sure ,there are lot of people with 120fps set
I use always 40fps like many other people I know
basiclly under 30 is too low for my oppinion
Dazzer
05-31-2007, 01:28 PM
i think 60-70 is about as good as the eye can see. So no point going higher if needed lol
What would the problem be for setting the stage.frameRate = 1000; [which is max] and then using time interval based calculations instead of frame based ones? Wouldn't that insure that your calculations are as constant and evenly paced as possible? i.e. if the player slows down due to overworking, the timer still ticks at an appropriate time. Sorry if this is a noob question, I've wondered about it for a while.
Dazzer
06-01-2007, 01:10 AM
the processor wouldn't be able to cope with the rendering speed, and it'll lag, or crash at the worst.
TheCanadian
06-01-2007, 01:17 AM
Most processors can barely deal with 50, I don't know why people choose such ridiculously high frame rates.
Weird, I always figured the player would just render at the highest speed possible in an attempt to run at 1000. My processor seems to run at a frameRate of 1000, what would be a good way to test for lag? Or at least to test for the actual frameRate? A simple program of:
stage.frameRate = 1000;
function everyFrame(event:Event):void
{
trace(stage.frameRate);
var newSprite:Sprite = new Sprite();
newSprite.graphics.beginFill(0x000000, .005);
newSprite.graphics.drawRect(0,0,100,100);
newSprite.graphics.endFill();
addChild(newSprite);
}
stage.addEventListener(Event.ENTER_FRAME, everyFrame);
//outputs a black square at .005 opacity that quickly turns opaque black
seems to render a totally black square in less than a second. There's a big difference between a stage.frameRate = 30 and stage.frameRate = 1000. It's a magnitude on par with what one would expect if the processor were rendering frames at 1/ms [1000fps]. Can you guys try that out on your machines and see if it works the same for you?
FizixMan
06-01-2007, 10:00 AM
lol, I'm kidding about 120fps. Unless there's some reason to run it that fast internally (for some kind of special timing calculations?) it just seems like a waste considering most monitors have a refresh rate of 60hz-80hz. Television runs at 30fps, films at 24 -- do we really need more than 60? :D
Dazzer
06-01-2007, 12:10 PM
set the frame rate to something
Have a textfield that displays a counter
And onEnterFrame, counter ++
See what happens. lol
Fizix: The max framerate ever required is 72fps, according to what I've read on the net.
Okay, here's my little testing program:
stage.frameRate = 1000;
var test_txt:TextField = new TextField();
var frame_txt:TextField = new TextField();
test_txt.autoSize = TextFieldAutoSize.RIGHT;
frame_txt.autoSize = TextFieldAutoSize.RIGHT;
test_txt.x = 400;
test_txt.y = 100;
frame_txt.x = 400;
frame_txt.y = 200;
var format:TextFormat = new TextFormat();
format.font = "Verdana";
format.color = 0x000000;
format.size = 12;
format.underline = true;
test_txt.defaultTextFormat = format;
frame_txt.defaultTextFormat = format;
stage.addChild(test_txt);
stage.addChild(frame_txt);
var frames:int = 0;
var average:Array = new Array();
var timer:Timer = new Timer(1000);
function ticker(event:TimerEvent):void
{
var num:int;
test_txt.text= frames + " fps";
average.push(frames);
for(var i:int = 0; i<average.length; i++)
{
num += average[i];
}
test_txt.appendText(" ["+ Math.round(num/average.length) +" avrg]");
frames = 0;
}
function everyFrame(event:Event):void
{
frames++;
frame_txt.text = frames +" frames";
}
timer.addEventListener(TimerEvent.TIMER, ticker);
stage.addEventListener(Event.ENTER_FRAME, everyFrame);
timer.start();
And while writing this reply I let the code run for a while to get an average of:
953 fps
Seems pretty good. It seems like if you start clicking on other applications the fps drops, leaving me to believe that the flash player gets "niced" down [less priority over cpu] and really doesn't overwork the cpu, but that's just on my machine. Any thoughts?
I should add that the only reason I'd like to take the conversation further is because potentially flash can be used for physical modeling. It's great for rapidly prototyping little particle theorys or fluid dynamic systems. It's definitely a lot more fun than Mathematica! The possibilities of sound synthesis are also fun, and the higher the frame rate, the more accurate all these calculations are going to be, IMHO.
mathew.er
06-01-2007, 03:33 PM
I should add that the only reason I'd like to take the conversation further is because potentially flash can be used for physical modeling. It's great for rapidly prototyping little particle theorys or fluid dynamic systems. It's definitely a lot more fun than Mathematica! The possibilities of sound synthesis are also fun, and the higher the frame rate, the more accurate all these calculations are going to be, IMHO.
Then you really want to try processing (http://processing.org/). AS is still no match to Java in speed and possibilities.
Ah! That looks great. But is it cross platform and widely available to the layman net surfer?
joshchernoff
06-01-2007, 04:18 PM
29.97 frames has been used for television and DVDs, but this was mostly for interlaced video. 35 mm movie cameras use a standard exposure rate of 24 frames per second. The 24p frame rate is also a common non-interlaced format
for the most part I go for 24 or 29 just out of habit from rendering video
jjcorreia
06-01-2007, 06:28 PM
You wouldnt want to run your file at ridiculous frame rates. If you have any timeline animations it means you have to either use a programmatic method of animating them or extend the frames out to absurdly long amounts, increasing your work and your filesize. Additionally, it puts an unnecessary strain on your cpu, rendering tons of frames that the eye will never see.
Just because you can push your cpu to 100% doesnt mean you should. It wiser to be more practical, based on the particular project.
for the most part I go for 24 or 29 just out of habit from rendering video
What you have to remember though is that your file will lose several frames per second just from playing it in the browser (changing the window mode often helps). This is why a few extra fps are usually tacked on to balance out the loss.
Yes, I definitely see the drawback of running at 1000fps when using the Timeline for animation. In my original question I had mentioned only using Timer based animations, instead of frame/Timeline based ones, which would alleviate that overhead.
My argument is that when using time sensitive functions, the larger the frameRate, the greater precision your calculations have, as Timer functions only evaluate during the first frame AFTER the actual Timer tick. So having a function set to tick off every millisecond in an swf with a stage.frameRate = 31 would really only tick off every 1/31st of a second.
I've done some tests and I have to correct myself. The functions may tick off more than once a frame, but no where near the actual tick rate. Here's another quick program if anyone is interested. Play around with the frameRate at the beginning to see the differences.
///////////Timer Test
stage.frameRate = 1000; ///change this to experiment
var timer:Timer = new Timer(1, 1000);
var ticks:int = 0;
var frames:int = 0;
var text_txt:TextField = new TextField();
text_txt.x = 300;
text_txt.y = 100;
text_txt.textColor = 0x222222;
text_txt.autoSize = TextFieldAutoSize.RIGHT;
stage.addChild(text_txt);
timer.addEventListener(TimerEvent.TIMER, tick);
timer.addEventListener(TimerEvent.TIMER_COMPLETE, completion);
stage.addEventListener(Event.ENTER_FRAME, everyFrame);
function tick(event:TimerEvent):void
{
ticks++;
text_txt.text = ticks + " ticks in " + frames + " frames.";
trace(ticks);
}
function everyFrame(event:Event):void
{
frames++;
}
function completion(event:TimerEvent):void
{
text_txt.appendText("\nAverage of: " + Math.round(ticks/frames) + " ticks per frame.\n" + Math.round(ticks/frames*stage.frameRate)+ " ticks per second.");
}
timer.start();
mathew.er
06-02-2007, 05:25 AM
Ah! That looks great. But is it cross platform and widely available to the layman net surfer?
According to this stats comparsion on Adobe website, Java had 87.5% in March 2007. And as far as I know, Java is more cross-platform than Flash as I haven't heard of FP for Solaris yet ;)
senocular
06-02-2007, 08:20 AM
FP7 is available for solaris
http://www.adobe.com/shockwave/download/alternates/
Krilnon
06-02-2007, 09:10 AM
There's also a beta for Flash Player 9 on Solaris: http://labs.adobe.com/technologies/flashplayer9/
mathew.er
06-02-2007, 11:45 AM
Oh, good to know... next time I'll work on some Sun 250 processor supercomputer I'll know I can run Flash there... YAY ;)
Awesome. Now they just need a browser plug-in so we can embed processor programs into web pages!
Blommestein
06-02-2007, 05:38 PM
(changing the window mode often helps).
Hm?
Hm?
I think he means changing the wmode parameter in your embed/object tags when insterting the swf in html. :)
joshchernoff
06-02-2007, 07:36 PM
I think he means changing the wmode parameter in your embed/object tags when insterting the swf in html. :)
I wonder about how much stage scaling will effect the fps?
andrewfitz
06-04-2007, 12:40 PM
I use 40 or 50. Anything higher doesn't change much, anything lower than 40 changes drastically. 50 seems to be about the threshold for me. But remember, I do everything via AS, so there's no timeline animations.
If you do have timeline animations or video, you'll want to match it with what works for those. But anyone using tweening classes like tweener or fuse, high frame rates will make them much smoother.
I remember the 31fps bug as well, but when I see 31fps nowadays, I know what it's from, and I can't help but scream that it's not really needed anymore.
I wonder about how much stage scaling will effect the fps?
I tried resizing my swf while monitoring the frame rate and it dips significantly. If you resize like crazy you can get the frame rate to drop to about 5fps [regardless of what you set it to].
cooldude88
05-12-2008, 10:15 PM
hmmm interesting ive found that i havnt really needed anything higher than like 20 is this a bad practise i have always found that it was smooth and kept the processing speed fairly high.
For time sensitive applications I've been setting my fps to 100 and timing my animation separately from the frameRate. Seems to work well. Flash isn't going to freak out and crash your browser because of a high frameRate, it will only run as fast as it can, so if you set the frame rate up really high, it will usually max out at 50fps or so.
vBulletin® v3.8.1, Copyright ©2000-2009, Jelsoft Enterprises Ltd.