Is there a way to know what makes the Fps to Drop?

0 favourites
  • 15 posts
From the Asset Store
Create a game inspired by great arcade classics as Operation Wolf
  • Hi,

    So I have a game with things happening...

    In WebGl, I have a fps of 20...

    It's quite low...

    If I disable all my game scripting, it's still around 20!!

    So I guess that's what is on the screen...

    I have 23 layers

    Some transparancy

    a layout of 4000x1000

    and a window of 1000x600 with a scrolling.

    The same size of layout & window but empty, with all the game scripting running. I'm at 55fps...

    So...

    I guess that's all the layers... What do you think ? Is that possible ?

    If I change things to use more the Z order than layer, will it be better for the fps ?

    Thx

  • By scripting do you mean you disabled all of the events?

    You can check that it is in fact running in webgl by setting text in a text object to "renderer" without speech marks.

    I'm using 9 layers at the moment and it's running solid 55-60fps.. but then again my layout is smaller than that.

    only other thing I can think of is check your sprite sizes.. :\

  • It also depends on your computer. When I test a game on my crappy desktop I get less fps than on my good laptop.

  • Um, do you have anything on those 23 layers?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi Guicole,

    Your layout sounds similar to mine (but you have more layers!).

    First step - follow the steps in Ashleys release post about image compression, when i did this my performance must have went up around 400 percent (I guess those smaller images were able to be loaded faster)?

    If you have already done that then i would consider changing your resolution, Is the 1000 x 600 resolution really neccesary? (what are your plans for the finished game? - chrome store?) try it on 800 x 600 and see if this fixes the Fps issue.

    (My platformer started with a 1024 x 768 layout - Then i found out you need no bigger than 800 width to be able to upload to Kongregate. Resizing and reordering all those tiled background objects to keep the same ratio was a massive pain... but the end result is my platformer now runs faster and will be more available to those on lower end computers... (with any luck that is)....

    Not sure if this helps but its my experience so far.

  • First step - follow the steps in Ashleys release post about image compression, when i did this my performance must have went up around 400 percent (I guess those smaller images were able to be loaded faster)?

    I would be really surprised if this was the case because images are always decompressed to 32-bit bitmap in memory regardless of how they are saved. So using JPEG, PNG-32 or PNG-8 only affects the storage (filesize) and it will always be decompressed to 32-bit bitmap on startup, so there is no reason for this to affect the performance at all. I would expect you accidentally changed something else and that improved it!

    In my experience the main things that cause slowdowns are:

    • Physics behavior. It's really CPU intensive. You probably shouldn't use more than 50 objects with the Physics behavior.
    • Creating too many objects. If you make > 1000 objects you're probably giving the CPU too much work to do to keep a good framerate. A common way people do this is using grids of tiles made out of sprites. That's a really bad idea, it can add hundreds and hundreds to your object count, always used Tiled Backgrounds instead.
    • Not using hardware acceleration. Make sure the system expression 'renderer' returns 'webgl' since your computer may not support it even if you turn it on. Also, updating your graphics card drivers and keeping your browser up to date should help with that too.

    A rarer one is using too many loops, but you really have to use a lot of loops to hit the framerate.

    Can you tell us a bit more about your game, or show it to us, so we might be able to figure out what might be causing the slowdown?

  • Ashley

    In CC I would have more than 10,000 objects at a time and no FPS drop. Is this because of my PC, which is pretty good, or C2 can't handle as many objects?

  • 7Soul - Javascript is slower than native code so C2 will be a bit slower than that (10k definitely sounds like too much for JS to handle). However, I think it's very rare for games to need that many objects - so despite the lower limits most games should work fine in HTML5 I think.

  • You can see the game there :

    guillaumecolomb.org/games/cloudycity

    Of course, it's not finished at all...

    It's a city management game.

    If you press 6, you can display the Fps & the nbre of objects.

    A lot of objects are actualy text taht I use for Debug (if you press 1-7)

    So if I remove all the debug option, the game runs with 200 objects, but still at the same fps...

    I don't have any physics...

  • I have a pretty old PC also...

  • I'm using 2011 13in i-5 Macbook Pro with the Intel 3000 graphic chip. Was getting 45 - 51 FPS the whole time. On google chrome of course.

  • I would expect you accidentally changed something else and that improved it!

    I wouldnt be surprised. I wonder what it was then, perhaps it was just something to do with the recent releases. Sorry didnt mean to misinform you there.

  • Solid 60fps in Chrome here. Does 'renderer' return 'webgl'? If you have an old PC it might not be supported and fall back to the slower canvas2d.

  • I thought I'd write up my tips in this thread in more detail for the manual. See Performance Tips.

  • Thx for the tips.

    So I guess, I can't really do anything.

    It must be my computer.

    Intel Core 2 Duo P8400 2.26GHz, 3GB Ram

    On Windows Vista Home Premium, Service Pack 2.

    Like now, after a small clean up of the computer, I have a good 45 fps (In WebGL)

    Thx for the tips Ashley!

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