How do I stop my physic game lagging too much on mobile

Get help using Construct 2

Post » Fri Aug 29, 2014 3:05 pm

Hi there,

I m new on Construct 2 and I have a problem with my game, in truth a HUGE problem. My game is a vertical scrolling game where a player must avoid things that falling from the sky, and after must climb them. The problem is this: I think that the physical objects are causing a lot of lag on my game especially at the beginning of the game, but in debugger mode "the events" are the first on consumption level.

I' ve searched on the forum for solutions and I've tried these with poor results:
-Use SpriteFont
-Use "Every X seconds" instead of "Every tick"
-On start of layout delete the sprite out of the layout that are useless
-Use Box2D asm.Js

And I create this event to eliminate the exponential growth of the objects:
Image.PNG


Right now:
On single core device: Lag everywhere
On dual core device: Lag on start of the game the first time you launch, after the game work smoothly
On quad core device: Work smoothly

I tested my game on many Android devices: Galaxy W (single core), S2 (dual core), S4 (quad core), Note 8.

My question is this, I would be able to publish my app on a wide range of devices, is there any other solution to make it more smoothly?

I build my app with Crosswalk for Android, can be a problem?

If you want I'll publish the Event Sheet though the name of the objects are italian because I'm Italian :D

Thanks for your time!
You do not have the required permissions to view the files attached to this post.
Last edited by Fiammaoscura on Sat Aug 30, 2014 10:25 am, edited 1 time in total.
B
17
S
3
Posts: 62
Reputation: 1,054

Post » Fri Aug 29, 2014 3:42 pm

Does your game use only physics or multiple behaviours?
By reading your description couldn't you use bullet behaviour with gravity?
Are you destroying all objects not affecting gameplay (outside of layout or outside window view or whatever)?
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 » Fri Aug 29, 2014 10:15 pm

@LittleStain Thanks for your quick response!

Well, I use Physic and Solid behaviors for the game in general, Bound to Layout for the player, Pin for the player's animation and Platform for the player's movements.

No, because the object has to interact with other objects that are still on the ground. (Or you know something that i don't know? :) )

Both things, on start of layout the objects out of layout (like the buttons of the pause menù that are useless) are destroyed, and when the objects are out of windows view (I've calculated that they are out like 30 second after their creation) are destroyed.

And before I did not say that my game is totally in style 8-bit, so I wonder why is so laggy?
B
17
S
3
Posts: 62
Reputation: 1,054

Post » Sat Aug 30, 2014 12:56 pm

I have the same problem.. I wanted to use CocconJS native physics (it runs much better)
But that dosnt work when compiling through CocoonJS
(game does not start on android phones)


Box2D asm runs slow on my devices :/
B
37
S
9
G
8
Posts: 541
Reputation: 8,554

Post » Sun Aug 31, 2014 10:38 am

@LittleStain Do you have any advice for me?

Can I do anything with Bullet behavior?
B
17
S
3
Posts: 62
Reputation: 1,054

Post » Sun Aug 31, 2014 10:50 am

I don't know your game mechanics so I couldn't tell..

Often I come to this conclusion:
If you can't make it, fake it..

A player won't know the mechanics behind what he's seeing and often you can fake a lot..
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 » Tue Sep 02, 2014 1:36 pm

What I can say is that the event you display in your first post is never triggered, as physic objects never actually collide, they "repulse" each others.
So that may be part of the issue. You are actually never destroying any of your objects and they keep piling and registering for physic collision and work.

Also why such a huge layout ?
And why sending the capx, unrequested, to me via PM when someone already tried to help out in your thread ?
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
296
S
119
G
96
Posts: 7,332
Reputation: 71,306

Post » Tue Sep 02, 2014 10:36 pm

Sorry if I sent you the capx @Kyatric. My intention was to draw your attention to the post in order to have different opinions about this game and the capx was to complete the first topic because I had not loaded.

Answering your question: Because I don't know how make it infinite. Do you think my huge layout is a problem for the performances? Can I make an infinite vertical scroller with with these game mechanics? I've browsed for the tutorials but i have found only how make infinite horizontal scroller games.
B
17
S
3
Posts: 62
Reputation: 1,054

Post » Tue Sep 02, 2014 11:15 pm

So as I mentioned, it possibly would have been a better idea to post your capx (either attach it to your first post or post the public link) since that's what @LittleStain was needing to keep helping you.

I don't know if the layout's size has something to see with the performances, I believe it's more related to the number of colliding physics objects and I don't see what exactly you're trying to have "infinite".

If you took the time to explain clearly what is your intention, what you experiment and make your capx public, a lot more people could participate in the discussion and possibly help you out.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
296
S
119
G
96
Posts: 7,332
Reputation: 71,306

Post » Mon Sep 08, 2014 1:18 pm

Ok @Kyatric, I'll try to explain my project, I'd like to make an Infinite vertical scroller game, where the player have to go up as much as possibile and at the same time he must avoid objects falling from the sky. Then, at a given Y, the system will spawn a boss. This is the game in general. Now the game has almost any mechanical, but trying it, I realized it lags a lot and I wanted to at least be able to make smooth on the devices dual and quad core.
B
17
S
3
Posts: 62
Reputation: 1,054


Return to How do I....?

Who is online

Users browsing this forum: Seruza and 8 guests