Game Development Reference
The -hd , -ipad , and -ipadhd extensions are the default file extensions used by
cocos2d for Retina and iPad-specific assets. These file extensions aren't used by regular
iOS apps. Such apps have to use Apple's @2x file extension for high-resolution im-
ages. Although the @2x extension does work with cocos2d apps as well, the cocos2d
documentation warns users not to use the @2x file extension.
Tip A very frequently asked question is whether it wouldn't be appropriate to
simply downscale HD images on non-Retina devices. It's not, and there's two
reasons for that. One is memory constraints. The non-Retina devices have only
half the memory (or even less) than what's available even on the earliest Retina
devices. Requiring a non-Retina device to load an HD image will use up four
times as much memory compared to an already downscaled and bundled SD
image. Second, it takes noticably longer to load a Retina image, more so on
older and slower devices like those without Retina displays.
The alternative, to use standard-resolution assets throughout, isn't very appeal-
ing either. You simply won't be able to take advantage of the Retina resolution,
and your app's image quality will never look appropriately high-resolution
on Retina devices. No amount of upscaling and clever image-processing al-
gorithms will be able to generate a crisp and clear look on Retina devices from
standard-resolution images. That's why you should design all your game's as-
sets in high resolution and then downscale if needed. The only thing to watch
out for is to use dimensions that are divisible by two with no remainder.
Xcode asks you details about how and where to add the files, as in Figure 4-6 . Make
sure the Add To Targets check boxes are set for each target that will use the files,
which in the figure is only the DoodleDrop target, but in Kobold2D you may want to
add the file to the Mac OS X target as well. The check box "Copy items into destina-
tion group's folder (if needed)" should be checked if the file isn't already located in the
project's folder. If in doubt make sure it's checked, at worst you will have duplicate
versions of the same file. If you don't check it, at worst files may be missing if you add
the project to source control or if you zip and share the project.
Tip The preferred image format for iOS games is PNG (Portable Network
Graphics). It's a compressed file format, but unlike JPG's, its compression is
lossless, retaining all pixels of the original image unchanged. Although you can