Help with mobile graphics please

Discussion and feedback on Construct 2

Post » Fri Jan 18, 2013 3:26 am

Hi everybody

For the past 4 moths I've been making a game targeted to android/iOS

The engine worked and everything was fine, but as I started adding more images (specially backgrounds) the game became slower and slower and now it doen't event load, it just send me back to the mobile's main screen.

The game was designed 900x600, compiled with cocoonjs and tested in 2 android 2.3 devices, 1 iPad and 1 iPhone

Since Construct packs the images in sheets by power of 2 (128x128, 512x512 and so) I have also split my backgrounds in order to save space and memory

I used to have 19 900x600 images for the backgrounds, which I think are loaded as 1024x1024 by the device... and now I got 29 512x512.   and got a ridiculous improvement ( loader screen, main screen, one extra and "pum" back to the device "desktop")


Unfortunately I can't share a capx because it's a comercial project and the other part might kill me if I do... also I don't have a better device to test..


the game only runs if I delete all the backgrounds

is there any other way to optimize the graphics for mobile devices? or getting into mobiles through wrappers limit us to use low quality graphics??

any reply would be helpful.. thanks to everybody
Image
B
42
S
11
G
5
Posts: 269
Reputation: 10,790

Post » Fri Jan 18, 2013 7:33 am

The only way will be to redesign the concept. 29 backgrounds is too much.
I dont how big your capx file is... but i found out through testing that the xcode/ipad2 has memory issues with more then 20 MB sizes.

And the limit is a device limit . Try to use less background a mobile device has texture memory limits
It will also take forever if you load too many files. Think about it this are only images. Maybe you want also sound effect, background sound etc.

All this stuff will be preloaded and also uncompressed loaded into the memory.


B
5
S
1
Posts: 49
Reputation: 1,148

Post » Fri Jan 18, 2013 7:41 am

Which iPhone and ipad are you using?

I seem to recall reading that ludei is going to implement c2's layout by layout loading, that would solve your problems. Hopefully they'll have that implemented soon - you could ask them via their website if they have any idea when it might be implemented.
Moderator
B
87
S
32
G
33
Posts: 3,005
Reputation: 27,397

Post » Fri Jan 18, 2013 3:27 pm

thanks for the reply...

about the 29 backgrounds.. actually I've been reported that is working better than before... I think 29 512x512 takes less resources than 19 1024x1024.. I think theyt are too much too, but I'm in charge of the code only..

The iPhone/Pad are old I think, maybe "1" or "2"
Image
B
42
S
11
G
5
Posts: 269
Reputation: 10,790

Post » Fri Jan 18, 2013 3:39 pm

[QUOTE=danuyos] Hi everybody

Since Construct packs the images in sheets by power of 2 (128x128, 512x512 and so) I have also split my backgrounds in order to save space and memory

[/QUOTE]

My understanding is that is only the case for tiled backgrounds?


Breaking down backgrounds into smaller, repeatable elements is the way to go. Generally 20 smaller sprites will run faster than one big one.
Moderator
B
72
S
13
G
11
Posts: 900
Reputation: 11,783

Post » Fri Jan 18, 2013 3:55 pm

hi @thehen what I meant is that breaking down the backgrounds to make them fit in 512x512 sheets works better than having a 900x600 which I think is being loaded as the nearest 2* texture (in this case 1024x1024)... tiled backgrounds just repeat the same image, but in my case I'm arranging the sprites like a puzzle to get the full back..

and apparently that improved a little the situation... I've been recently told that it is running "playable" on the iPad
Image
B
42
S
11
G
5
Posts: 269
Reputation: 10,790

Post » Fri Jan 18, 2013 4:48 pm

Interesting, I thought that power of two only applied to tileable backgrounds. Perhaps it's different with CocoonJS.
Moderator
B
72
S
13
G
11
Posts: 900
Reputation: 11,783

Post » Fri Jan 18, 2013 6:42 pm

An iPhone 1 or 2? The hardware in those are very weak and have very little memory, I'm surprised it runs at all. Ipad 1 is underpowered as well, though not as much.

Power of two is still important for how graphics cards work (though many or possibly all modern gpus can have rectangular power of two textures, such as 64x128) but c2 does it for you on export. 4 512x512 textures will take up the same space as 1 1024x1024 texture and should be basically the same speed to draw, unless the early iPhones don't support textures of that size. If they don't, then it could either slam the frame rate or break the texture up automatically, I don't know.
Moderator
B
87
S
32
G
33
Posts: 3,005
Reputation: 27,397

Post » Sat Jan 19, 2013 12:06 am

Hello,

Definitively, devices like iPhone 3GS and iPad1 have limited memory cappabilities. This does not mean a game won't work (we have several fairly complex games running on them) but you have to manage your resources carefully. For instance, do not load all the backgrounds at a time, but when you need them. Having power-of-two friendly resources definitively helps to minimize the memory waste but remember that some graphics hardware/drivers do not allow textures bigger than a certain size (2048 is usually the limit).

rule of thumb, control as much as you can what resources you use each time.

Regards,
Iker.
B
9
S
4
G
4
Posts: 383
Reputation: 3,616

Post » Sat Jan 19, 2013 3:49 am

@Ludei - by saying "do not load all the backgrounds at a time," what does that mean for cocoonjs's memory management? Does it load textures as they are used and unload them when they are not? Does that mean c2's layout by layout loading has been implemented, or is that your own memory management system? I'm very interested to know the specifics of how it works.
Moderator
B
87
S
32
G
33
Posts: 3,005
Reputation: 27,397

Next

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 4 guests