Low FPS - I'm Officially Lost

  • I've developed quite a few titles using C2, and I love it as an editor, but for some reason on my current game I'm at a bit of loss as to why my fps is so low.

    I'm currently trying this on my laptop; it's a pixel platformer. At 100% size (640, 360), I'm using ~11mbs of video ram, and the cpu is anywhere from 10-20% usage (~70mb at fullscreen size of vram). I have around 1000 objects in the layout, but only a a few of them visible on screen at a time (most are UI elements that are on a global layer and hidden). My collision checks are relatively high (~60-70 per tick), but that seems to be about as low as you can get using the platform behavior.

    My laptop is a surface book with an NVIDIA GTX 965m; TWO gig of vram and a high end i7 processor.

    Now, that being said I do have a lot of relatively complex code, (camera functions, player movement, lots of weird overlap checks etc.), but even disabling most of the code doesn't seem to change my fps. It starts around 40-45 fps for the first 15-20 seconds and then randomly drops to ~20-30 consistantly (only occurs when maximized to full screen). If I scale back to 100% (640, 360), I obviously get 60 fps no problem (just can't see anything since my resolution is 3000 x 2000).

    I'm using node-webkit (latest april version, but it appeared on early versions as well). However, if I try using in chrome, I'm able to achieve around 50-60 fps but with ~80% cpu usage. This will be a steam release, which means I NEED to use node-webkit since there is no other available wrapper.

    Any suggestions? Thoughts? Words of encouragement?

  • Do you use any effects?

    Personally, I had slowdowns related to the Shadow Light plugin.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Have you tried on a different computer?

    Doesn't seem like memory issue, collision checks are low.

    Any physics or loops?

    It could be some sort of CPU throttling from the OS, but that is unlikely.

    Total system memory use? Caching vram to page file could cause the symptoms you describe.

    Otherwise... do you have a lot of layered/invisible sprites? With a high resolution screen like that, you might overwhelm the fill rate limit of your gpu.

  • The best you can do is to disable one part of your "code" at a time and see if it affects your FPS. Also if you use 3rd party plugins, you can try to delete them to see if that helps.

  • Things you can try:

    Disable effects on static objects - if you use effects on individual objects instead of layers it can quickly add up.

    Minimize use of loops

    Don't update non-essential stuff every tick

    Use low quality fullscreen scaling - doesn't make a difference for pixel platformers but can give a huge performance boost.

  • You probably know what your doing more than I do but ur object count is high and ur collision checks seem abnormally high for the game you are describing.

    Also the fact the ur fps is dropping may indicate some object spawning or array growing out of control. Though I think that machine should be able to handle anything you throw at it. (Obviously Chrome these days is set to hardware accelerated as default but it is worth checking in advanced settings maybe it got unticked).

    but before u start blaming ur code I would love to know...,

    1) what FPS are you getting previewing with Edge on the surface book?

    2) what fps are you getting from exported nwjs vs preview nwjs on the sb?

    3) what fps are you getting on any other machine?

    I ask because I have seen similar issues with previewing chrome and nwjs full screen on surface pro. But not when running exported. It may have something to do with vsync issues, or aggressive power saving (especially on the skylake models), while previewing chrome/nw.js on these specific ms surface pro/book devices.

  • Thanks for all the responses!

    @faulknermano - The only "effect" I'm really using on this particular layout is forcing own texture with a giant black tile over it (for darkness) and maybe 10-20 sprites that have destination out on them for a light source. I also have maybe 20 sprites with the additive effect.

    @oosyrag - total system memory use of nwjs is ~15mb. I've tried it on 1 other machine but I'm not counting it because it's nearly twice as powerful as this and runs at 60fps .

    I DO however have a ton of layers that are invisible (I have a ton of menu systems so I created them on a "start" layout and set the layers to global - then toggle them invis/vis when being used). It's probably around 400-500 objects, but the code isn't being touched until they're out (and even when so, I have everything in functions that applies to button presses).

    @nemo - I've just disabled ALL of my code and my fps is 20-30.

    @ErekT - I don't really have any effects on static objects aside from the destination out and additive blend fx. I've tried low quality but it actually does look a bit worse and doesn't help any.

    @NetOne - I thought it was collision checks but I had another layout that (embarrassingly) had around 4000 collision checks per tick....and that ran just as poorly (if not BETTER)

    I am spawning rain fx, but its getting destroyed (the object count never goes above a certain number). And trust me, I've stressed test construct like crazy, I need THOUSANDS of collision checks on a loop to start seeing any fps droppage on most games.

    To answer you questions:

    1. on edge I actually get 60 fps (strangely enough the edge isn't using my graphics card....it's using intel chip)

    2. same; ~30 fps on both exported and preview

    3. the only one I've tried gets 60 but like I stated few people have machines with that kind of power.

    I have also just recently updated my graphics card, too (as in yesterday), so I don't THINK it's that...

    So here are my guesses?

    1. Capx file is corrupt and I need to rebuild it

    2. I have 3 sets of tilemaps on top of each other; maybe there's some kind of rendering issue when you do that?

  • I would bring/send the nw.js file over to a friend with a crappy laptop and see what happens before you start meddling with your code.

    That fact that it runs 60 fps on edge (on the surfacebook?) on the intel grfx is telling me something more sinister is going on.

    Generally, so far, ive been impressed with the performance of C2 output considering all the hate it gets wrt performance. (I have a very alpha shmup running with sometimes 80 enemies and at least 200+ bullets with a scrolling background (also 3 layer tilemaps) all running at 60 fps on i5 and integrated grfx) . Also Im positive chrome is not sitting quite right with W10 on these surface devices but I dont know enough of the technical to prove it.

    Anyway good luck... hope you sort.

  • Are you using a lot of separate solids for platforms? If a lot of them are overlapping they'll be checking for collisions against each other as well as the player and enemies. Maybe try using a few large objects instead and set them up with polygon shapes that match your platform layout.

  • ErekT - I'm actually using the tilemap object as my solid behavior. That should be fine, though. It would, in theory, cause more collision checks in the debugger of that were the case, and in theory that would spike CPU.

  • If the game runs at 60 FPS at 100% scale but at a much lower fps when at full screen then you've got a GPU filtrate problem or your GPU is black listed by Chrome. The game logic cannot be at fault. C2 offers a low quality upscale setting, which might help. You could also try running nwjs using integrated graphics....

  • To me it sounds like the blend mode for the lights or some effect. Tried to disable layers with blend modes? you mentioned you have a huge black sprite covering. I would probably think it's something related to that. Have you tried enable use render cells on some layers?

  • Colludium - interestingly enough, integrated graphics from the intel chip run ~45-55 (every once in a while even hitting 60). I have no idea what that means...if my graphics card was blacklisted by chrome, wouldn't it not be good in chrome as WELL as nw?

    @tunepunk - I've tried deleting all of the offending sprites with layer fx on them to no avail. The layout is only a couple of small rooms, too. It's not nearly as massive as anything else will end up being (or already is!)

  • UPDATE - I had a friend test an HTML upload; interestingly, he said it chugged pretty hard in chrome (not webkit), but on IE it ran smooth as glass. He has the same laptop I have, as well. When he did a test for cpu and memory (in game), he said CPU was at 99% and memoryimageutil was at 0 (which seems odd to say the least).

    There has to be some sort of solution here...

  • I've noticed with the recent versions of chrome that webGL is disabled by default now. so perhaps its running canvas 2D.

    Try making a text box with the text set to system.renderer and see what it says. My guess is that its defaulted back to canvas 2d.

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