GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

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

Answers

  • bufteabuftea Posts: 43Member

    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.Posts: 12,822Member
    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 Posts: 43Member

    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.Posts: 12,822Member
    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.Posts: 12,822Member

    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.