0 Favourites

My game lags in mobile devices.

  • I have made a game which uses physics. There are many objects used in a layout and some big background images. I am aware of optimization tips and followed the document about optimization very closely. Total memory in use is about 17mb and Approx download size is 8mb. Still my game lags in mobile devices, even in iPad. is there something else missed.

    P.S.- I already compromised on the BG and cant go any further. Bg's are used of size 960x540.

    Please help. I am stuck.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • How bad is the lag? Physics objects will slow down a lot if too many like more than 10 - 20 on mobile devices

  • IndieKiwi: Not too much, but still significant lag. But on some devices, its too much. But you guessed it right, there are many physics objects in the scene, but i cant remove it. Is there any way round.

  • I guess destroy them if they leave the layout or are no longer needed and reduce the collision points and the obvious thing is reducing the physics objects. So as far as i'm aware no real work around.... You could also try another physics engine. (In your project properties)

  • IndieKiwi: Isn't objects are destroyed when layout is changed ?? For objects, I have limited the number of collision points to max 5-6. mostly 4.

    Well, its a noob question, but how can I change the physics engine ??

  • Run your game in Construct 2, in debug mode - then you can see whether your objects gets destroyed or not.

    The physics engine is changed at the same place where you write your project name; just click outside your scene at an empty place; then click "View" for project properties.

    I always use the Box2D physics engine, it works fine, even with many sprites (~500) that collides with eachother continously.

    Can you show us something of the game you're making, to help us help you...?

  • jakobdam: Well, it was Box2D engine selected already. Sorry I cant share the game link as it still under development , but I did shared a screenshot with debug window. Hope it will help you (and others) the things which I couldn't.

  • Mmmm it's scrollable, so there's stuff that we can't see.

    But from I can see:

    • Your object count is fine; 129 sprites is nothing to worry about
    • You check for 233 collisions per tick - that's some, but I use more than 500 per tick in one of my projects, and performance is fine on the iPhone 5, even with slower iOS 7

    What hardware are you using? What generation iPad...?

    With you iPad, please try this link:

    http://www.jakobdam.dk/0-GAME-DEV/ChainPopper-v1r1/

    • it's a very early development version of a game I'm currently working on.

    Does everything happen smoothly - even when there's many balls popping - or is performance poor?

  • Yes.. Other screens appears smoothly. Just in case of levels, like this, (there are 10 levels in all). the game lags in this only.

    But the case is, the game is significantly lagging in mobile devices.

  • Ok - if your iPad can play my game smoothly, but cannot handle your game, then there's some funny business going on...

    You've read the optimization guide (as you say in your first post) - but there may have been a few things that you have missed (I can almost always find new stuff to optimize when I go through my projects).

    • As far as I've seen, using a sprite font can save you a lot of performance; especially if the text moves. It doesn't look like yours does here, but I don't get the whole picture of what you game is like from seeing the screendump... It may be relevant to you, it may not - either way, it shouldn't cause an extreme performance drop or improvement.
    • Sprite instances that are spawned (create object) but never destroyed when they should be, is a major issue for many; go through all your "destroy sprites" routines, and make sure than you don't have leftovers when coming from one level to the next (if that's relevant in your game).
    • Rotation is a major performance dropper - especially if used with transparency stuff and/or scaling. I.e. the worst you can do is making a sprite rotate while it changes size and becomes gradually invisible.
    • It could also be the many physics objects that you mention; but on your PC, install a GPU meter; then check your GPU performance. How does it scale when running the game? If your PC's GPU-usage exceeds 80%, while your CPU stays relatively low, then it's probably not physics related.
  • jakobdam: Thanx for this detailed analysis. Took hell of a time to understand every point.

    Well, i will start from point to point.

    -I am using sprite font, but they are not used too much (as you can see in screenshot), only once, that too, is not moving

    • Here explain me one thing, if I switch layouts, will the sprites from previous layout is destroyed automatically ??or do I need to destroy it at start layout event ?
    • As you have guessed, all bg and objects are static, only car is moving. (in some cases AI cars moving), so nothing problematic here.
    • I will check it and tell. Also I am trying some more things. if it still not work, i will try to produce a playable link for you to check. I dont want to go back on this game now as it is almost complete
  • you can replace rotate by rotate animation

  • you can replace rotate by rotate animation

    In my game, there is no rotating objects. In fact Only player car is moving, by car physics behavior. Every other objests are static

  • jakobdam: I have uploaded my project on a server. Here's the link

    goo.gl/lomzR5

  • Tested on iPhone 5, iPad 4 and Windows PC in Chrome and Firefox; no problems - no lag at all.

    My PC's GPU is at ~65%, which isn't anywhere near tuff. My CPU is at ~15% - likewise, this isn't bad at all...

    Maybe you test platform is the issue? How much free RAM do you have? Fx. try and install MemoryInfo or a similar app that can cleanse your RAM (so you don't have to reboot the device).

    Also; are you using Safari or another browser, for testing?

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,639
asikanddestroy's avatar
asikanddestroy
Unread hot topic
232 177,672
Tetriser's avatar
Tetriser
Unread hot topic
266 15,900
GameeApp's avatar
GameeApp