Optimization question

Discussion and feedback on Construct 2

Post » Wed Oct 08, 2014 3:34 am

Just doing final checks on my game. Right now in the debugger I got it down to 94mb memory usage. Great, since it was running around 230 before I started to optimize :).

Anyway, when I load the game up in Xcode (CJS exported) and run Instruments to test how much memory the game is actually using on my iPad mini it comes in around 203mb. I am using the Preload Sounds setting for my project, could this extra 100+ mb of memory be my sound files? All my sound files combined is 2.4mb, but I am not sure how they translate into memory usage. Audacity shows them at 44hz 16 bit stereo sound. If sound could make this big of a difference, I would consider down sampling them if need be.

If it's not the sound, what could attribute to the increased 100mb of usage from the debugger to xcode?

@Ashley, any input would be great.

I reread the recent memory management post and I have a better understanding of sound. I have 48 individual sound files. Even assuming each one is 1 second long (though most are not), that would only equal about 8mb of memory. Unless my math is off, but 172kb per 1 second of stereo sound, times 48 = 8,256kb.
B
101
S
32
G
11
Posts: 1,546
Reputation: 21,667

Post » Wed Oct 08, 2014 3:45 am

I believe it overhead from CJs but im not sure. its the same way on any mobile export option so ive assumed it was wrapper overhead
B
42
S
17
G
2
Posts: 850
Reputation: 6,209

Post » Wed Oct 08, 2014 4:51 am

I can't imagine what would be 100mb of memory usage from the wrapper overhead. I have heard file sizes are bigger, as in download sizes, but not memory usage. Can you link me to any threads that talk about it? Thanks.
B
101
S
32
G
11
Posts: 1,546
Reputation: 21,667

Post » Wed Oct 08, 2014 5:13 am

it might not be thats just what i assumed because i noticed on every mobile export ive done (android,Windows Phone,IOS) but not when i test in the browser

also i just thought where are you looking at memory use in xcode because i now when the app loads is when it has its higher mem use then it goes down and and if your looking at the wrong place you might be looking at that peak usage and not what it is using?
B
42
S
17
G
2
Posts: 850
Reputation: 6,209

Post » Wed Oct 08, 2014 5:14 am

Well, I think I am getting closer. I just went through the exported folder and I have 30+ sprite sheets in the 1024x1024 size. That's about 144mb right there (4mb x 30).

Plus a 2048x2048 and several 512x512. All together, I am going to gather it equals about 200mb of memory usage. Now the question, is there a way to combine some of these? It seems like C2 create a sprite sheet for each object and puts as much on it as it can, but doesn't combine them.

A good example is my store icons. Each is it's own object.
Image

I guess this is a consideration when creating the game from the beginning :). Now my game is completely playable on all newer devices as I have tested it on, I'm just trying to learn how to optimize it more.
B
101
S
32
G
11
Posts: 1,546
Reputation: 21,667

Post » Wed Oct 08, 2014 5:17 am

volkiller730 wrote:it might not be thats just what i assumed because i noticed on every mobile export ive done (android,Windows Phone,IOS) but not when i test in the browser

also i just thought where are you looking at memory use in xcode because i now when the app loads is when it has its higher mem use then it goes down and and if your looking at the wrong place you might be looking at that peak usage and not what it is using?


I'm using the built in instrument tools without Xcode. It gives me a constant rundown of how much memory my app is using on the device during the entire time I am playing the game. Since all assets are loaded in at the start, the number stays pretty constant. CJS does a good job of freeing up memory when it needs it or gets memory warnings, but this can sometimes cause little hiccups depending on the device.
B
101
S
32
G
11
Posts: 1,546
Reputation: 21,667

Post » Wed Oct 08, 2014 5:43 am

Does the transparent space in each sheet not matter towards memory usage? I'm curious because I have several sheets that all the images would fit on a 256x256 sheet, but instead is using a 512x512.

I'm sure it's just for some reason that I don't understand, and will once this thread is done :).

Here are a few where the images would fit on a smaller sheet.
Image

The frenzy one for example, each image is 256x64. All 4 should fit in a 256x256 sheet, right?
B
101
S
32
G
11
Posts: 1,546
Reputation: 21,667

Post » Wed Oct 08, 2014 6:30 am

So I made a few changes, essentially getting rid of 4 of the 1024x1024 pngs and the memory usage when from 203 to 190. A step in the right direction for sure.
B
101
S
32
G
11
Posts: 1,546
Reputation: 21,667

Post » Wed Oct 08, 2014 6:36 am

the best way to solve that export image issue is in c2 instead on having something like 256x256 have 255x255 that one pixel is needed to line them up right. i believe the reason for that is c2 puts a 1px gap when making spritesheets

ex for your 4 256x64 do 255x63 and it will fix it i had that same issue fixing this can improved memory alot i decreased mine by about 1/3
B
42
S
17
G
2
Posts: 850
Reputation: 6,209

Post » Wed Oct 08, 2014 6:40 am

I tried that and it didn't work, maybe more than one pixel is needed? But yeah, seems like a good approach. Little by little :).
B
101
S
32
G
11
Posts: 1,546
Reputation: 21,667

Next

Return to Construct 2 General

Who is online

Users browsing this forum: sunisa2532, taker7 and 29 guests