A quick question about "change image" behavior and its memory usage compared to other.
Hi all,
In one of my projects, I'm using something like;
When XXX happens;
Change Attribute, self.image to;
The thing is, the actor changes its image to 81 different 960x640 images. My question is, will it kill the performance?
It is a LOT of images in a single scene but it is simply changing its image, not spawning them at the beginning or at the same tame. But still I'm not sure and I can't test it.
What are your opinions?
In one of my projects, I'm using something like;
When XXX happens;
Change Attribute, self.image to;
game.first..game.second..".png"
The thing is, the actor changes its image to 81 different 960x640 images. My question is, will it kill the performance?
It is a LOT of images in a single scene but it is simply changing its image, not spawning them at the beginning or at the same tame. But still I'm not sure and I can't test it.
What are your opinions?
Comments
*p.s. image dimension gives no basis for file size... it can be full screen image with 1 small icon... or full screen complex artwork. that's uncompressed.
I mean if a 50x50 image is 1mb in size it will consume much less memory than a 512x512 image that is 10kb.
Am I wrong?
Don't know if that's any help, the best way would be to make an ad hoc and see what happens (unless another member who has done similar can report actual test findings, as it were...)
----------------------------------------------
http://davidgriffinapps.co.uk/
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
But yes, you're right that RAM usage for images depends on the container size it fits into. i.e will it fit into a 2x2, 4x4, 8x8, 16x16.... with the biggest being 1024x1024.
But keeping the file size of each image and sound down is still good so your overall package size doesn't go over 20mb. So the game can be downloaded over phone networks.
If you have natural pauses in your game where there isn't any movement or complicated rules being processed - that's the time to use change attribute > self > image. As the image will load into RAM right there on the spot. So that means you don't have to load it at the start of the scene and keep the player waiting with the spinning loading wheel.
However, if you have loads of stuff happening on-screen and you then load in images at the same time - you're probably going to get a big drop in frame rate and horrible jerky playback. So in that case ticking preload art and using the change image attribute or animation attribute would be a better choice.
Thanks for your answers. It is a really simple *catalog* type of app and it has nothing going on than a few simple interpolates and change attributes.
Since I have no Developer membership at Apple right now, I'm kinda concerned a lot that it won't even run on an iPhone 4, and I can't test it.
And I only have about 15-20 small images loading at the start, 5-6 960x640 images. And the big images only change with "change attribute --> self.mage" rule when triggered with touch. So yeah I hope it will be useable even on old devices since there is no moving actors most of the time. So you can't even notice a fps drop.
But when I'm finished, it will be damn hard to move most of the other stuff to a new scene if the devices fail to run at current layout.