My game lags in mobile devices.

Get help using Construct 2

Post » Thu Oct 02, 2014 8:07 am

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.
B
6
S
2
G
1
Posts: 77
Reputation: 708

Post » Thu Oct 02, 2014 8:20 am

How bad is the lag? Physics objects will slow down a lot if too many like more than 10 - 20 on mobile devices
B
32
S
7
G
2
Posts: 317
Reputation: 2,851

Post » Thu Oct 02, 2014 8:44 am

@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.
B
6
S
2
G
1
Posts: 77
Reputation: 708

Post » Thu Oct 02, 2014 9:09 am

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)
B
32
S
7
G
2
Posts: 317
Reputation: 2,851

Post » Thu Oct 02, 2014 9:27 am

@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 ??
B
6
S
2
G
1
Posts: 77
Reputation: 708

Post » Thu Oct 02, 2014 9:36 am

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...?
B
12
S
2
Posts: 80
Reputation: 816

Post » Thu Oct 02, 2014 12:19 pm

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

Image
B
6
S
2
G
1
Posts: 77
Reputation: 708

Post » Thu Oct 02, 2014 12:27 pm

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?
B
12
S
2
Posts: 80
Reputation: 816

Post » Thu Oct 02, 2014 12:47 pm

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.
B
6
S
2
G
1
Posts: 77
Reputation: 708

Post » Fri Oct 03, 2014 4:44 pm

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.
B
12
S
2
Posts: 80
Reputation: 816

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 18 guests