0

I am at a loss at how to really judge SpriteKit memory usage for a texture atlas or an image loaded into an SKSpriteNode.

Texturepacker supports RGBA4444 output format for png. However, does spritekit actually load them as 16-bit per pixel or are they always loaded as 32 bit per pixel regardless. When I run sips terminal command on MacOS after I convert the image to RGBA4444 in texture packer, it still says that the png file has 4 samples per bit and 8 bits per sample. Therefore it is still RGBA8888!!.

Also, I do not understand why my game in sprite kit already uses 80mb of memory even though all I am doing is loading a background png image (covering the entire background) of all iOS devices (different resolutions for different devices) and a very small Atlas. according to texture packer, both background image and atlas should be less than 10mb in size in RAM. yet, when I run the game, it is already consuming 80 MB.

SpriteKit is very confusing. In cocos2d, it is very easy to force each image to be loaded as RGBA4444, RGB565...etc. In sprite kit, this only seems possible if you delve deep into OpenGL ES low level calls, which I am not very proficient at.

I would switch to cocos2d but its too late as I already made a lot of progress with spritekit. Also, PVR textures look very bad on spritekit.

In summary, my question is: how do you reduce memory usage for textures in memory in spritekit! I am preloading all textures before the level begins and really they are not a lot of textures.

PS. I am developing for iOS 10 and I have the latest Xcode 8.1

Thanks in advance.

plawres
  • 313
  • 4
  • 19
  • 1
    You asked a lot of questions...But try with this : http://stackoverflow.com/a/41100089/3402095 Also, about memory usage... Keep in mind that size of images on disk has nothing with how much they take when loaded into RAM. – Whirlwind Dec 25 '16 at 21:15
  • When you say 80MB, is this on the simulator or the device? The simulator will give you a false value Keep in mind that cocos2d is actually using OpenGL. – Mobile Ben Dec 26 '16 at 21:30
  • Yes, thats right. In actual device it only uses 10Mb. – plawres Dec 28 '16 at 15:58
  • However, I still want to load textures as RGBA4444. Since its possible with Cocos2d, surely its also possible with Spritekit? – plawres Dec 28 '16 at 15:59
  • If you are interested in a new SpriteKit memory reduction approach, take a look at http://stackoverflow.com/a/38679128/763355 – MoDJ May 03 '17 at 15:26

0 Answers0