To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here


A Flash Developer Resource Site

Go Back   Flash Kit Community Forums > General Help > Games

Reply
 
Thread Tools Display Modes
Old 07-07-2005, 09:07 AM   #1
PercyPea
Senior Member
 
Join Date: Aug 2001
Posts: 101
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.
PercyPea is offline   Reply With Quote
Old 07-07-2005, 01:26 PM   #2
OneMrBean
Flashoholic
 
OneMrBean's Avatar
 
Join Date: Feb 2002
Posts: 168
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
OneMrBean is offline   Reply With Quote
Old 07-07-2005, 02:04 PM   #3
tonypa
Moderator
 
tonypa's Avatar
 
Join Date: Jul 2001
Location: Estonia
Posts: 8,193
I get 18-20 fps in the gta demo with both settings. Then again, I am not using IE
tonypa is offline   Reply With Quote
Old 07-07-2005, 04:40 PM   #4
chuckury
Razor
 
Join Date: Aug 2002
Location: Canada
Posts: 721
I was getting 60 and 55 in firefox even with the 25 limit on
chuckury is offline   Reply With Quote
Old 07-07-2005, 05:26 PM   #5
PhobiK
President
 
PhobiK's Avatar
 
Join Date: Jan 2005
Location: Guatemala
Posts: 904
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
PhobiK is offline   Reply With Quote
Old 07-07-2005, 07:01 PM   #6
The_Mercenary
Senior Member
 
Join Date: Jun 2005
Posts: 203
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.
The_Mercenary is offline   Reply With Quote
Old 07-07-2005, 07:46 PM   #7
SaphuA
SaphuA
 
SaphuA's Avatar
 
Join Date: Oct 2002
Location: The Netherlands
Posts: 2,182
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?
__________________
SaphuA is offline   Reply With Quote
Old 07-07-2005, 08:06 PM   #8
erixon
Senior Member
 
Join Date: Apr 2002
Posts: 221
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 is offline   Reply With Quote
Old 07-08-2005, 05:06 AM   #9
PercyPea
Senior Member
 
Join Date: Aug 2001
Posts: 101
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


Quote:
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

Quote:
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
PercyPea is offline   Reply With Quote
Old 07-08-2005, 09:26 AM   #10
SaphuA
SaphuA
 
SaphuA's Avatar
 
Join Date: Oct 2002
Location: The Netherlands
Posts: 2,182
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.
__________________
SaphuA is offline   Reply With Quote
Old 07-08-2005, 11:35 AM   #11
PercyPea
Senior Member
 
Join Date: Aug 2001
Posts: 101
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.
PercyPea is offline   Reply With Quote
Old 07-08-2005, 11:58 AM   #12
SaphuA
SaphuA
 
SaphuA's Avatar
 
Join Date: Oct 2002
Location: The Netherlands
Posts: 2,182
Too bad... the idea was nice though Would've been nice if it actualy worked like it should've...
__________________
SaphuA is offline   Reply With Quote
Old 07-08-2005, 01:30 PM   #13
DancingOctopus
Filthy Gorgeous
 
DancingOctopus's Avatar
 
Join Date: Sep 2003
Location: Sunny Australia.
Posts: 478
Quote:
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...
DancingOctopus is offline   Reply With Quote
Old 07-08-2005, 02:10 PM   #14
UnknownGuy
Senior Member
 
UnknownGuy's Avatar
 
Join Date: Jul 2003
Location: Canada
Posts: 1,366
Quote:
If I had a dime for every time I heard that in reference to flash...
You would be a minimum of $.10 richer!
UnknownGuy is offline   Reply With Quote
Old 07-08-2005, 10:43 PM   #15
MikeMD
Senior Member
 
Join Date: Sep 2004
Posts: 628
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.
MikeMD is offline   Reply With Quote
Old 07-09-2005, 01:08 AM   #16
mprimmer
Senior Member
 
Join Date: Jan 2004
Location: Canada
Posts: 309
what is the fps any how I see it on you pros work. What is it all about?
mprimmer is offline   Reply With Quote
Old 07-09-2005, 01:57 AM   #17
MD004
skylogic.ca
 
MD004's Avatar
 
Join Date: Oct 2003
Location: Canada
Posts: 366
Quote:
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
MD004 is offline   Reply With Quote
Old 07-09-2005, 02:01 AM   #18
mprimmer
Senior Member
 
Join Date: Jan 2004
Location: Canada
Posts: 309
oh thanks. so how do you control something like that... shouldnt flash be setup to go as fast and smooth as possible by default?
mprimmer is offline   Reply With Quote
Old 07-09-2005, 02:14 AM   #19
The_Mercenary
Senior Member
 
Join Date: Jun 2005
Posts: 203
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.
The_Mercenary is offline   Reply With Quote
Old 07-09-2005, 02:19 AM   #20
aquaCorpse
AquaCorpse saves the day again
 
Join Date: Jun 2005
Posts: 40
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...
aquaCorpse is offline   Reply With Quote
Reply

Go Back   Flash Kit Community Forums > General Help > Games

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:27 PM.


internet.commerce
Be a Commerce Partner
 »  »  »  »  »  »  »
 »  »  »  »  »  »
 

    

Acceptable Use Policy

Internet.com
The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.