A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: [RESOLVED] Differing fps in FF and IE

  1. #1
    Member
    Join Date
    Jun 2001
    Posts
    36

    resolved [RESOLVED] Differing fps in FF and IE

    I have a flash movie that does hardly anything except move 1 thing down the screen.
    It runs at 100 (I tried less - it's not smooth enough).
    In Flash and Firefox, it runs at 100 fps as I have set.
    In IE it runs at what looks like about 30fps, though it looks like a cap is in place!

    I'm using a timer method, NOT the enterframe method here, so in theory my fps shouldn't matter.
    Every 10ms, it basically does canvas.y = canvas.y + (tempo/59.5)
    Nothing else at all!

    In firefox it works perfectly it seems, but in IE it doesn't.
    But in IE it's moving down the screen far too slowly to keep up with the music!

    You can test it at http://www.funkimunkibadges.co.uk/gh/GHv3.html
    Pick the 2nd or 3rd one, not the top one!

    ps. It will stutter slightly as it checks and re-syncs with the song every 2 seconds.

    Thanks!

  2. #2
    Senior Member Ray Beez's Avatar
    Join Date
    Jun 2000
    Posts
    2,793
    I'd blame your programming first. I looked at it in IE and yeah it looks like maybe 30fps and inconsistent scroll speed, but in FF its even choppier.

    100 fps is nuts. You shouldn't really need more than 60fps to look really smooth (that's the highest any console video game goes to, so don't worry about going higher).

    The problem with setting high frame rates is you are giving the engine less time to perform all the code it needs to perform every nth/second. By the looks of the choppyness in FF I'd say you have some intensive code doing its thing only every second or so, but its enough to interrupt.

    Smaller Flash stage will help too.

    Oh, and next time, put am FPS counter in. It's useless to get feedback without real numbers.

  3. #3
    Member
    Join Date
    Jun 2001
    Posts
    36
    Hm I forget I have a v fast PC. In both IE and FF on my PC it's running at a solid 100fps, even with an fps counter.

    Have updated it to include an FPS counter, and reduced it to 50fps, and it is fast enough gladly.
    Can you or someone try it again for me?

    This is cobbled together code, and is not what I wanted. I wanted it to check the mp3 every 20ms say, but it wont return 'Position' values faster than about every 100ms, which is only 10fps and waaaay too slow.

    Just don't move the mouse cursor over it, as the frame drops to 0 - not sure what's going on there, is that normal?

    The code happening every 20ms is this:

    Code:
    var timerb:Timer = new Timer(20); // update every x milliseconds 
    timerb.addEventListener(TimerEvent.TIMER,RunTimerb);
    timerb.start();
    
    function RunTimerb(event:TimerEvent):void {
    	canvas.y = canvas.y + tempo / 29.75
    }
    There is a slightly bigger bit every 2000ms to get it back in sync, hence the slight stutters. Better than going out of sync though.

    Thanks muchly Ray Beez.

  4. #4
    Pumpkin Carving 2008 ImprisonedPride's Avatar
    Join Date
    Apr 2006
    Location
    Grand Rapids MI
    Posts
    2,377
    You might also want to note that the Timer is notoriously inaccurate. Over several tests I took the liberty of performing for you, each of 100 seconds, the "TimerEvent.Timer" event seemed to be inaccurate to nearly 182ms or 1.82 tenths of a second. That -may- or may not be causing some irregularities in your display also.
    The 'Boose':
    ASUS Sabertooth P67 TUF
    Intel Core i7-2600K Quad-Core Sandy Bridge 3.4GHz Overclocked to 4.2GHz
    8GB G.Skill Ripjaws 1600 DDR3
    ASUS ENGTX550 TI DC/DI/1GD5 GeForce GTX 550 Ti (Fermi) 1GB 1GDDR5 (Overclocked to 1.1GHz)
    New addition: OCZ Vertex 240GB SATA III SSD
    WEI Score: 7.6

  5. #5
    Senior Member Ray Beez's Avatar
    Join Date
    Jun 2000
    Posts
    2,793
    I don't know what's going on. I got 50fps (IE8) and then the thing choked just before the BLUE symbols were introduced. Each symbol is a movie clip right? The more movieclips "alive" the more processing time it takes. Strangely the FPS counter did not drop when the "choking" happened.

    I suspect your approach is just too "raw". There must be alternate methods to do what you are trying to do. What method are you using to sync up note events to the song? Is it a seperate file? Is the song and events in one SWF? What quality? Best or Fast?

    etc

  6. #6
    Senior Member Ray Beez's Avatar
    Join Date
    Jun 2000
    Posts
    2,793
    Quote Originally Posted by CreepyD View Post
    Every 10ms, it basically does canvas.y = canvas.y + (tempo/59.5)
    So you are scrolling a giant movieclip?

  7. #7
    Please, Call Me Bob trogdor458's Avatar
    Join Date
    Aug 2006
    Location
    Pensacola, FL
    Posts
    915
    Fps seems finicky at times.
    I've never had trouble with browsers maintaining the framerate (unless I just dragged the swf into the browser to load it, causing it to bloat to the size of the window; obvious slow-down there), but I've noticed issues across different computers, at least when running straight off the fla.

    On my computer, I had lots of calculations going on, but it maintained the 30 fps I assigned it just fine.
    When I tried showing it to friends on a school computer, it was noticebly slower.
    I thought it was having trouble choking down the math, but when I went and told it do 120 fps, it seemed more than capable to get past 30.

    There might have been something with me having CS4 at the time, and saving it as CS3 for the school computer to read, I'm unsure.

    As noted 100 does seem more than necessary.
    In fact, you usually only use those framerates to see if your level of optimization is, in fact, more than necessary (if you can run it at 100 on your computer, should run at 30 fine on any other computer).
    You could easily lower the fps, and increase the distance traveled per frame, and I doubt anyone would notice.

  8. #8
    Member
    Join Date
    Jun 2001
    Posts
    36
    Thanks guys.
    I've tried to create it as efficiently as I can as I knew I might have these problems.
    Basically, on frame 2 I have a pre-loader - It reads a MusicXML file in, then iterates through each note, placing all the notes on the board in the right places.
    They are all placed in a parent Sprite.

    Then on to frame 3 where it simply scrolls that down the page.
    I load the MP3 in as a URL, and check it's sound.position - This tells me how far through the song it is in milliseconds.
    I wanted to check this every frame, but it returns duplicate results if you check it too fast, and results in a very low 10fps or so.

    If anyone has any ideas of a better method, I'll give anything a go.
    I don't think I can get around my preloader though, the MusicXML is extremely complicated.

    Ray Beez, it may seem to choke when it 'resyncs' - That's every 2 seconds, it will stutter as I'm moving it back into sync. The FPS stays ok though I find.
    The problem is the flash timer doesn't run at the same speed as the MP3 timer, so it goes out of sync without a recheck every couple of seconds.

    ADDED:
    Ok I solved it, after about another 5 hours of work!
    The solutoin was to rewrite the code that moves the board down the screen pretty much from scratch.
    I now use an overall flash timer (which is accurate enough) as well as the distance that I 'expect' to be through the song at any given time, and move the board to the correct position.
    Strange though, it runs at a smooth 50fps in IE8 and FF 3.5, but IE7 it runs at a not very smooth 50fps?!
    How can it still be 50fps yet clearly not be as smooth to the eye?
    NM, people shouldn't be using IE7 anyways
    Last edited by CreepyD; 07-22-2010 at 08:34 AM. Reason: Solved!

  9. #9
    Senior Member Ray Beez's Avatar
    Join Date
    Jun 2000
    Posts
    2,793
    You solved it but I was going to say, it might be better to dynamically created the clips/sprites as you need them and then destroy them when they are off the screen. Flash doesn't like huge movieclips (speaking from AS2 perspective. Maybe AS3 is different)

  10. #10
    Member
    Join Date
    Jun 2001
    Posts
    36
    Yea I did think of that, but the code to create them is pretty big, and I have a feeling running that will more than offset the lag of moving the large mc down the screen.

    I'll keep it in mind though if many pc's I test on do end up being too slow - It's certainly an option.
    Thanks for your help!

    ps. I would put the link back up, but my website has pretty much no transfer left this month.

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