[SOLVED] How do I Make My Physics System More Efficient?

0 favourites
  • 4 posts
From the Asset Store
Everything is made via physics, Very simple code: 6 events only (3 for tank creation, 2 for controls and 1 for camera)
  • Hey folks, how's it going?

    So I've been working on a little 2D physics-based puzzle game recently, and I've gotten it to work on mobile! Sadly, once I started testing it on my Galaxy S3, I realized how slow and clunky it was. The game works fine on my desktop, but the limited processing power of mobile devices seems to be rendering my game unplayable.

    I've been trying to debug the past couple hours, and the only thing I can come up with is I'm generating too many physics objects. However, I read in Ashley's tutorial that;

    "Note that objects which have come completely to a stop, and are not moving or rotating at all, are "put to sleep" by the simulation. Then, they don't need processing any more. If the object is hit by another one it "wakes up" and starts using processing again. However, if the object is even moving in the slightest, it won't be put to sleep."

    I think that my physics objects are "put to sleep", but I'd like to ask you folks to be sure. Below I've provided a screencap of the game, a link to the capx, and a link to the mobile version of the game.

    Capx:https://dl.dropboxusercontent.com/u/248465061/Legacy%20Ball%20Test/Legacy_Ball_HelpPLS.capx

    Mobile APK: dl.dropboxusercontent.com/u/248 ... debug%20(1).apk

    If you'd like, feel free to take a look at these. Are my physics objects not being "put to sleep" properly, or is there something else in my code that's slowing the game down on mobile?

    If you have any ideas as to what might be causing that big discrepancy, please let me know. And if it involves reworking the game's core mechanic, um, please let me know if you have any ideas as to how else I could code that properly, haha.

    Thanks so much for your time!

  • I'd recommend you to avoid physics behavior if your target is mobile. I spent 2 months and half working on my dead project to realize that. Doesn't matter if Ashley keep saying that the new engine asm.js is faster and that work better on mobiles. It is still an unrecommended beheavior for sure. I did several, and I mean SEVERAL tests. Always unstable fps. Sometimes it works fine for a short period of time and most of the times runs really bad.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Works great when previewing on a Samsung S2 with the Chrome app. Nice game idea by the way!

  • Thanks, eli0s!

    And thank you kossbglobal for your input. I think I may have found a way to counter the errors I'm having. I'm experimenting with only having physics enabled for parts of the "line" when it is overlapping with the ball object. So far I've dropped my CPU usage by a steady 10-15%. I'll see if I can't get it to be more efficient yet.

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