Hi, I'm currently making a game for android with Construct 2. I have the latest beta version of construct, and I wrap my game with Intel xdk/crosswalk (latest version)
I have read everything there is about optimizing my game for mobile, followed every tip and trick to make my game stop lagging, but cant figure it out.
Its a simple autorunner type game where the layout size is 50000 x 720 px and all objects are placed on the layout on start.
I tried reducing 50000 to 5000, but no change.
The main game layout has about 140 objects (many instances of same object), and only about 10 of them has collisions enabled.
I' ve tried to delete almost all of the objects, but my framerate doesn't really change.
I've also tried disabling most of the events, disabling animations, and all every tick events.
I use Spritefont and not text object, and have no huge sprites on layout.
The game shows fine in internet explorer, with an almost steady 60fps, much better than the 30fps in chrome.
As stated above, I wrap my game with intel and crosswalk.
In the Intel preview window, it runs smoothly, but not on mobiles.
I'll give more information if needed, and hope someone can help me with this.
Develop games in your browser. Powerful, performant & highly capable.
To get proper help, I would suggest to attach the capx of your game. Then some experienced C2 users can have a look and can tell you what may cause the most problems.
A while ago, I solved a similar problem in Chrome disabling WebGL support. Maybe it help at least in chrome... XD
It's hard to say what the issue is, without having seen your code. I began using Construct 2 only 4 days ago, and after having made my initial game, performance was great on iPad (4th gen) but sucked on my iPhone 5. Especially if I increased my particle count (my scene spawns particles everytime a mouse button is pressed).
And so began the optimizing...
What I found - I hope you can find some of it useful:
In the project settings:
Last, try and test your project if you resample everything to fit 500px height. Maybe it's fast for you to do this check - if not, just use some dummy graphics with lots of details and colors, and basic scrolling behavior. This should give an indicator if it's worth pursuing this path.
Sorry for not replying sooner, and thank you all for your replies.
I still can't figure this out, so I attach the capx here , and hope someone can help me out with it.
Really appreciate the help
I cant open your capx because you heve "Move to" "Pause" and "Admob ads" Behaviors, but I think that your problem is your movile device or your browser is not fully html5 compatible
first 50000 or 5000 is big , you are working on autorunner you don't need that layout size , and 140 object is too muc , read the tips below there is some tips that you might not finde in the performance tutorial :
just split it for example the background for the sky used a tiled background using small 32x32 single color image.
and the backgrounds element as sprites for examples the trees and clouds and moutains each one of them in a sprite , that would be usefull to make parallax too to make the game looks nice.
and finally in export process don't forget to compress Png even brute compression isn't bad C2 suggests normal compression because it takes less times i didn't have problems with brute compression. and don't export to phonegap it kills the game performance.
when you make project be sure to do all the above and i'm sure it's going to be fine.
ohh i mostly forgot , don't forget to destroy objects outside of layout or when it not needed anymore. some people spawn a lot of objects like in autorunner the obstacles will randomly generated and keep moving until they leave the layout view. it's not helpful at all t have 100 ojects keep moving to the infinity , and the apps makes the calculations for them while you don't need them anymore.
i hope this helpful , i'm sure you have read the performance tips in the tutorial but i have mentoned other things that might be very helpfull too.
Thanks for all the tips! its really helpful.
What's the best solution for spawning objects in my game? Since this autorunner have to be the same level-layout every time you play. Should I make them all bullets and have a timer to create them, or is there a better way of doing this?
What am I doing wrong?
I deleted all my objects (the only ones left where the tiled background, the player, and ground)
My game STILL lags!
Thanks for all hjelp, will post game when finished.
https://www.scirra.com/tutorials/4832/h ... en-layouts
I though this trick will work for you
David, I know you don't have a C2 license, and I don't know if you're able to see the debug without it, but if possible, there will have a ribbon with what is consuming your resources and how much.