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

0 favourites
  • 10 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • 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: [attachment=0:2wtqv42l][/attachment:2wtqv42l]

    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

    Thanks for your time!

  • 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)?

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

  • 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 :/

  • LittleStain Do you have any advice for me?

    Can I do anything with Bullet behavior?

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

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

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

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

  • Try Construct 3

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

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

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)