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

Get help using Construct 2

Post » Wed Feb 25, 2015 1:54 am

Message: Canada GDP can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
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.

Image

Capx:https://dl.dropboxusercontent.com/u/248465061/Legacy%20Ball%20Test/Legacy_Ball_HelpPLS.capx
Mobile APK: https://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!
Last edited by Canada GDP on Thu Feb 26, 2015 11:22 pm, edited 1 time in total.
B
12
S
2
Posts: 23
Reputation: 738

Post » Wed Feb 25, 2015 2:33 am

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.
Last edited by kossglobal on Wed Feb 25, 2015 2:54 am, edited 2 times in total.
B
56
S
21
G
3
Posts: 602
Reputation: 6,612

Post » Wed Feb 25, 2015 2:44 am

Works great when previewing on a Samsung S2 with the Chrome app. Nice game idea by the way!
composer - multimedia artist
www.eli0s.com/en/
B
69
S
26
G
5
Posts: 1,146
Reputation: 9,829

Post » Wed Feb 25, 2015 11:10 pm

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. :)
B
12
S
2
Posts: 23
Reputation: 738


Return to How do I....?

Who is online

Users browsing this forum: blue visionary, OBLIVION, tarek2 and 17 guests