A Flash Developer Resource Site

Page 1 of 3 123 LastLast
Results 1 to 20 of 41

Thread: Get your 25fps flash movie to actually run at 25fps in IE

  1. #1
    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.

  2. #2
    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

  3. #3
    Senior Member tonypa's Avatar
    Join Date
    Jul 2001
    Location
    Estonia
    Posts
    8,223
    I get 18-20 fps in the gta demo with both settings. Then again, I am not using IE

  4. #4
    Razor
    Join Date
    Aug 2002
    Location
    Canada
    Posts
    721
    I was getting 60 and 55 in firefox even with the 25 limit on

  5. #5
    President PhobiK's Avatar
    Join Date
    Jan 2005
    Location
    Guatemala
    Posts
    918
    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

  6. #6
    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.

  7. #7
    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?

  8. #8
    Senior Member
    Join Date
    Apr 2002
    Posts
    226
    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.

  9. #9
    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


    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

  10. #10
    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.

  11. #11
    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.

  12. #12
    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...

  13. #13
    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...

  14. #14
    Senior Member UnknownGuy's Avatar
    Join Date
    Jul 2003
    Location
    Canada
    Posts
    1,361
    If I had a dime for every time I heard that in reference to flash...
    You would be a minimum of $.10 richer!

  15. #15
    Senior Member
    Join Date
    Sep 2004
    Posts
    633
    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.

  16. #16
    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?

  17. #17
    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

  18. #18
    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?

  19. #19
    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.

  20. #20
    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...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center