Limit the fps

Get help using Construct 2

Post » Tue Apr 23, 2013 9:21 am

I'll try that, hope it's work for me... I'll report back to you, too.
B
50
S
12
G
7
Posts: 259
Reputation: 10,371

Post » Tue Apr 23, 2013 12:11 pm

I still don't use sounds on my project, so it's not au audio pb i think.
I have it on every device, even the Iphone5 (my game turns between 40 and 60 on an ipod 4).
The more I think of it, the more I think it's a cocoonSJ pb, but i never succeed in using Appmobi, to try on it lol.
Whatever, being able to define the fps limit would be very usefull to be sure to avoid this kind of problems.
B
11
S
6
G
2
Posts: 105
Reputation: 3,910

Post » Tue Apr 23, 2013 12:36 pm

It's probably Javascript garbage collection. We've worked hard to ensure the runtime doesn't create too many objects per tick, but occasionally it will do a full collect and that could make it skip a few frames. TBH for a garbage-collected language one "burp" every few minutes is a good result (badly done engines will be constantly choppy!), but I'm aware this is an issue. Hopefully Javascript engines will continue to improve and make collection faster and parallel (so it doesn't affect the framerate), and we'll keep GC optimising the engine to try and mitigate this.

I'd also be wary of:
- physics - avoid this *completely* if you want to avoid burps, because it creates huge amounts of garbage. It's difficult for us to fix because the physics engine itself does this.
- third party plugins, which may not be GC optimised
- creating and destroying large numbers of objects in events, since while C2 does recycle objects, this type of activity will probably flood the cache and end up creating garbage.

If someone could send me their project to test, I could investigate possible sources of garbage creation and perhaps make optimisations for the next build.Ashley2013-04-23 12:39:18
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,478

Post » Tue Apr 23, 2013 1:03 pm

[QUOTE=Venivididormi] 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.   :)[/QUOTE]

Big fan of Terraria huh? Me too! Good taste!

I too would like a way to limit FPS, but mine is purely because I'd like my project to feel like a retro game, and that's tough when the game runs smooth like a flash game.
B
10
S
2
Posts: 20
Reputation: 1,142

Post » Tue Apr 23, 2013 6:41 pm

Thanks Ashley !
How can I send you my file ?
B
11
S
6
G
2
Posts: 105
Reputation: 3,910

Post » Wed Apr 24, 2013 11:41 am

Ok, I think I found the pb at my end.

I optimised as much as I could my first world (101 draws in the biggest level, 7.7 mo of ram, 230 ko), that I decided to authorize myself a big image for the background (1024), to do nice clouds moving with the scrolling.
As I tried to get rid of everything one by one to find the pb, I tried my game with a 512 image, and the pb disappeared.
So i thought, ok, it's that, even if the Iphone 5 is supposed to handle that very easely, but as I'm naughty (lol, sorry english isn't my first language, don't know how to say that), I tried with the same image but at 1020.
And at that size, the pb was not there neither.
So I tried at 1023, and... it works !
I have now a constant 62 fps on my Ipad2 and Iphone5 (just once 58 on the Ipad2, but with no "burp" like before").
It's the same than before in my Ipod4 (between 40 and 60), whatever is the size of the image (1024 or 512, I think i'm more "stuck" with the number of objects on this device), but it's reaaly playable, even if the FPS do a kind of constant up and down.

So at the end, don't know if everyone here was using a big image, but it seems that the trick is simply, if you want to use a big image, to use a 1023 px image instead of a 1024.

Personnally, I will finally use a 512, cause the graphic difference doesn't justify (for my project) the differecne of size, and cause it will make me win memory (8.3 instead of 10.2 for the moment), what can be good when i will have my entire game (i'm still finishing the 1st world). Maybe I should try 511 too haha.

That's all !
:)goldentreee2013-04-24 11:45:52
B
11
S
6
G
2
Posts: 105
Reputation: 3,910

Post » Wed Apr 24, 2013 12:35 pm

Well, false reason it seems.
It was working well, but it came back, for really no reasons (with my 512 image).
It's complitely illogical it seems lol.
So the pb is something else !
I will continue to try to find :)
B
11
S
6
G
2
Posts: 105
Reputation: 3,910

Post » Thu Apr 25, 2013 4:45 am

[QUOTE=Ashley]It's probably Javascript garbage collection.[/QUOTE]

I was discussing this issue with a programmer friend and yeah that's what he guessed as well. Making sure sounds are preloaded does seem to have improved my project (for the first few seconds of gameplay which stuttered a bit before). But, i'll try to optimize further.   

Just added proper portals to my project, so you can warp between the randomized areas and your home area. Hopefully i'll cap a video and post it on dropbox or something soon.
B
8
S
2
Posts: 63
Reputation: 1,223

Post » Thu Apr 25, 2013 4:54 am

[QUOTE=Dominius2003]Big fan of Terraria huh? Me too! Good taste![/QUOTE]

Absolutely love that game, and other similar ones heh. But, i'm also mixing in a number of other genres, so it's not a clone. I know people will see nothing but terraria and braid until I replace the placeholder assets however. I want to post video now, but I don't want to explain "yeah yeah placeholder art" to everyone who watches it.

A bit of a conundrum, since posting the video might attract a good artist to replace the placeholders.
B
8
S
2
Posts: 63
Reputation: 1,223

Post » Thu Apr 25, 2013 7:47 am

@goldentreee - For an English-2nd-language speaker, you're doing amazingly well. Only the occasional "burp" in your speaking skills, but you're otherwise VERY easy to understand. Well done in your studies! English is NOT an easy language to learn, even if you grew up speaking it!

I'm also very glad you posted this help request, as it gives me a lot to keep in mind as my own project grows. I've been concerned, too, about putting too many objects on my screen, and I haven't even crossed 100 on one layout (I'm still in very early development)!

@Ashley - Thanks for the feedback on goldentreee's issue. It's nice to know that even if there is the rare-n-random "burp", it's not out of the norm for now. Looking forward to improvements when you make them. :) But I trust you WILL. You're good like that.
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
112
S
20
G
8
Posts: 741
Reputation: 13,636

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: GUN, Yahoo [Bot] and 17 guests