Low FPS - I'm Officially Lost

Discussion and feedback on Construct 2

Post » Sat Apr 29, 2017 1:00 am

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?
B
40
S
12
G
1
Posts: 532
Reputation: 4,147

Post » Sat Apr 29, 2017 6:35 am

Do you use any effects?

Personally, I had slowdowns related to the Shadow Light plugin.
B
40
S
12
G
1
Posts: 66
Reputation: 2,926

Post » Sat Apr 29, 2017 7:10 am

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.
Mistakes were made.
B
51
S
25
G
107
Posts: 1,581
Reputation: 60,458

Post » Sat Apr 29, 2017 7:42 am

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.
B
44
S
5
G
5
Posts: 412
Reputation: 5,771

Post » Sat Apr 29, 2017 8:55 am

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.
B
39
S
16
G
6
Posts: 542
Reputation: 7,617

Post » Sat Apr 29, 2017 9:28 am

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.
...
B
44
S
23
G
7
Posts: 286
Reputation: 7,985

Post » Sat Apr 29, 2017 11:47 am

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 :P.

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?
B
40
S
12
G
1
Posts: 532
Reputation: 4,147

Post » Sat Apr 29, 2017 1:49 pm

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.
...
B
44
S
23
G
7
Posts: 286
Reputation: 7,985

Post » Sat Apr 29, 2017 2:26 pm

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.
B
39
S
16
G
6
Posts: 542
Reputation: 7,617

Post » Sat Apr 29, 2017 8:56 pm

@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.
B
40
S
12
G
1
Posts: 532
Reputation: 4,147

Next

Return to Construct 2 General

Who is online

Users browsing this forum: lukewasthefish and 1 guest