"Set image sizes with a power of 2 rule. e.g. 32×32, 32×64, 1024×512, etc"
Hey CodeMonkey, how much does this affect performance? I don't think I've been doing this. Also for clarification, is it the original "Image" or the "Actor" we need to keep like this.
Its the original image, and the actor would need to have similar dimensions. Its more for iPhone games and its more important for graphics intensive games and larger images. Images are rounded up to the next power of 2 so if you had an original image of 255x511 it is rounded up to 256x512. But if you had an original image of 513x257, it is rounded up to 1024x512 which is a lot of memory wasted.
So if you had 5x5 images, its not really worth scaling your image down to 4x4.
So what if you want to create a platformer, and the width is longer than 1024? Do you copy the image that is 1024 over and over to create a scrolling background that is > than 1024? Like discussed in looping a background?
Specifically, its the images you add to the project. So even if you had a drawing of a very long dragon, please limit its size of either/both dimensions to 1024. Break the image up into smaller pieces as needed.
So background images or foreground images are excluded from this rule then. What is the recommended maximum height or maximum length for a foreground/background image? Or can you extend it to whatever you want?
background/foreground images are not excluded. All images are included in the "rule". Its just the loading of the images that can waste memory when it is rounded up to the next power of 2. So you can have a 2x2 pixel image that you import into the project and make it the image for a 1000x1000 actor (not that I am recommending this), but it doesn't waste the memory that adding a 600x600 pixel image would as the image dimensions will be made to be 1024x1024 pixel image with transparencies.
Images are limited to 1024 pixels in either dimension.
background/foreground images are not excluded. All images are included in the "rule". Its just the loading of the images that can waste memory when it is rounded up to the next power of 2. So you can have a 2x2 pixel image that you import into the project and make it the image for a 1000x1000 actor (not that I am recommending this), but it doesn't waste the memory that adding a 600x600 pixel image would as the image dimensions will be made to be 1024x1024 pixel image with transparencies.
Images are limited to 1024 pixels in either dimension.
Not all computers are created equal. On my machine, I am unable to see images greater than 2048 in a single dimension in GameSalad.
As for the 1024 size limit, I've been told that even though you can see images larger than that, the iPhone scales down the image so you have a bad quality image and essentially a waste in memory.
CodeMonkey < GendaiGames. GendaiGames is our highest level access account that a few of us share to moderate the forums. I just forgot to log out and login as CodeMonkey.
Head Chefs and Administrators are us. Sous Chefs are non-Gendai Games users who we have "upgraded" their status for one reason or another.
so it´s better to break all the objects from my background (as they are going to reduce the size) and start populating my scene with this objects righ?
how many objects of the same instance/actor I can repeat at the same scene...is there a limit for this?
and if I choose a background scene color in blue without using a background tile actor colored in blue ,will it display the color on iphone??
Sous Chefs have been "upgraded" depending on what they have done. The charge is that they have posted awesome games, really helped out answering questions, or other things we deem useful for upgrading.
beatrage, The number of objects on a scene is more limited by how complex their behavior lists are. If you have actors with lots of behaviors, you won't be able to put as many actors. If you take a look at the Piryx man game http://gamesalad.com/game/play/1488 we put in about 200 actor instances in the scene plus spawned actors. Although most of them are invisible actors for the buildings and intersections and have no behaviors.
And so there is no confusion, objects in a scene are actor instances. The actors in the Actors tab of the Inspector are Actor Prototypes. Editing an actor prototype will change all the instances of that actor unless an actor instance has been edited to be different from the prototype.
If you take a look at my Fill 2: Color Fill game, there is a toggle background button. That is just the scene's background color. No actor required except for the button. It looks and acts the same on the iPod Touch/iPhone.
as I want to put background actors as fixed tiles with zero behaviors than I have no restriction!and if I want to change their color individualy I just need to edit each ones colors on the ones dropped on the scene, leaving the Prototypes.
My character has a 20 sprite frames per animation( 20 per walk, 20per stand and 4 to punch) I think iphone an handle it what do you think?
I'n pretty sure a 960x320 image is stored in a 1024x 512 or 1024x1024 memory block. Increasing the size of your image won't help. This tip is more for people that have resources that are just outside a lower power of 2 and it wouldn't hurt to decrease their size a little to save memory.
So just to confirm, a 960 x 320 will be handled as if it were 1024 x 512. and a 257 x 256 would be handled like a 512 x 256 In other words, it rounds out the dimensions to power of 2.
So just to confirm, a 960 x 320 will be handled as if it were 1024 x 512. and a 257 x 256 would be handled like a 512 x 256 In other words, it rounds out the dimensions to power of 2.
CodeMonkey, your link in your first post is broken.
Some tips to optimization that i've also found helpful:
Don't use constraints if you don't have to. use Change Attribute whenever possible, constraints fire constantly whereas change attribute fires only once.
Limit your use of use timers, use self.time and game.time if you can.
Image sizes, as CodeMonkey said.
Minimize rules per actor, destroy actors that are no longer needed.
Do with math what you would normally do with geometry overlaps, if you can.
Turn off the Movable flag on actors that are not movable
Turn off the visible flag for actors that are not visible.
design219 said: Self.time? I didn't know about that one. So if you want something to live for 2 seconds you can do something like... if self.time = 2, destroy actor?
Comments
Hey CodeMonkey, how much does this affect performance? I don't think I've been doing this. Also for clarification, is it the original "Image" or the "Actor" we need to keep like this.
Its more for iPhone games and its more important for graphics intensive games and larger images. Images are rounded up to the next power of 2 so if you had an original image of 255x511 it is rounded up to 256x512. But if you had an original image of 513x257, it is rounded up to 1024x512 which is a lot of memory wasted.
So if you had 5x5 images, its not really worth scaling your image down to 4x4.
When you say power of 2 you mean that the width can evenly be divided into length or vise-versa also. Is that correct? For instance
25 x 50 - power of 2
26 x 50 - not a power of 2 (this would be rounded to 100 x 50??)
100 x 50 - power of 2
200 x 50 - power of 2
1000 x 50 - power of 2
Are these all correct? I just don't want any wasted memory
2x1024 - power of 2 rule.
30x60 - not power of 2 and will be rounded to 32x64
258x7 - not power of 2 and will be rounded to 512x8
So if I wanted a background of length greater than 1024, would that be an issue?
Images are limited to 1024 pixels in either dimension.
Images are limited to 1024 pixels in either dimension.
so as I am using a background image of 2880x320 do you recommend me to change for 1024x320??
so if I want to have a scene with a background as large as 2880 it´s better to have a background with multiple tiles on it??
As for the 1024 size limit, I've been told that even though you can see images larger than that, the iPhone scales down the image so you have a bad quality image and essentially a waste in memory.
CodeMonkey < GendaiGames. GendaiGames is our highest level access account that a few of us share to moderate the forums. I just forgot to log out and login as CodeMonkey.
Head Chefs and Administrators are us. Sous Chefs are non-Gendai Games users who we have "upgraded" their status for one reason or another.
how many objects of the same instance/actor I can repeat at the same scene...is there a limit for this?
and if I choose a background scene color in blue without using a background tile actor colored in blue ,will it display the color on iphone??
thanks for the answers CodeMonkey!
beatrage,
The number of objects on a scene is more limited by how complex their behavior lists are. If you have actors with lots of behaviors, you won't be able to put as many actors. If you take a look at the Piryx man game http://gamesalad.com/game/play/1488 we put in about 200 actor instances in the scene plus spawned actors. Although most of them are invisible actors for the buildings and intersections and have no behaviors.
And so there is no confusion, objects in a scene are actor instances. The actors in the Actors tab of the Inspector are Actor Prototypes. Editing an actor prototype will change all the instances of that actor unless an actor instance has been edited to be different from the prototype.
If you take a look at my Fill 2: Color Fill game, there is a toggle background button. That is just the scene's background color. No actor required except for the button. It looks and acts the same on the iPod Touch/iPhone.
ok thanks for the hint!
as I want to put background actors as fixed tiles with zero behaviors than I have no restriction!and if I want to change their color individualy I just need to edit each ones colors on the ones dropped on the scene, leaving the Prototypes.
My character has a 20 sprite frames per animation( 20 per walk, 20per stand and 4 to punch) I think iphone an handle it what do you think?
thanks for the replies CodeMonkey
I should change the file to 1024 x 512 and that will increase performance?
Thx for the help!
So just to confirm,
a 960 x 320 will be handled as if it were 1024 x 512.
and a 257 x 256 would be handled like a 512 x 256
In other words, it rounds out the dimensions to power of 2.
And mega Zombie post
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
So would these use the same amount of memory as if they were 1024 x 1024?
Thanks
Thx all!
QS
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
Some tips to optimization that i've also found helpful:
Don't use constraints if you don't have to. use Change Attribute whenever possible, constraints fire constantly whereas change attribute fires only once.
Limit your use of use timers, use self.time and game.time if you can.
Image sizes, as CodeMonkey said.
Minimize rules per actor, destroy actors that are no longer needed.
Do with math what you would normally do with geometry overlaps, if you can.
Turn off the Movable flag on actors that are not movable
Turn off the visible flag for actors that are not visible.
A few more... i forget
As for the broken link, this thread is over a year old. Some of the info has surely changed.