0
votes

I want to create the game like this. It is puzzle game.

My questions is do I need to have different images for each devices? So for now as we can see Apple has 5 different mobile devices sizes:

  • iPhone 3.5''
  • iPhone 4''
  • iPhone 4.7''
  • iPhone 5.5''
  • iPad

So my question is if I have assets for iPad retina, then I also need 4 other the same assets with backgrounds and puzzle images for iPhone sizes? Or I can optimize it? Like for example if we create 3d game, openGL renders just needed frame and we don't need as many scene as many devices we have, just one.

2
Here is a good tutorial to start with and get a whole picture about universal apps raywenderlich.com/49695/…Whirlwind

2 Answers

2
votes

Detect devices and setup your assets like this.

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
    {
        CGSize result = [[UIScreen mainScreen] bounds].size;

        if (result.height == 480)
        {
            // Setup iPhone 4, 4s, iPod Touch Assets
        }
        else
        {
            // Setup iPhone 5, 5s, 6 Assets
        }
    }
    else if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
    {
        //Setup iPad Assets
    }
2
votes

There are many factors to consider when supporting different screen sizes. A big factor to consider is whether or not you want separate non-retina and retina (@2x) versions of your assets. You could decide to just use retina images and let them scale down on non-retina devices, but it would not be optimized because you would have the full textures loaded into memory.

The next factor to consider is the size of your assets. Are you planning on making the game have larger assets on larger devices? Or are you planning on keeping the assets all the same size but giving larger devices a larger viewport? (i.e. iPhone might have scrollable view while iPad wouldn't need to scroll because it would have a larger view)

The next factor to consider is the aspect ratio of your assets. You will certainly need different assets for when you aspect ratios differ (such as typically in the case of background images, splash screens etc.)

I recommend you use Apple's Images.xcassets folder. It will allow you to organize all of your assets across all the different devices. And for more information about scene scaling on different resolutions, I suggest you read my answer here