Control the performances: why so irregular?

0 favourites
  • 12 posts
  • Hi,

    I've encountered a lot of more or less important problems during the last months, but I know there is always a way to fix them or an alternative solution... it is just a matter of time. In term of gameplay implementation, I'm satisfied and can't wait to add new functionalities and the final assets.

    But something worries me muuuch more than specific issues: the global "lag" of my game. I don't remember when, but at one moment of the development, the game started to "lag" on my laptop. On my computer at work it seems ok, but that kind of games are supposed to be played on (almost) every computers, aren't they? More generally, whatever the computer, sometimes the game is fluid, sometimes it's really slow... and during "long" sessions, it gets slower over time.

    I'd like to share my project (WIP) in order to help you (and me) understand why the result seems so... unstable. Maybe it won't be laggy on your computers, I don't know..

    The html game:

    The C2 file:


    ("space" to pause the game and restart a new one, click to drop balls)

    At first sight, the projet could seem to be a mess (in which I'm not lost, fortunately), there are a lot of global variables (too much? I don't know), but not too many sprites nor too many physical objects (according to the tutorial I've read about optimization), and I think I destroy all the created objects when they're not useful anymore... I don't display anything extraordinary so where am I wrong? Which fondamuntal mistake did I make?

    In addition, I'm actually not sure that the FPS displayed is really consistant with what's happening... Something the FPS seems pretty great while the game is slow... eventually really slow...

    I can -eventually- give up some further features, but I really don't want to create a laggy game, I must be confident in what I'm doing, and not beeing afraid by everything I will add in the future in this project...

    Please help <img src="smileys/smiley19.gif" border="0" align="middle">


  • I noticed a similar problem with my game a few days back, that suddenly the game was stuttering, despite a pretty good fps. This only happened in firefox though, was fine in all other browsers.

    The weird thing though was that when I exported the game and played it from a remote host it ran fine again. No idea what's going on, but firefox appears to suddenly dislike myself hosting the game. Have you tested running it from an external server? It might be a similar problem to the one I'm having.

    As a side note though, your game's running pretty well for me in firefox =)

  • Haematite: I experienced the same "lag"/"chopiness" after updating to FF 10.0

    I'm relieved to learn that it may have to see with localhost only.

    There were new additions with the indexdb that may have occured some slowdowns. First time I experienced it was with Ashley's first example of particles.

    I got 60 fps solid and fluid in chrome, and around 45/50 with "freezes" in FF10. I was a sad panda. Trying right now, I got 60 fps in both and fluid in both ^^

    2nd demo is a bit more intensive. It stabilizes to 50 fps and ~800 objects in 1920X1080, FF10 maximized.

    But I believe a 10.0.1 patch or superior could fix it, and by FF 11 we should gain again some of the fluidity that appeared to have been lost between 9 and 10.

  • Thanks for your answers <img src="smileys/smiley20.gif" border="0" align="middle" />


    What do you mean by "pretty well"? It is perfectly fluid (it can be sometimes, exactly as it should be) or just.. acceptable? How long was your session? (not long I suppose, since this is just a semi-prototype <img src="smileys/smiley9.gif" border="0" align="middle" /> not very fun)


    In my case, according to you... Where does the problem come from? (if there is one)

    Browser? As far as I've tested, the performances seem similar from a browser to another.

    C2? Is there some specific things that C2 hardly deals with? Or some specific options/features I haven't enabled/disabled?

    My project? Did I something fundamental wrong? Too many loops? Too many sprites? Too many physical objets? Seriously I don't think so... That's why I don't understand... If you don't have the time to check the .capx, I'll sure understand but please have a look at the web version... It might give you a clue about what could be wrong in all that mess...

    My project is currently much less "intense" than the demo you posted (particularly the second one).

  • Sorry, should have been clearer! It ran completely fluidly, almost constantly 60fps, lowest it dipped was 57fps. That was after playing for a few minutes =) Also, I like the graphics btw!

  • and during "long" sessions, it gets slower over time.Define long.

    Played it for 3 minutes on a PC with powerful CPU and a slow graphics card. In Chrome the FPS alternated between 49 and 51 with no problems.

  • The problem with FF is the garbage collector. It runs at times not entirely appropriate, causing those lags.

    In the Nighlty Builds, for what I saw on the bug tracklist (FF 11, 12 or 13, I don't remember), it's going to be better, with a new generation of GC...

  • So... According to you, what should I do? On some computers it's as fast and fluid as it should be. On others, it's just... slow, really slow, like if the time itself was slowing down. I don't see any consistency in all that.

    Seriously, I find C2 definitely amaaaazing as a software (seriously, for a game designer it is an incredible opportunity to concretize my ideas and C2 is much more friendly-user and deep than what I've experienced before), but the exported result is sometimes disappointing... I work with two talented friends (Haematite, if you like the current visual, you'll be totally seduced by the final graphics, FX and animations <img src="smileys/smiley30.gif" border="0" align="middle" />) and I don't want to let them down with a laggy game...

    I don't even know if the problem comes from me, C2, HTML5 or the different browsers... I'm a bit desperate, I must admit.

    But thanks for your answers anyway.

  • Have you read Performance Tips? How many objects do you have created and which renderer is in use?

  • I've updated the project in the first message, but you can access it from there:

    Now are displayed FPS, renderer, number of objects and number of physical objects. The last count is "home made" so I could have missed some of them but I don't think so.

    I've "cleaned" the project and on my work computer, it's perfectly fluid but it has always been. At home, it's a little bit slower but it remains totally acceptable.

    I'll retry on the computers on which the results were somestimes terrific and let you know about the hardware etc...!

    Thanks for you answer anyway!

  • Runs just fine with a steady 60 fps here. Would be helpful to know the browsers/graphics cards/OS/WebGL support of any machines with performance trouble. Updating their graphics card drivers may help too.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Runs fine here2, cool btw :)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)