A little confused about actor size

I need some help (again).
Reading on the forum I've found some discussions about actor size Best Practice.

Is it true that the X and Y size have to be integer divisible by 4? I thought that only the texture size must be divisible by 4.
Also the position. Does it have to be integer numbers for static actors? I hope not divisible by 4.

And the resolution for the texture: for the old Iphone devices - twice the size; for the new ones three times the size. What is the reason for that? I ask because I want to apply the same thinking to Android devices.

I already have the formula for my size attributes, which are real : floor(X)+(4-floor(X)%4) , but before changing every size of every actor I want to know if it's absolutely necessary

PS if you know of another thread that answers this questions , just post the link

Best Answer

  • SocksSocks London, UK.Posts: 12,822
    edited April 2015 Accepted Answer

    @buftea said:
    Is it true that the X and Y size have to be integer divisible by 4? I thought that only the texture size must be divisible by 4.

    Neither the actor nor the image need to be divisible by 4 - it's just a recommendation for optimal image quality in certain circumstances and with certain kinds of images, but if you ignore it you aren't going to break anything.

    For example it would be pointless worrying about divisibility if your image is a soft fluffy cloud, or a sunset background, or a fast moving asteroid, or even a slow moving asteroid for that matter, in fact making anything move will pretty much render the divisible by 4 recommendation redundant as will animating your actor's size as will applying your image to an actor that is smaller or larger than the image asset, as will animating the actors rotation or even just having the actor static but rotated to a certain angle* . . . (etc etc) . . . and many other things that offset the pixels in the image from the pixels on your actual device, negating the divisible by 4 recommendation.

    (there are 4 exceptions here, 0° - obviously! - 90°, 180° and 270°)

    On the other hand if your assets are very graphic (fonts, fine line drawings, non-photograhic material) and they are static, then making them divisible by 4 will give you the optimal image fidelity (if - and only if - you place them on whole pixel value co-ordinates).

    But ultimately it's not difficult to make all your assets divisible by 4, so it's good practice to work that way, but if you have a 243 x 191 actor that looks good to you when you test it on a device, then there's no technical requirement for it to be made divisible by 4.

    @buftea said:
    Also the position. Does it have to be integer numbers for static actors?

    Yes, actors need to be placed on whole pixel value co-ordinates, this is the other side of the divisible by 4 recommendation - with both recommendations you goal is to get the pixels in your image to sit on whole pixels on the device, rather than between pixels (which will cause your image pixel to be 'smeared' across two device pixels).

    But there is one caveat here, if you were to have a 101 x 100 pixel actor - and you were to place it at (for example) X=224.5 it would be in the 'right' position as it would be sitting on a whole pixel value - hope that makes sense !

    @buftea said:
    I hope not divisible by 4.

    No, the position of an actor doesn't have to be divisible by anything (except for 1!).

    @buftea said:
    And the resolution for the texture: for the old Iphone devices - twice the size; for the new ones three times the size. What is the reason for that? I ask because I want to apply the same thinking to Android devices.

    Find out the resolution of your target device - then look at the resolution of your project size, if the resolution of your target device is twice the resolution of your project then make your assets twice the resolution of your project (so a 100 x 100 pixel actor should get a 200 x 200 pixel image) - doubling the resolution is broadly applicable to everything - except if you intend to only target an old pre-Retina iPhone for some reason - the one exception, at least in the iOS range, is the iPhone 6 plus (not the iPhone 6), if you were to build for the iPhone 6 plus using the iPhone 6 plus project size you would need to make your assets x3, so our 100 x 100 pixel actor gets a 300 x 300 pixel image . . . . but many people building a universal project for all devices (iPhone 6 plus included) simply build an iPad project using x2 assets as convert to the other target devices from there.

    @buftea said:
    I already have the formula for my size attributes, which are real : floor(X)+(4-floor(X)%4) , but before changing every size of every actor I want to know if it's absolutely necessary

    I don't know what any of that means.

Answers

  • bufteabuftea Member Posts: 43

    All my size and position attributes are created with formulas and the above formula transforms any real number in the closest divisible by 4 integer.
    Thanks for the answer. I will use x6 PNGs. Thanks for the help

  • SocksSocks London, UK.Member Posts: 12,822
    edited April 2015

    @buftea said:
    All my size and position attributes are created with formulas and the above formula transforms any real number in the closest divisible by 4 integer.

    Like I say you don't need to limit an actor's position to coordinates that are divisible by 4.

    I still don't quite understand the use of the floor(X)+(4-floor(X)%4) formula ? Changing the size of an actor to anything other than the size of the image asset will render all the above advice irrelevant, that is to say changing the actor's size to the closest divisible by 4 integer will - in those cases where it is not already divisible by 4 - prevent you from achieving the optimal image fidelity.

    By the way the floor(X)+(4-floor(X)%4) formula will always change the actor size, even if it's already divisible by 4 (if X=4 it will produce 8, if X=88 it will produce 92, if x=100 it will produce 104 . . . etc) - if the formula always changes the actor size then the image quality will always be compromised.

    You should be making your image assets devisable by 4 (if that's what you want to do) prior to importing them into GameSalad, changing the actor on which the image is placed does not change image resolution, a 101 x 101 pixel image on a 101 x 101 pixel actor that is then is then run through your formula will create a 100 x 100 pixel actor with a 101 x 101 pixel image . . . that is to say the image will not be optimal, the pixels will be sat on sub pixel positions and the slight aliasing/smearing that this whole process sets out to avoid will be present.

    @buftea said:
    Thanks for the answer. I will use x6 PNGs. Thanks for the help

    x3 image assets will produce images with 9 times the area of your actor (actor 100 x 100, image 300 x 300).

    x6 image assets will produce images with 36 (!!!) times the area of your actor (actor 100 x 100, image 600 x 600).

    So imagine you have a 256 x 256 actor, your image would need to be 1536 x1536 !! And as 1536 x1536 falls foul of the powers-of-2 rule, the image would actually register as 2048 x 2048 pixels on the actual device, a whopping 64 times the area of your actor !!

    This will create enormous files, the game will likely run very slowly / be glitchy and you will experience some loss in quality as those x6 image assets need to be resampled down to their correct size (in real time on the device !).

  • bufteabuftea Member Posts: 43

    I don't know the size my actors will have. It depends on the device. And now I want to start working on the textures and I don't know how large the textures should be. Or how many versions of the same texture i should make.

    This is why:
    I like to have total control so I created my own Universal Build.

    I want every player (Iphone, Ipad, any Android) to have the same experience so my active screen has a 1,25 ratio no matter the device. I filled the extra space with other stuff at my choice.

    Every actor in the game has the Xsize and Ysize based on a formula like this in order to keep it's ratio intact on any device:

    Xsize = deviceWidth*coefficient
    where the coefficient is in direct relation to the device ratio

    That is why I have difficulties in making use of your advice. I ve seen it in other posts before and it is very good for a given size of an actor.

    How do the studios prepare their texture sizes? A different one for Iphone, Ipad, Android phone or tablet?

  • SocksSocks London, UK.Member Posts: 12,822
    edited April 2015

    @buftea said:
    I don't know the size my actors will have.

    Not sure what that means.

    @buftea said:
    It depends on the device.

    Actor size will really depend on the design of your game, you don't need different sized actors for each device.

    @buftea said:
    And now I want to start working on the textures and I don't know how large the textures should be.

    Find out the resolution of your target device - then look at the resolution of your project size, if the resolution of your target device is twice the resolution of your project then make your assets twice the resolution of your project (so a 100 x 100 pixel actor should get a 200 x 200 pixel image) - doubling the resolution is broadly applicable to everything - except if you intend to only target an old pre-Retina iPhone for some reason - the one exception, at least in the iOS range, is the iPhone 6 plus (not the iPhone 6), if you were to build for the iPhone 6 plus using the iPhone 6 plus project size you would need to make your assets x3, so our 100 x 100 pixel actor gets a 300 x 300 pixel image . . . .

    @buftea said:
    Or how many versions of the same texture i should make.

    Just one.

    @buftea said:
    Every actor in the game has the Xsize and Ysize based on a formula like this in order to keep it's ratio intact on any device:

    Your formula doesn't appear to change aspect ratio ? But if it does change the size of the actor in any way then you can ignore the 'make actors divisible by 4' recommendation - as well as the 'place actors on a whole pixel value' recommendation.

    @buftea said:
    How do the studios prepare their texture sizes? A different one for Iphone, Ipad, Android phone or tablet?

    I expect they simply create their image assets at one size that covers all the target devices.

  • SocksSocks London, UK.Member Posts: 12,822

    Just thought of yet another situation where the divisible by 4 recommendation is largely redundant - if you move the camera, anything on a scrollable will be moved off a whole pixel position (it may well be sat on a whole pixel value in your project but those pixels now do not align with the pixels on the target device), for example set up a scene, make all your image assets divisible by 4, place them on whole pixel value locations, now move the camera 0.5 pixels to the right, now everything is sub-optimal (in that their image fidelity is compromised).

Sign In or Register to comment.