Fixing HTML5 games in Firefox.

Discussion in 'Programming' started by xtmx, Oct 9, 2013.

  1. #1
    I've already tried updating and disabling add ons, so please don't suggest either.

    I am developing a series of simple HTML5 games. They work great in Chrome and IE (don't know about Opera, could someone educate me?). However, Firefox runs them slow and jittery.

    Example game: http://www.battlegame.net/games/runkitty

    What can I do, if anything, to speed up the games in firefox?
     
    xtmx, Oct 9, 2013 IP
  2. HowDoYou

    HowDoYou Well-Known Member

    Messages:
    443
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    130
    #2
    That game runs fine for me in FireFox 21.0, the same as in Chrome. 30.0


    My score was 778. :p
     
    HowDoYou, Oct 10, 2013 IP
  3. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #3
    Browser performance of so called "HTML 5" games (and I do say so-called since 99% of the functionality is JS, NOT markup) is varied, mostly the big problem being that firefuxxor's renderer is slow as molassas compared to chrome or IE. It's that simple, it's slow. NOT a lot you can do to compensate for that apart from trying to lean out and optimize the code.

    It's a bit like writing games where your minimum target is a 4.77mhz 8088 something I know a wee bit about -- with everything else being faster your best bet is to design/make it work on the slowest one first -- as then you're golden on everything better.

    That said it runs fine in FF here too, but I'm on a 2.93ghz i7... you run it on a i3 or an atom, FF won't be able to keep up while IE just might.

    Some simple optimizations might squeeze just a wee bit more out of it. I see a few variable += 1; where variable++; might be faster. (though barely measurable).

    Funny thing is, you might get better performance by NOT using canvas. You're not doing any resizing of the images so it might be much, MUCH faster across browsers to set that scrolling background as background-image and scroll it by changing background-position... skipping Canvas' built in rescaler. The whole tile-shift is sucking down a LOT of overhead there. Literally it might be faster to move elements around on the DOM than it is to draw them with CANVAS.
     
    deathshadow, Oct 11, 2013 IP
  4. HowDoYou

    HowDoYou Well-Known Member

    Messages:
    443
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    130
    #4
    Just ran it on my i3 in ff works perfect there too. :)
     
    HowDoYou, Oct 11, 2013 IP
  5. ApocalypseXL

    ApocalypseXL Notable Member

    Messages:
    6,095
    Likes Received:
    103
    Best Answers:
    5
    Trophy Points:
    240
    #5
    Just ran it on ye old Core 2 Duo with Opera 12 and a i7 with Safari - worked fine on both.
     
    ApocalypseXL, Oct 12, 2013 IP