Mobile / cocoonjs optimisation tricks ?

Discussion and feedback on Construct 2

Post » Tue Mar 19, 2013 10:14 am

Hi everyone, I spent my last days trying to optimize my game for mobile (already read all performances tips). The game is a simple horizontal runner game, with one long layout (500*100,000 pixels). I use cocoonjs 1.3 to export it on mobile.

What is strange is that i achieve a 60-62 fps on my Galaxy Note 2, about the same rate on my desktop PC, but the sprites and background on mobile are not scrolling smoothly like on my desktop.

It's like every second there is a micro-freeze or lag of the sprites or tiles elements. The FPS is not really dropping when it occurs, it stays at 58-62. The feel is better on Iphone 5 though, but on android even with high FPS the scroll is not smooth.

Is the issue on CocoonJS wrapper? Somebody else experience such thing ?
I don't use any effect, I tried to disable some behaviours, use tiny sprites, I haven't found the cause.

For scrolling I use :
* EveryTick > System : set scroll X to player.X + 150
* player have a bullet behaviour with a speed of 300.
B
4
Posts: 12
Reputation: 649

Post » Wed Mar 20, 2013 3:37 pm

Your playfield area its too huge.

In our game, Sigurd's Havoc, we used a static playfield with moving background, giving the impression of falling in a "infinite" level. All enemies and game elements are created dynamically. These elements are also destroyed after leaving the game screen, reducing the number of objects.

Maybe this can help you to reduce these micro-freezes.
Image
B
26
S
10
G
5
Posts: 25
Reputation: 3,130

Post » Wed Mar 20, 2013 6:04 pm

@Keyo

is it possible that you upload a sample capx.? I'm very interrested in your technique since i was trying to do this too but never achieved a good looking result.
B
23
S
6
G
5
Posts: 132
Reputation: 4,487

Post » Wed Mar 20, 2013 7:15 pm

The layout size should not affect anything, since it's basically only used to limit scrolling.

The micro-pauses are probably garbage collection. There isn't much you can do about it, since Javascript is a garbage collected language. The latest build (r123) has some small improvements which might help, and often it clears up after 20-30 sec (once it's got the main garbage out the way).
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,574

Post » Wed Mar 20, 2013 8:20 pm

Ok Ashley, Ludei told me the same thing, that "it's probably garbage collecting, on js or java side".
I will try the last build with the hot fix tomorrow.

However, I wonder if I decrease the game screen resolution (window size) of the game exported to cocoonjs, could it boost the performance or memory used ? Or is it unrelated ?   


B
4
Posts: 12
Reputation: 649

Post » Sat Jan 03, 2015 11:33 pm

Ashley wrote:The layout size should not affect anything, since it's basically only used to limit scrolling.

The micro-pauses are probably garbage collection. There isn't much you can do about it, since Javascript is a garbage collected language. The latest build (r123) has some small improvements which might help, and often it clears up after 20-30 sec (once it's got the main garbage out the way).


So, Scirra don't can solve this micro-pauses question? I playing many mobily games that are made with C2. E.g. Hungry Hal. And much more. All have the micro-pauses. This doesn't inspire me to buy the C2 personal or business license... :?
B
2
Posts: 9
Reputation: 168

Post » Sun Jan 04, 2015 5:24 am

@alatok

Yes, you can make great game with Construct 2 but you have 0% guarantee that it will work well on any platform :) Anyway I disagree with you - Hungry Hal by @ArcadEd works quite well, thanks to @ludei. From the other hand jittering is very visible on Star Nomad by @Silverforce, thanks to Crosswalk and bad Chromium.
B
18
S
6
G
1
Posts: 783
Reputation: 4,167

Post » Sun Jan 04, 2015 7:18 am

@szymek Star Nomad on iOS is damn smooth. Thanks to WKWebView. Minor bugs aside, its perfect in terms of performance.

I have had zero user complaint on Android regarding stutter, only a bunch of "app crash, 1 star" from users with ancient devices that don't even meet my minimum specs. On my own devices, it stutters for the first 20-30 seconds (which is fine for some games) but after that it smooths out. It behaves differently than Chrome 38+ where the random stutter is just there all the time.

I did have random stutter on CJS Android with Canvas+, for both Star Nomad & Ninja Girl, but I'm happier with Crosswalk for them both now.

Android: https://play.google.com/store/apps/deve ... dios&hl=en
iOS: https://itunes.apple.com/WebObjects/MZS ... =943377727

I think moving forward, iOS8's WKWebView is a godsend for C2 games because its just so damn fast and low memory. Android we're stuck with sub-optimal options for a long time yet.

Edit: I did notice an improvement in smoothness when I switched my Android devices over to ART (was Dalvik). That's a good sign since Android 5+ is on ART.
B
60
S
21
G
18
Posts: 1,741
Reputation: 16,800

Post » Sun Jan 04, 2015 8:08 am

@Silverforce on YouTube movie I see smooth movement, on Android (even when I switched to ART) I see jumpy movement. I guess that many players think that it's the way it should be (because your game has nice, old school feeling). Anyway: how do you use WKWebView? Compile game with PhoneGap?
B
18
S
6
G
1
Posts: 783
Reputation: 4,167

Post » Sun Jan 04, 2015 9:43 am

szymek wrote:@Silverforce on YouTube movie I see smooth movement, on Android (even when I switched to ART) I see jumpy movement. I guess that many players think that it's the way it should be (because your game has nice, old school feeling). Anyway: how do you use WKWebView? Compile game with PhoneGap?

Phonegap doesn't support wkwebview for now, they have some kind of a plugin for a local webserver to run wkwebview and some other plugins, but only in pre-alpha versions, they are waiting for a fix of a bug where wkwebview can't load local files. Ludei webview+ is a wkwebview, works damn good, but i heard that saveload and webstorage can be cleared there randomly.
B
22
S
9
G
7
Posts: 415
Reputation: 6,527

Next

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 9 guests