Thoughts on supporting iPhone @2x resolution ..

Discussion in 'Game Development (Technical)' started by Jamie W, Nov 17, 2010.

  1. Jamie W

    Original Member Indie Author

    Joined:
    Apr 16, 2006
    Messages:
    1,211
    Likes Received:
    0
    i.e. with the latest gen of iPhone and iPod touch, with the retina displays; and debating if to bother supporting them, at this time.

    I'm only a small, one man band 'team', and my initial thoughts are that it could be more trouble than it's worth. Time would be better spent knocking out a few games, in as fast a time as possible.

    I'm also thinking about the technical considerations for supporting @2x graphics, in openGL.

    For example:

    I use texture atlases with a look-up-table for each sprite, defining x,y,width,height etc. So, I guess I would have to create all my game graphics at 2x size, process them all in to texture atlases, making sure that everything falls neatly in to 2 pixel boundarys, with a 2 pixel border between sprites on each atlas.

    I can then create a scaled down texture atlas from this 2x size one. Taking care that I scale down with the correct filter, so as not to create any bleed etc; also, that the look-up-table, will work for both the 2x version and the 1x version of each atlas.

    *groan*

    Also, I'm thinking textures will take approx. 4x memory of normal textures, and memory could get low.

    Also, I'm thinking it would require blitting of 4x the amount of pixels, so that means I can use less sprites, or even a slower frame rate.


    I guess it would be 'nice' to support @2x, and my inner geek would love to do so, but from a business stand-point, I'm thinking it may not be the best idea, for someone in my position (lone, indie-developer).

    Any thoughts on all that?

    Cheers,
     
  2. meno

    meno New Member

    Joined:
    Jan 17, 2010
    Messages:
    2
    Likes Received:
    0
    i think you should have a look at how cocos2d handle this issue. i hacked out a quick game yesterday to test the feature and it works like a charm.

    you provide two sets of graphics (name.png and name-hd.png). in the code, you always call the graphic by its default name (name.png) and if the screen is @2x the -hd will be loaded without extra work.
    also all coordinates use the lower resolution but are mapped to the bigger one without you having to do any work.

    RetinaDisplay in cocos2d

    so i guess if you have your own engine, you could take the same route. specify a flag that tells if its @2x and then act accordingly in all drawing methods.

    with this method, the "extra" costs for supporting both resolutions are that you have to do 2 sets of graphics, which mostly is quite easy.

    hope that helps.
     
  3. Moose2000

    Moose2000 New Member

    Joined:
    Jul 3, 2006
    Messages:
    138
    Likes Received:
    0
    I think it's worth the extra effort - the 320x480ish resolution is on its way out - if you're going to port to Android / WP7 you'll probably want higher res textures there too.

    With the really fine dot pitch on the retina display, you can actually get away with lower res textures in most places as long as a few key ones (overlays, especially fonts) are high res.

    I thought it was worthwhile reworking Ancient Frog for the retina display, for a couple of reasons - first, I already had most of the higher res assets (from the desktop & android versions), and second, a big part of its thing is "look how beautiful games are on my phone", so I want it to look its best.

    As far as texture memory is concerned, make sure you're using compressed textures. I check the display resolution, and for lower res devices I only load the lower mipmap levels, so memory & loading times aren't affected.
     
  4. jcottier

    jcottier New Member

    Joined:
    Jul 12, 2006
    Messages:
    1,385
    Likes Received:
    0
    > the 320x480ish resolution is on its way out
    I agree with Moose2000.

    Also, if you make your game retina compatible: 640x960, you are getting very close from the IPad res (768x1024). So in theory, it make your life easier to create IPad build too. I saw some games on IPad (IPad build) witch indeed are using a res of 640x960 with black border on the IPad (or you could scale things a bit if your art support it).

    Also, don't forget that with each new gen, the device get more memory and better CPU/GPU.

    JC
     
  5. Jamie W

    Original Member Indie Author

    Joined:
    Apr 16, 2006
    Messages:
    1,211
    Likes Received:
    0
    Thanks Moose / JC. :)

    Having a bit of a headache getting this to work. I'm assuming I need to do a hell of a lot more than just set my view's contentScaleFactor to 2.0?

    Everything is just getting pushed in to the lower-right (in landscape mode).

    Plugging away...
     
  6. PoV

    PoV
    Indie Author

    Joined:
    Jul 27, 2004
    Messages:
    2,132
    Likes Received:
    0
    Not much more than that. Once you do that, you obviously need to make your code handle a larger surface (even though touch input is still at 480x320). I had a bug after making the change, a typo in the conditional "specific iOS hardware checking" Objective C code. Your problem might be similar.

    To anyone listening, if you're developing a long term project and want to stay relevant: STOP DEVELOPING GAMES FOR A FIXED RESOLUTION! We're right in the middle of perhaps the biggest shift in computers and gaming yet (perhaps the last big one). With so many new things going on, we wont know the results until the dust settles (Though Apple is clearly in the lead). iOS launched almost 2 and a half years ago, and got resolution obsoleted within 2 years. There's a good chance it may slow down now, but Mobile GPU's and CPUs are improving at a ridiculous pace (dual core).

    I adore my iPod 4 BTW. The best "Mini Computer" I've ever owned.
     
  7. jcottier

    jcottier New Member

    Joined:
    Jul 12, 2006
    Messages:
    1,385
    Likes Received:
    0
    Definitely. I've recently updated my engine, so the game res is independant from the display res & ratio. So, it does give you a nice scaling and border thingy for free (scalling up or down). Obviously, that won't be enough to support properly everything (if you don't want border) but at least it make my life easier. I recently ported 2 of my PC games (800x600) on the Ipad (1024x768) without having to change a line of code about the display difference.

    JC
     
  8. JGOware

    Indie Author

    Joined:
    Aug 22, 2007
    Messages:
    1,578
    Likes Received:
    0
    yep, the ipad makes it easy to port all those 4:3 pc games. Is anyone using a proj matrix to scale everything to 1024x768 or are you doing it object by object on the fly?
     
  9. LateNight

    LateNight New Member

    Joined:
    Jun 28, 2009
    Messages:
    58
    Likes Received:
    0
    It depends on the game really. I ported both of Jack Norton's Vera Blanc games to the iPad (and iPhone) and for a game like that, where you have fixed 2d backgrounds, I used the projection matrix to scale everything. With that, all you have to do is a single calculation on the iOS equivalent of the mouse position (ie: touch positions) and everything runs at the "virtual resolution" your PC game ran at.

    If you're doing a 3D game, it might make sense to show more of the world and adapt your GUI to fit, but if you've got a complex GUI that can become very fiddly. If you have a pretty simple HUD, and a few menus, doing it manually is probably worth the extra effort.
     
  10. hippocoder

    Indie Author

    Joined:
    Mar 18, 2008
    Messages:
    591
    Likes Received:
    0
    It does run slower with larger textures, but just because the resolution is higher, it does not mean you need to automatically use 2048 textures.
     

Share This Page

  • About Indie Gamer

    When the original Dexterity Forums closed in 2004, Indie Gamer was born and a diverse community has grown out of a passion for creating great games. Here you will find over 10 years of in-depth discussion on game design, the business of game development, and marketing/sales. Indie Gamer also provides a friendly place to meet up with other Developers, Artists, Composers and Writers.
  • Buy us a beer!

    Indie Gamer is delicately held together by a single poor bastard who thankfully gets help from various community volunteers. If you frequent this site or have found value in something you've learned here, help keep the site running by donating a few dollars (for beer of course)!

    Sure, I'll Buy You a Beer