Help required on Texture Memory Efficiencies

Hi - just need to bounce some problems around with (hopefully) someone who has come across these before.

My app uses quite a lot of full-screen images (using display.newImage), with other PNG-based images layered on top. These all have different scaling, transition, alpha and rotation actions.

Originally, I just allocated / removed the images (with garbage collection) when I need them. However, I’ve found that the images load at everso-slightly-different speeds on ipods, iphones, ipads and Android, which is a pain over time as there is some syncing to music etc.

So I “display.newImage” everything upfront, and then isVisible=false until required. This solves the sync issue, but means that texture memory gets used up. Using ‘Instruments’ on the Mac, I’ve ensured that the texture memory used isn’t so high to cause iOS problems. However, I’ve found that the app will not work on some lower-end Android devices. So…

1.) I tried using Physics Editor - to remove any dead transparent space on PNG’s. However, this doesn’t reduce the texture memory used (fail).

2.) The next obvious thing for me to use is Sprite Sheets, using TexturePacker etc. I could squeeze several background / foreground images all onto the same sprite sheet. However, am I correct in my understanding that it is not possible to set properties (e.g. XY, rotation, alpha etc.) for a particular sprite within a sprite sheet?

For info: Everything is currently scaled for 480x320 (iPhone 3 etc.), with a global variable controlling scale against all the images, for upscaling for Retina/iPad. I need to solve this texture memory problem before even looking at the @2 stuff.

Thanks in advance!
Dave. [import]uid: 82595 topic_id: 20183 reply_id: 320183[/import]

Think you’re misunderstanding spritesheets based on your question in #2

It took me a good evening to wrap my head around them and play with texturepacker, but it proved well worth it. Word of advice… don’t even think about doing them in corona without texturepacker.

Every “level” of the rack in dabble used to be its own image - to allow the illusion that the tiles are “sitting inside” - but I replaced the rack images with a single sprite sheet and it helped a bunch

Here’s a screenshot - should help you get what I’m talking about

http://www.flashysubstance.com/images/dabble/dabble480/screenshot_game.jpg

in the actual sprite sheet those racks are arranged in a totally different fashion. Had to change their XY to make it all fit. And could apply rotation if I needed to (though I didn’t)

Hope that helps
[import]uid: 32462 topic_id: 20183 reply_id: 78864[/import]

Thanks a lot - this does really help (and restores my faith that I am trying to do it the right way).

If I may, could I give you an example, as I’m struggling to find examples online of how to use sprite sheets which contain unrelated images, where they’re not for ‘regular’ animation in one spot…

Example:

BACKGROUND =display.newImage(“background.jpg”) --480x360
FOREGROUND1=display.newImage(“foreground1.png”) --100x100
FOREGROUND2=display.newImage(“foreground2.png”) --100x100

So… for each of these, I (currently) set their isVisible, X/Y, rotation, alpha propertes as usual.

If I use Texture Packer (as they’ll all fit nicely into a 1024x1024 sprite sheet, can you help me with an example of how to refer to these images separately for manipulation on screen?

I’m sure this is really simple, and I’m sorry for asking here, but I think I’ve got “sprite sheet blindness” trying to find it myself online atm :slight_smile:

Thanks in advance,
Dave. [import]uid: 82595 topic_id: 20183 reply_id: 78894[/import]

Yay - have got SpriteSheets working now. Thanks for the push (and the useful information).

Regards,
Dave. [import]uid: 82595 topic_id: 20183 reply_id: 78998[/import]

Just wanted to update you that - thanks to your help and from others - my app launched today! (with an awful lot of spritesheets, texture memory management etc.).

Btw - I have to say it, but I do play Dabble on a seemingly ongoing daily basis!

Here’s hoping my app is anywhere close to as successful / addictive as yours.

Dave. [import]uid: 82595 topic_id: 20183 reply_id: 92172[/import]

excellent! Where’s your app? [import]uid: 32462 topic_id: 20183 reply_id: 92174[/import]

http://itunes.apple.com/gb/app/hpr-lifetime/id505859507?mt=8&ls=1

It’s an “interactive music video” for a new pop/rock artist that I’ve created, called Hip Pop Rocksy.

You’ll see what I mean about the number of overlaying large sprites etc.

Thanks again for your help. [import]uid: 82595 topic_id: 20183 reply_id: 92180[/import]