Performance issue in Android

Discussion and feedback on Construct 2

Post » Mon Aug 27, 2012 4:22 pm

Hi, i've been developing an Android game for about a few weeks now, but it seems that no matter what i do, the performace just won't go any better.
For the record, i read all the performance threads in the forums and the manual too of course, i have follewed every step in ranma tutorial and this manual entry,
but actually, nothing improve.
In adittion i have exported and build the proyect in many differents ways to check the performance, includind eclipse, phoneGap, html5, appiMovil, but non of it seems to work correctly or even improve the performance.
I'm testing the game in a Motorola defy+ and a Samsumg Galaxy S3, so is not a phone limitation.
In the other hand, i'm aware of rendered limitations of canvas2d against WebGL and that is why i did every thing in the game to be less resource consuming, but no result till now.
Is there anything else to improve the performance? or i simple have to wait till WebGL is suported in phones?
For you to know, in the phone browser the game run smooth at 60 fps, but as .apk native app it run at only 7 fps.
(The game is very simple, does not use physics and there are no more than 20 objects in screen at time)Behamut2012-08-27 16:24:15
B
28
S
5
G
4
Posts: 51
Reputation: 3,857

Post » Mon Aug 27, 2012 5:20 pm

Dear behamut, did you tested your game using cocoonjs or appmobi ???

i'm developing my 2d side scrolling RPG platform game, the game with large world, long level, many character with nice graphic, and my game always run 43-68 fps all the time, and i tested on cocoonjs using my Galaxy s2, i think galaxy s3 is better. Wait until next month i will release a demo, you can check it out on your galaxy s3, and i find myself some tips to improve the performance. I know performance on mobile is quite poor now, but we can make game for mobile, it's possible my friend. (sry for bad E).farsmile902012-08-27 17:23:06
B
50
S
12
G
7
Posts: 259
Reputation: 10,371

Post » Mon Aug 27, 2012 6:09 pm

farsmile90, thanks for the quick answer!

Well, i have tested my game with appMovil, but it does not even work on my devices, i thought it was something to do with Android not supporting directCanvas.
In the other hand i did not try cocoonjs, may as well give it a try now, but still, i find odd the fact that it is running at 7 fps, and almost nothing in the game is that resourse consuming.
But if you can make it run ok, then it something on my side, or as we say, a problem between the chair and the monitor, lol.
But i just can't figure it out yet...

Anything that you can tell me about improving the performance or the way you work for achive that high fps in your game is welcome =D

Anyway, thanks! looking forward to see your game!Behamut2012-08-27 18:14:38
B
28
S
5
G
4
Posts: 51
Reputation: 3,857

Post » Mon Aug 27, 2012 6:33 pm

first of all, you need to test your game using cocoonjs now, and the performance tips you already read is very useful. I follow it and tested using cocoonjs , it's really work.

1. If your game have a moving enemy on the layout, just disable them, make them stand and if your character come near enemy, they'll chase and attack, because too many enemy moving in runtime will cause down performance.

2. I draw my level and cut it apart. 500x500px is fine, then import into construct. ( i don't use tile background, just sprite)

3.Don't use too many text box on screen, it's cause down the fps too.

It's midnight now, i need some sleep, i will share more in the morning :))



B
50
S
12
G
7
Posts: 259
Reputation: 10,371

Post » Mon Aug 27, 2012 9:53 pm

thanks for the time dude,
As for the tips you give me i see i was working ok, i already had implemented the "enemy chase you" part and the textbox part. Actually i don't use the textbox, i use spriteFont, it should bost the performance cause it easiest to render than text box, if you are not already using it i recomend you to do so,
Now, the critical point, i used cocoonJs, but i can't get it to work, i keep getting this error message:
JSUtilities Exception: TypeError: Result of expression 'a.canvas' [undefined> is not an object. Cause: Tag: timer Function: function () {a.go();}
have you ever see something like that? i'm out of luck man, =D
B
28
S
5
G
4
Posts: 51
Reputation: 3,857

Post » Tue Aug 28, 2012 2:22 am

SpriteFont, you mean Text plugin in C2, try not to use too many in screen too. Because when i creat a number for health bar, mana bar, items, status, etc... It's cause down the performance, it's force me to use shortcut key to visible text plugin ( and set position ) when hold down. And you should be careful with animation too, i try to make 3-4 character with animation walking on screen, the performance is low down, :)) in my game, my character fighting with 2-3 guys on screen, the fps drop to 32-40 fps . With tips number 1 up there, there is another way, just creat the enemy or NPC using (distance) if you get near, and destroy them if you run faraway from them, it'll bost the performance too.

And about the error, it's never happen with me, you should send the mail for @ludei. But have you try to make a zip file and run offline in cocoonjs, there are 2 ways, First you export a zip file and upload to dropbox then copy URL and run it, second is copy zip file to your mobile's sd card, run it offline. farsmile902012-08-28 02:29:41
B
50
S
12
G
7
Posts: 259
Reputation: 10,371

Post » Tue Aug 28, 2012 2:17 pm

Thanks for de advices farsmile90!!!
I followed all of your tips and mixed them with a few of my own understanding, and i achive 50-60fps all the time!. A really impresive boost of performance may i said, so thanks a lot my friend!
As for the SpriteFont plugin, it is a text plugin, but not the one that comes by default with C2. I'm talking about this Plugin, and as it is said in here:
"NEVER use text object
Rendering text on canvas is a very inefficient operation at the time. Use spritefont plugin or textbox. Be vary of their limitations though."
But before using it i should have checked if it was supported by cocoonJS, couse it is not . So the error i was getting was cause by this plugin, once i deleted it, it work perfeclty.
One again, thanks!
Cheers!
B
28
S
5
G
4
Posts: 51
Reputation: 3,857

Post » Tue Aug 28, 2012 3:51 pm

:)) Nice to know your game run smoothly in mobile device, cheer... I don't use sprite font, just text plugin, and the tip about shortcut key is really work at the moment. But do you find a way to put a custom font into your game, i mean the true type font, i use a Pixel font, when export the game to cocoonjs, it's fall back to the arial font... Even i try to make a folder call "fonts" and put pixel.ttf.

One more things, you tested your game on galaxy s3 ??
B
50
S
12
G
7
Posts: 259
Reputation: 10,371

Post » Tue Aug 28, 2012 4:25 pm

Well, for the first question, i didn't try to use a custom font, i use the Arial default font 'cause it fit well in my game, anyway, i think you may find usefull this thread.
As for the second question, yes, i tested it on Galaxy S3 and Motorola Defy+.

An just one more thing on my side, I was wondering how do you spaw enemies when your character is at certain distance, which event are you using? The only way i can think of is to put a blank sprite in certain point and then calculate the distance between the character and that sprite, if the distance is correct, make that sprite to spaw an enemy... is that the way you do it too?Behamut2012-08-28 16:26:00
B
28
S
5
G
4
Posts: 51
Reputation: 3,857

Post » Tue Aug 28, 2012 4:38 pm

:)) I'm follow the number 1 tip up there. Ok, if i release a demo of my game, please test it with your galaxy s3, thank mate :)) i wish i have s3.
B
50
S
12
G
7
Posts: 259
Reputation: 10,371

Next

Return to Construct 2 General

Who is online

Users browsing this forum: TheRealDannyyy, Zonacas and 15 guests