Limit the fps

Get help using Construct 2

Post » Tue Apr 23, 2013 12:06 am

Hello !

My question can seem stupid, but in fact no lol.
I have a game, for IOS, running at 60 fps, but sometimes, for no reason, it falls to 58 or 52.
Even if it's great to stay above 30, my problem is that when I try it on my ipad (via CocoonJS launcher), when this little fall of FPS arrives, you can really notice it on the screen, i mean, you really see the fps fall. (the game "stops" for an half second or something)
I don't know if it comes from Construct, my game or Cocoon, but i just don't want to see it.
It's a shame, cause i'm always above 50, but you really notice it.

So my question is : is it possible to set the max fps of a game, to avoid that ?
and another question : if it's a cocoon laucher pb, will i have the same thing with the compilation ?

Thanks !
B
11
S
6
G
2
Posts: 105
Reputation: 3,910

Post » Tue Apr 23, 2013 12:24 am

I get something similar when playing the games i'm working on. The framerate is solid for a while and then suddenly there's this "burp" for a second where everything freezes, and then it continues at high framerate. Usually only seems to occur once per play session, but it's a pretty nasty framerate drop when it happens. There's nothing in my code that should cause it from what I can see, and occurs even when exporting to executable. The executable is nailed at 60fps until this occurs, burps, and then back to 60fps.
B
8
S
2
Posts: 63
Reputation: 1,223

Post » Tue Apr 23, 2013 12:46 am

Its hard to say what the problem is unless you post a video on what your working on, or maybe a playable demo (you don't have to post your capx file if you don't want to). It could be C2 itself or it could be one event you have somewhere in your source file thats causing something to go rigid or doing some additional processing that shouldn't be done, but once again I can't tell what kind of game your working on.

Here's a guide that may help you with your performance:
https://www.scirra.com/manual/134/performance-tips
B
18
S
4
G
3
Posts: 436
Reputation: 4,801

Post » Tue Apr 23, 2013 1:01 am

@Venivididormi I think this could be caused by a large texture being loaded or CPU intensive process, happening.

Also consider other applications calling the system resources in the background...

We need a

"if framerate Burp" Condition ....
As long as I can move left, right and fire, I'm Happy...
B
42
S
15
G
11
Posts: 655
Reputation: 12,260

Post » Tue Apr 23, 2013 1:44 am

I had this issue too, i had no idea it decreased from 60 fps to 48 fps after of 5 minutes of playing.

When i connected my iPod to recharge battery, it won't decrease fps during 20 minutes of playing.
B
96
S
25
G
20
Posts: 3,052
Reputation: 22,638

Post » Tue Apr 23, 2013 1:49 am

I'm tested my game with Samsung Galaxy s2 and galaxy s3 via Cocoonjs by @ludei, now i'm in the same trouble.
My game running good in galaxy S2 with fps range 55-66 all the time, but with galaxy S3, after testing a few minutes, the fps drop to 38-4x fps and i really don't know why... I think galaxy s3 with powerfull hardware than s2 can run even smoothly.
I'm tested 2 of my games, galaxy S2 work fine and game run on Galaxy S3 always drop FPS in a few minutes, from 6x to 4x. I try anythings i can to change my code and etc to fix the problem... But it's still happen. I'm about to release my game to google play.

farsmile902013-04-23 02:08:18
B
50
S
12
G
7
Posts: 259
Reputation: 10,371

Post » Tue Apr 23, 2013 2:13 am

[QUOTE=Pixel perfick] @Venivididormi I think this could be caused by a large texture being loaded or CPU intensive process, happening.
[/QUOTE]

I think it's a texture/asset being used for the first time. It seems to happen when the player is moving quickly into new parts of the map. But it's a little frustrating because i'm preloading and then even waiting a couple seconds before the player gets control and can see the world. Is there no "pre-cache everything, don't stream" type toggle somewhere? This is far after the layout loaded events have fired, so why would something already loaded into memory cause a burp when being used the first time? (Assuming we're correct at all lol)Venivididormi2013-04-23 02:18:36
B
8
S
2
Posts: 63
Reputation: 1,223

Post » Tue Apr 23, 2013 3:14 am

I admit I am kinda pushing the engine a little, heh. Here's a screencap of the project with and without the realtime lighting enabled.



However, notice i'm getting 60fps in both. In a browser it's between 35 and 40. So, the occasional single burp that goes from 60fps to zero and then back again within a second or two... odd.   :)Venivididormi2013-04-23 03:15:54
B
8
S
2
Posts: 63
Reputation: 1,223

Post » Tue Apr 23, 2013 6:18 am

I don't know the problem come from construct or cocoonjs, trying many time to change my code and fix the problem about suddently drop fps, but failed.
B
50
S
12
G
7
Posts: 259
Reputation: 10,371

Post » Tue Apr 23, 2013 8:30 am

[QUOTE=farsmile90] I don't know the problem come from construct or cocoonjs, trying many time to change my code and fix the problem about suddently drop fps, but failed.[/QUOTE]

I was just reading the manual some more and found that images and code are already loaded by the time layout loaded events etc have fired. I realised this might be related to sounds instead, since they're apparently loaded afterwards. I added an audio 'Preloads complete' condition to my level loader and the burp issues didn't occur when I tested it. It was just a quick test though so i'll report back if I see the issue again. Quite possible just a fluke it didn't occur.
B
8
S
2
Posts: 63
Reputation: 1,223

Next

Return to How do I....?

Who is online

Users browsing this forum: Vodakman and 25 guests