We are seeing corrupted images after resuming our app. Has anyone else seen this issue? It looks like a bug. Any advise? Thanks. Screenshot below.
Is there anything special about how that image is being created?
Rob
Nothing special. Using display.newImageRect with an image sheet.
It looks like it wasn’t the image. I had a snapshot attached to the display group. I found some other forum posts that lead me to look at the snapshots, the apparently can get corrupted on application resume.
Yes, Android dumps texture memory on suspend. Anything that was dynamic like a snapshot needs to be rebuilt on resume. We recreate the standard images, but snapshots have to be rebuilt.
Rob
I have an additional question regarding this. Okay so i have a snapshot over a standard set of image tiles.
On suspend, i basically don’t care what happens to my snapshot but I am wondering, will the graphics (non-snapshot) in other layers underneath (or above) the snapshot still get messed up pixels if I simply clear/remove the snapshot on suspend? Or is the pixels mess that appears fon a snapshot when resuming only on the snapshot itself and not other graphic layers?
Android should reload your normal images correctly.
Rob
@ Rob, yup you’re right all works fine if I delete the snapshot on suspend and then re-create it on resume. I was afraid that other image layers were also be distorted due to the snapshot.
If any dev is interested, the following is what I do for my War of the Zombie game:
If you do not need to retain what’s on your snapshot during suspend/resume then delete/remove it in the suspend function, then recreate the snapshot on resume. For me I simply use a particular snapshot as a ‘blank’ canvas to store ‘blood splatter’ over the map (snapshots are good for this since you could have unlimited blood splats and still not take up additional memory compared to using a normal layer with 1000s of stored blood splats), so for me this particular snapshot isn’t that important to keep as is during a suspend / resume.
The other time I use snapshots is for building shadows (only snapshots let you have 1 overall tone of shadow especially if they are overlapping shadows which require a slight alpha transparency - if you don’t use a snapshot you will get overlapping shadows with different transparency where they overlap, which obviously won’t look like a single collection of real shadows). This snapshot I must keep exactly as is, so the only solution I have for that is to save the whole map (all items, buildings, shadow, physics objects data/positions/etc) in the suspend function and then force exit the app (i suppose you could also simply create a pause), then on re-launching (or resuming) show the player a load saved-progress button which has to reload everything back in to the image layers as well as rebuilding the snapshot (in my case rebuilding all the build shadows).
Is there anything special about how that image is being created?
Rob
Nothing special. Using display.newImageRect with an image sheet.
It looks like it wasn’t the image. I had a snapshot attached to the display group. I found some other forum posts that lead me to look at the snapshots, the apparently can get corrupted on application resume.
Yes, Android dumps texture memory on suspend. Anything that was dynamic like a snapshot needs to be rebuilt on resume. We recreate the standard images, but snapshots have to be rebuilt.
Rob
I have an additional question regarding this. Okay so i have a snapshot over a standard set of image tiles.
On suspend, i basically don’t care what happens to my snapshot but I am wondering, will the graphics (non-snapshot) in other layers underneath (or above) the snapshot still get messed up pixels if I simply clear/remove the snapshot on suspend? Or is the pixels mess that appears fon a snapshot when resuming only on the snapshot itself and not other graphic layers?
Android should reload your normal images correctly.
Rob
@ Rob, yup you’re right all works fine if I delete the snapshot on suspend and then re-create it on resume. I was afraid that other image layers were also be distorted due to the snapshot.
If any dev is interested, the following is what I do for my War of the Zombie game:
If you do not need to retain what’s on your snapshot during suspend/resume then delete/remove it in the suspend function, then recreate the snapshot on resume. For me I simply use a particular snapshot as a ‘blank’ canvas to store ‘blood splatter’ over the map (snapshots are good for this since you could have unlimited blood splats and still not take up additional memory compared to using a normal layer with 1000s of stored blood splats), so for me this particular snapshot isn’t that important to keep as is during a suspend / resume.
The other time I use snapshots is for building shadows (only snapshots let you have 1 overall tone of shadow especially if they are overlapping shadows which require a slight alpha transparency - if you don’t use a snapshot you will get overlapping shadows with different transparency where they overlap, which obviously won’t look like a single collection of real shadows). This snapshot I must keep exactly as is, so the only solution I have for that is to save the whole map (all items, buildings, shadow, physics objects data/positions/etc) in the suspend function and then force exit the app (i suppose you could also simply create a pause), then on re-launching (or resuming) show the player a load saved-progress button which has to reload everything back in to the image layers as well as rebuilding the snapshot (in my case rebuilding all the build shadows).