Can someone explain the whole "Power of Two"?
sewinston
Member Posts: 51
I know that computers like numbers like 8, 16, 32, 64, 128, 256, etc. I'm going to assume that the iphone was optimized to use image files of these pixel dimensions. My questions are:
1- Is the performance decrease significant? Is there a difference in the decrease between something small like 130px instead of 128px vs. something big like 340px vs 256px?
2- Does it have to be square? For example can I do 128x64 and it still be optimized?
3- is it just 8, 16, 32, 64, 128, 256, etc. or can you use half steps like 12, 24, 97, 192, etc.
Thanks.
1- Is the performance decrease significant? Is there a difference in the decrease between something small like 130px instead of 128px vs. something big like 340px vs 256px?
2- Does it have to be square? For example can I do 128x64 and it still be optimized?
3- is it just 8, 16, 32, 64, 128, 256, etc. or can you use half steps like 12, 24, 97, 192, etc.
Thanks.
Comments
I've broken that rule a few times, so we'll see how much of a deterent it is to optimization in gameplay....
So with the Display Size set at 480x320, by making a graphic that is 480 in width would waste space?
Example: I have a star field set at 480x1500 that scrolls. What would be the best for the power of 2?
Let's use Xacto's 480x1500 star field image as an example:
- This image takes up the same amount of memory as a 512x2048 image.
- So, the width could go up to 512 without using any additional memory. Would that be useful? Probably not.
- The height could go up to 2048 without using any additional memory. That could be nice to take advantage of, since the image will scroll vertically. (BUT this should actually be implemented as two 1024-height images if it's an iPhone project.)
- Let's say Xacto wants to trim this image to improve performance. Reducing the height to 1200, or 1100, or even 1025 would have no effect. Reducing the height to 1024 would have a significant effect -- all other things being equal, it would take up half as much memory.
I got away with 512x256 with my side scroller as the HUD took up some space.
All in the name of optimisation!
Edit: Why is its length 1500 - could you not make it repeat itself and have it smaller?
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
If your game is not action-intensive, it won't really matter. If it doesn't have a lot of moving actors it probably won't matter. A game like mine has a lot of actors moving on screen, so I have to keep as much memory as possible.
My map images & BG's are all 480 x 320. But this means that the iPhone is really computing it as an image of 512 x 512 (memory wise). Since this is only one actor no big deal. But if I had 20 actors on screen that were that size & all moving..... I think you see the point. It would be a lot of waste. So in essence, no matter the size of your graphic file (not actor) the system will use memory based on a picture of the size of: 8, 16, 32, 64, 128, 256, 512, or 1028.
Hope this helps.
PS. Personally I would leave your pictures the same.
Start here!
QS
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
1 - 8 = 8
9 - 16 = 16
17 - 32 = 32
33 - 64 = 64
65 - 128 = 128
129 - 256 = 256
257 - 512 = 512
513 - 1028 = 1028
Larger images are not supported on the iPhone.
you can't use vector-images in GS.
I don't know which ImageEditor you are using, but for example in Photoshop you can choose one of 3 or 4 methods how Photoshop scales images down.
Depending on your choice your bitmap could look more or less blurry.
and just another Idea... maybee you can try the following too:
When your image with dimension 397x641 looks sharp on an actor with 16x32 pixels... try to make a screenshot in GS, crop your image in an ImageEditor to 16x32 and use this image for your actor... (don't know if this works
Otherwise like mentioned above i would have a look into my ImageEditor and search for a way to choose a sharper scaling method...
...oh and now when i am ready writing this i remember that your brother has the adobe suite? or am i wrong ? so in the preferences of photoshop you find the scaling methods... this could help...
cheers
SDMG
I would try making your image 32x64. See if that makes a difference. If there isn't a lot of action going on in the scene you may be able to just take the hit & make it keep higher dimensions. Up to you to know if you can afford the memory. For instance, I had some 'icons' in my game that were like 120x150 or something. I kept them & made my actor in game 40 x 40. Because on that scene there was no action, no moving parts, it was basically a stat/skill/character screen. So it worked for me there.
Hope this helps.