Texture Memory Used: 700.00 Mb

The solution isn’t to reduce the image size, it’s to reduce the load on the device. It’s entirely possible that you created a game that doesn’t run optimally on lower-spec devices. Take a look at the listing for Sproggiwood:

*** Designed for newer devices. Requires minimum 1GB of RAM. See list of tested devices at the bottom. ***

There are other developers that are aware that they are creating heavy-duty games, and inform the public accordingly.

It doesn’t sound like you want to go this route; you would rather make the game playable on all devices. Ths is done by  optimizing the game logic itself. Substitute timers for Runtime listeners that don’t need to update every frame. Don’t load every single character for a level, if you already know that a character has chosen a Gladiator as their “savior” (sorry if that isn’t the right terminology, I’m not that far into the game). using the newText() API is relatively taxing call in the fashion that Corona leverages it; perhaps you should investigate bitmap fonts. 

All of these are legitimate options to make your game function better on lower-powered devices. Starcrunch gives a few fantastic options above as well; considering the amount of downloads and reviews you have, it would benefit you greatly to adopt some of these to make your game as viable as you can.

To emphasize, I’m not trying to be harsh. I’m sure the language barrier is causing some problems (I noticed a few English language typos in the game, such as “ennemy” instead of “enemy”) so I want to make sure you understand we are trying to help you out. You have a quality release here and you would be doing yourself and your users a favor by making it as streamlined as possible.

Alex is right. You will probably face another bump up on the road if you try to solve this problem just by reducing the size of your assets(assuming you have done your fair share of asset optimization).

I’m not pretty sure if you are already doing this but another option can be limiting the number of created assets depending on the device. Maybe you can adjust your number of assets to load considering “maxTextureSize” or “androidApiLevel”. This way, “loading before level” can also work better.

https://docs.coronalabs.com/api/library/system/getInfo.html

Thank you every one for your help! I was wondering a bit of miracle answer :wink: Because a lot of game are heavier that mine and they use less texture memory.

I will try to find an issue, the problem I do loading before the user choose things. The only thing I haven’t load when the player choose something is the map.I will work on it :slight_smile:

@Alex@Panc I didn’t get what you mean when you talk about API and bitmap font. (Is it better than .otf or .ttf?)

This thread has been a bit hard to follow, but let me try to address a few things.

  1. Power of Twos:  In the case of a 225x1380 image sheet, a 256 x 2048 x 4 amount of memory will be allocated for it. In other words it will use 2,097,152 bytes of memory (2 Megabytes or 2MB).

  2. The act of loading an ImageSheet will allocate the needed texture memory. After that display.newImageRect()'s and display.newSprites() will actually use the ImageSheet’s graphic memory.

  3. On Android, we automatically scale image sheets that exceed 2048 on the long side to 2048 to help older devices work. 

  4. How much memory your app has to work with is a function of the device, operating system and memory allocated to other apps.  You might find your app starts struggling with memory problems at 50mb of texture memory. Yet on my Mac, I’ve got 1.5 GB of memory on the GPU and a 700mb amount of texture memory would only be using half of what I have available. On some mobile devices 700mb is more memory than the entire device has and I’m surprised that you can run at all on them.  Clearly that memory has to be getting paged in and out if you’re even able to start up. This isn’t a Corona limit, it’s a hardware/OS limitation.

Rob

Thank you Rob!

For information I don’t publish the game who use 700mo of memory, I divide all image by 4.

I will work on image size, because I thank it don’t change anymore with vulkan and other new soft.

With texturepacker, I can optimize image.

For example I have actualy two animation in different image. TexturePacker will put them in a same image. And I create two imagesheet (like this: https://github.com/codepaladin/SpriteSheet ) does it use less texture memory or the same as previous because I create two imagesheet?

Let’s say you have two image sheets, each one is 225x690. This requires a 256x1024x4 or 1MB image each or 2MB total.  Your single image sheet of 225x1380 is really a 256 x 2048 x 4 image is a 2MB image, there for they use the same amount of texture memory. There will be some Lua memory overhead for the tables holding the two image sheets. There is probably some additional OpenGL memory being used by two sprite sheets, but on the scale of bytes vs. megabytes it’s not that relevant. 

Now the more you slice up the image sheet into smaller chunks, say each character’s animation in their own image sheet, now you’re starting to get into a chase where the overhead adds up even though the texture memory for the images isn’t increasing significantly. 

Rob

Thank you! Two imagesheet on one image it doesn’t use much more texture memory than a imagesheet on one image

Hi,

TexturePacker don’t change anythings. I replace 350 images by 32 images and the texture memory increase of 10mo. It’s because now we use openGL 2.0 or higher. 

For test I have write a code who change the actual code to the new one.

Old code:

l.attgauche=graphics.newImageSheet( "AnimVF/mechant/balrog/balrogatg.png", { width=169, height=300, numFrames=6,sheetContentWidth=169,sheetContentHeight=1800 } )

New one:

l.depgauche=graphics.newImageSheet("test-30-.png",{sheetContentWidth=2048,sheetContentHeight=2048,frames={{x=248,y=0,width=228,height=230},{x=248,y=230,width=228,height=230},{x=248,y=460,width=228,height=230},{x=248,y=690,width=228,height=230},{x=248,y=920,width=228,height=230},{x=248,y=1150,width=228,height=230}}}) --AnimVF/mechant/assassin/assassinmvmg

If corona decide to open 8bits image in 8bits instead of 32bits I can divide by 4 the texture memory size.

Someone has other idea to improve the memory texture?