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

Get help using Construct 2

Post » Fri Jan 20, 2012 10:26 pm

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




B
12
S
2
G
5
Posts: 73
Reputation: 3,570

Post » Fri Jan 20, 2012 10:35 pm

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.. :\
B
28
S
8
G
1
Posts: 469
Reputation: 4,683

Post » Fri Jan 20, 2012 11:02 pm

It also depends on your computer. When I test a game on my crappy desktop I get less fps than on my good laptop.
B
29
S
12
G
7
Posts: 740
Reputation: 7,839

Post » Fri Jan 20, 2012 11:08 pm

Um, do you have anything on those 23 layers?
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Sat Jan 21, 2012 7:13 am

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.GenkiGenga2012-01-21 08:36:00
ImageImage
B
73
S
16
G
6
Posts: 1,038
Reputation: 10,473

Post » Sat Jan 21, 2012 4:37 pm

[QUOTE=GenkiGenga]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)?[/QUOTE]
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?
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,544

Post » Sat Jan 21, 2012 4:53 pm

@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?
B
83
S
21
G
15
Posts: 1,039
Reputation: 15,134

Post » Sat Jan 21, 2012 5:29 pm

@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.
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,544

Post » Sat Jan 21, 2012 6:03 pm

You can see the game there :
http://www.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...

B
12
S
2
G
5
Posts: 73
Reputation: 3,570

Post » Sat Jan 21, 2012 6:04 pm

I have a pretty old PC also...
B
12
S
2
G
5
Posts: 73
Reputation: 3,570

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 19 guests