0 Favourites

How do I optimize for mobile game

  • 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

  • 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.

  • 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.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • 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

  • i used debugger profile and see

    Engine: 58%

    Draw calls: 14%

    Event: 8%

    I understand draw call and events, but what does engine mean?

  • 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.

  • 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.

  • 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

  • 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.

  • 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

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread sticky
763 305,671
asikanddestroy's avatar
asikanddestroy
Unread hot topic
232 177,678
Tetriser's avatar
Tetriser
Unread hot topic
266 15,903
GameeApp's avatar
GameeApp