-
Get your 25fps flash movie to actually run at 25fps in IE
Hi all,
I posted this in another thread, but thought i'd post it here as well as we see this sort of question now and again.
As some of you may know, if you tell a flash movie to be published at 25fps in flash, when you run it as a standalone flash movie it will pretty much run at that 25fps (unless your computer isnt fast enough)
But..... if you run it through a html page, you get something stupid like 21fps, for no obvious reason other than someone at macromedia/microsoft/mozilla likes monkees.
Anyhow, heres a work around which although works quite well, will only work most accurately if your publishing your movie at a frame rate of between 1 - 12, 13, 15, 17, 20, 25, 34, 50 or 100 (see http://www.flashkit.com/board/showthread.php?t=638974 for a reason as to why)
Easy steps:-
1. Forget whatever framerate you want your game to run at, and set flash to publish at some stupid rate, 120 is good. (but anything more than 10fps higher than the rate you really want should be fine)
2. Make a blank Movieclip on your main stage that will be there throughout ur entire game
3.Stick this code on the first frame of that new movieclip
Code:
starttime = newDate()
onEnterFrame=function(){
var currtime=new Date()
var ttime=currtime-starttime
while(ttime<1000/DESIREDFRAMERATE){
var currtime = new Date()
var ttime=currtime-starttime
}
starttime=new Date()
}
4. Change the 'DESIREDFRAMERATE' to be whatever you want, though please note, you will only get the frame rates noted above. If you type in a number not in the above list, it will get rounded down. Ie, 30 would give you 25fps.
Voila.
Sample of this working can be found here :-
http://www.percypea.co.uk/gta
The demo originally loads trying to run at 120fps (if your computers fast enough you might just get there...)
Press the textfieldeee button type thing to the left of the FPS counter, and the code should kick in to limit the framerate to 25 fps
And you should (hopefully) see that you do actually get 25 fps, or at least much more closer to 25fps than if i had pulblished the game at 25 and run it through IE normally.
Hope it helps
Pea
Last edited by PercyPea; 07-07-2005 at 09:11 AM.
-
Flashoholic
At first, it ran at a constant 64 fps, which was far too fast to control the car. However, after pressing the 25 fps button, it switched all the way down to 22fps and stayed there the whole time. It seems like a nice idea for getting that ideal framerate, but it looks like not too much of a fix, at least for me. A difference of 1 fps isn't enough (from 21) to make me want to use this in all of my games. However, it was a very cool idea and I'm sure it should work in other instances.
- OneMrBean
-
Senior Member
I get 18-20 fps in the gta demo with both settings. Then again, I am not using IE
-
I was getting 60 and 55 in firefox even with the 25 limit on
-
President
Very nice idea and good game by the way. The framerate didn't change much, like 2 fps, but my pc is a bit slow. Without limitting: 12-16 fps, limiting: 16-18.
This is MC. His _parents sent him to stop() by the super market to buy some _root beer if he wanted to gotoAndPlay() with his friends at the park later.
This is my Blog!... The gaming Process
Please check out my site: Giddel Creations
-
I got 60-65 fps without the limit and 22 with the limit, though I use firefox browser, I tried putting that into my game, didnt really help too much.
-
SaphuA
Yes very nice idea
I got 60 fps without, and 22 with the limit. I assume the 3 fps drop is due to the game itself, instead of the code limiting the fps? Come to think of it, how much impact will the code actualy have on the CPU usage? Or is it not to be counted?
-
Without limit 13-25% cpu of my 3ghz, and limit on 40% cpu, why would you lower fps and have worse performance?
Nice thought but a lot of AS testing gives more CPU usage so its not worth it.
-
norty flash
hi all
to those that said you get 22fps.....
... You are right!!! Norty flash.
Tis my fault, I didnt test it enough.
For some reason on the 3 machines at work i've tried it on, when i turn on the 'lock to 25fps' it does indeed stay at 25fps (one machine hovers between 24/25)
but after reading this thread this morning, i tested it on my home machine and i also got 22fps
Dirty
I get 18-20 fps in the gta demo with both settings. Then again, I am not using IE - Tony PA
You need to have a fast enough machine to get more than 25fps on launch to be able to limit it to 25 mr tony
Without limit 13-25% cpu of my 3ghz, and limit on 40% cpu, why would you lower fps and have worse performance?
Nice thought but a lot of AS testing gives more CPU usage so its not worth it. - Erixon
Very very good point!! It seems the while loop just zaps all CPU power. Maybe if i published the movie at 30fps instead of 120, it would be more user friendly. Though from the results of this thread its not consistantly locking to 25fps anyway
André Michelle is testing the code aswell, he's currently put the code into his Super Mario game. http://lab.andre-michelle.com/ (look under the games menu on the left for 'supermario')
On my work machine here I get 33fps. Let him know what you all get
good monkees
-
SaphuA
Hmmm.. then what's actualy the use of this code, other then changing the fps on the flow...
You might as well put your fps on 25, it'll be waay less cpu intensive and you still have an fps drop of 3-4.
-
ya you are right mr saphua
tis just that on my work machines, the game does run at 25fps.
Which is why i posted the thread.
But it seems I didnt test on enough machines and the work machines are freaky, because as you and others have found out, and now myself aswell on my home machine. On other systems the game runs at 22fps
tis dirty.
my bad.
-
SaphuA
Too bad... the idea was nice though Would've been nice if it actualy worked like it should've...
-
Filthy Gorgeous
Originally Posted by SaphuA
Would've been nice if it actualy worked like it should've...
If I had a dime for every time I heard that in reference to flash...
-
Senior Member
If I had a dime for every time I heard that in reference to flash...
You would be a minimum of $.10 richer!
-
You can simply use wmode = transparent in your html and it will run at exactly the frame rate you set ( in IE ) unless your CPU is too slow or you have too demanding of a game. But, yes wmode corrects this. A game set to run at 30 fps will run at around 25 without wmode ( no matter how fast you cpu is ), and with wmode it will run at exactly 30 you specified.
-
what is the fps any how I see it on you pros work. What is it all about?
-
skylogic.ca
Originally Posted by mprimmer
what is the fps any how I see it on you pros work. What is it all about?
FPS = Frames Per Second (or in reference to games is First Person Shooter )
If it's 1 fps, than the movie updates every second and is a slideshow. Basically it's how smooth the movie runs.
~MD
-
oh thanks. so how do you control something like that... shouldnt flash be setup to go as fast and smooth as possible by default?
-
flash is setup to run at 12 fps by default, you can change all of that to make it the speed you feel is right for your game/movie. Flash cant help it if internet explorer and mozilla are retarded.
-
AquaCorpse saves the day again
Now correct me if I'm wrong but if you did use that and it dropped to 22 fps couldn't you just knock it up to 29 fps and it'd drop to 25 the disired frame rate?
aqua corpse he's a really cool guy...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|