Optimizing a sequence, use atlas or custom transition?

All,


i have more than 30 large hi-res images, so caching is an issue, the images are not single frames of an animation. I want to grab a random image apply it as a texture to a node, do a few actions then grab a new random image, repeat actions.


What's the optimal way of doing this?

Replies

Since the number of game images is finite, keeping them in memory is ideal because it limits gameplay hiccups as required to allocate/decode/deallocate images while transitioning. Have you done some tests to confirm that loading them all at once truly isn't possible? The Allocations instrument is one of the best tools to measure memory footprint. If you have an idea about maximum memory footprint size for your target devices, you can approximate it on paper before even doing physical runs. The cost of each image in bytes is: image_width * image_height * 4 (bytes per pixel). For example, a 4096 x 4096 image when expanded in memory should be around 4096 * 4096 * 4 = 67,108,864 bytes, or ~64 MB. On modern hardware, iPhone 7 for example, you can fit quite a number of 4096x4096's in memory, assuming no other high memory using apps are running at the same time.