How do I optimize for mobile game

Get help using Construct 2

Post » Sun Dec 20, 2015 8:23 am

I read https://www.scirra.com/tutorials/298/performance-tips-for-mobile-games and it says i shouldn't have too many sprites, saying more than 20 is too many.
Did he mean different sprites or different objects using the same sprite?

My game becomes really slow on iphone 6 when it has more than 100 objects but it needs to have many objects: many units bouncing off of walls and all of them has collision enabled. Walls have collision enabled too so that i can detect when my units are hitting walls (using Solid + Bullet behavior)

Thanks
B
5
S
1
Posts: 32
Reputation: 439

Post » Sun Dec 20, 2015 10:36 am

It means the number of instances inside the layout, regardless of different objects. But the greater the image size of the sprite the higher the performance cost per instance inside the layout. This includes every animation and frames.

Note: The number of different sprites in the project affects the download size of the game.
The Things you can create is only limited by your imagination. If you don't have the skills then use your motivation as a natural force to exceed all expectations. Chadori RebornXD
B
64
S
18
G
90
Posts: 1,119
Reputation: 59,567

Post » Sun Dec 20, 2015 10:39 am

kimtaein1 wrote:I read https://www.scirra.com/tutorials/298/performance-tips-for-mobile-games and it says i shouldn't have too many sprites, saying more than 20 is too many.
Did he mean different sprites or different objects using the same sprite?

My game becomes really slow on iphone 6 when it has more than 100 objects but it needs to have many objects: many units bouncing off of walls and all of them has collision enabled. Walls have collision enabled too so that i can detect when my units are hitting walls (using Solid + Bullet behavior)

Thanks


Regarding performance issues. What is your game exactly, maybe we can find something to disable while not needed . Ex. turning off bullet behavior while not on screen or etc.
The Things you can create is only limited by your imagination. If you don't have the skills then use your motivation as a natural force to exceed all expectations. Chadori RebornXD
B
64
S
18
G
90
Posts: 1,119
Reputation: 59,567

Post » Sun Dec 20, 2015 11:03 am

Thanks, my game setup is like this:
there are prisoners inside a circle. The circle is made up of rocks.
In the game there are about 100 prisoners and about 240 rocks making up the wall.
Prisoner has animation: 6 frame, 100x100 pixels each.
Rock does not have any animation and 44x44 pixels.

Rock has solid behavior and prisoner has bullet behavior so they constantly move inside the prison but bounce off when they hit the wall. It is crucial that i have about 100 prisoners.
i tried just using 4 large long rocks for walls, reducing instance count by 240 but the game was still very slow.

I think the issue is expotential growth of collision check as # of instances grow in the game. I am not sure how i can optimize this. I am using box collider. All my prisoners are in one layer and rocks are in another layer so if i could somehow skip collision check between prisoners and only detect collision between prisoner and wall, i think i can make it faster.

On my android test device, Galaxy S4, i get about 20 fps and on my iphone, i get about 50 fps.
I tried phonegap and inel xdk and verified that WebGL is being used.

Thanks
B
5
S
1
Posts: 32
Reputation: 439

Post » Sun Dec 20, 2015 9:38 pm

i used debugger profile and see
Engine: 58%
Draw calls: 14%
Event: 8%

I understand draw call and events, but what does engine mean?
B
5
S
1
Posts: 32
Reputation: 439

Post » Sun Dec 20, 2015 11:12 pm

Let's see what the manual has to say about that:

Engine:

the remaining time spent in the Construct 2 engine, which is the overall estimated CPU with the events, physics and draw calls times subtracted away. This includes processing behaviors and other engine housekeeping.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sun Dec 20, 2015 11:33 pm

Hm. Okay first off, I think that's just waay too many objects in general for mobiles, I know that it's very uncomfortable to hear it but you've gotta lessen the amount of objects and tweak the design of your game, but it seems that you've gotten the images to be a small size down, which is good.

And so far you've tested with PhoneGap and IntelXDK? What about Cocoon? Surely you've heard of Canvas+ and how fast it is.
Risk Rocket now available on Google Play
Image
B
36
S
15
G
6
Posts: 337
Reputation: 6,300

Post » Mon Dec 21, 2015 5:50 am

thank you both. the reason i wasn't using cocoon is because https://www.scirra.com/tutorials/303/how-to-export-to-cocoonjs says "Note: when exporting for Android, we recommend using Crosswalk instead since it has better compatibility with Construct 2 games. For more information see How to export to Android with Crosswalk. We also recommend publishing via Cordova for iOS." so it sounds like Scirra want us to use phonegap for ios and crosswalk for android.

Am i going to have trouble if i use cocoon?
thanks
B
5
S
1
Posts: 32
Reputation: 439

Post » Mon Dec 21, 2015 6:29 am

Well I'm currently testing using the Cocoon.IO and although I haven't started adding things like PlayStore functionality, IAP, or LeaderBoards, normal launching the game and playing my game is smooth.

Also, for your game I highly recommend that you try out the Cocoon.IO because it generally offers better performance.

You can head over to Cocoon.io (it's not a .com, just Cocoon.io. It's weird but apparently startups sometimes do that.) and there you'll find a bunch of resources to get you well acquainted with this service. Also, it's best that you avoid using CocoonJS, that was Ludei's past compiling/testing service. The new one is on the site I provided you with, and the community is alive on the Forum there.

Here's a link to a post pertaining how to use the Cocoon for Construct 2:
https://forums.cocoon.io/t/construct2-h ... ocoonio/45

Are there problems with Cocoon? Oh yah, in-fact you'll see quite a lot of Troubleshooting posts but it's a work in progress and if you want to see better performance use the Canvas+ environment that it has to offer.

They do have a payment model, but the only thing that's a real bummer is the Splash Screen and its $500 price tag to remove it....

Other than that, you can create a Free account that can hold up to either 2 or 3 projects... I forgot which amount. The paid memberships just offer faster compiling, holding more project, and some other stuff that you can check out on the website.
Risk Rocket now available on Google Play
Image
B
36
S
15
G
6
Posts: 337
Reputation: 6,300

Post » Wed Dec 23, 2015 12:48 am

i am going to try cocoon now because intel xdk crosswalk make my apk file too big even it is a blank project intel still spit out a massive 20+mb apk for one i dont worry about a splash screen once my apk file is small
seem more people cocoon over phonegap so i am going to try cocoon first. so @Usman Haq i'll see you over there lol
Image
B
36
S
11
G
2
Posts: 312
Reputation: 3,739


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 11 guests