Search Unity

Universal App w/o bloating download size

Discussion in 'iOS and tvOS' started by jasonFHH, Aug 2, 2012.

  1. jasonFHH

    jasonFHH

    Joined:
    Jul 17, 2012
    Posts:
    21
    Hi,

    I had an overall question about best practices for delivering a universal binary for games (made w/ Unity). There are obviously many benefits to having a universal download, as it doesn't fragment your presence in the App Store. However, I feel for games this is particularly difficult mainly due to graphics:

    a) Most games rely on their own custom UI which must be down as high-quality bitmaps in order to not look fuzzy
    b) Each device needs those bitmaps at their target resolution

    Traditional "application-y" Cocoa apps don't have as much of a problem here since Quartz2D + Cocoa take care of a lot of graphical elements for you, but games frequently "do it on their own".

    Having said that, how does one keep down the file size of the app bundle if both sets of assets must be stored? For games that are aiming to be under 50MB, wouldn't a universal app make reaching that goal twice as hard? Perhaps I'm missing something.

    Thanks,
    Jason
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Not really...you can do the bitmaps at the highest resolution, and scale them down as needed. As long as you're scaling down, not up, there's rarely an issue.

    --Eric
     
  3. jasonFHH

    jasonFHH

    Joined:
    Jul 17, 2012
    Posts:
    21
    @Eric:

    Example:

    * You have a background gradient that is set to be the height of your device background.
    * It is implemented using a thin strip/slice that is tiled/repeated horizontally
    * On the iPad that's 2048 at 264ppi, on the iPhone that's 960 pixels at 326 ppi

    The aspect rations differ as well (1.5:1 for iPhone, 4:3 for iPad), so you can't just literally take the iPad gradient strip and scale it down without the gradient actually appearing different as well (even if not fuzzy). In this case to control the look you'd have to provide both strips for each platform.

    Now that graphic is occupying texture space in both iPad and iPhone versions.

    Please point me in the right direction if there's something I'm missing.
     
  4. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    A gradient? Sure you can. You don't even need a texture for a gradient, just make a full-screen plane and create the gradient using vertex colors. Even if you did use a texture, 2x2 pixels is quite sufficient for a gradient; bilinear interpolation takes care of the rest.

    --Eric
     
  5. jasonFHH

    jasonFHH

    Joined:
    Jul 17, 2012
    Posts:
    21
    Yes, I understand you could do it programmatically, however that's not the question I'm asking. The solution you provided is similar to the solution that Cocoa or other libraries provide when you dynamically generate/rasterize bitmaps. I understand that a similar graphic can be generated using vertex coloring or other programmatic techniques.

    I'm specifically asking about sprite usage in games across devices, and how that can be done in an efficient way. I gave the above example to keep it as basic as possible, though there are countless times when you want to use the above approach instead of a progammatic approach (e.g. for creating complex, photo-realistic patterns).

    Any ideas for how to handle this efficiently w/ sprites in a universal binary way?
     
    Last edited: Aug 2, 2012
  6. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    As I said, create for the highest resolution and scale down. Maybe someone else has a different idea, but that's what I do and it works fine.

    --Eric
     
  7. jasonFHH

    jasonFHH

    Joined:
    Jul 17, 2012
    Posts:
    21
    When you create for the highest resolution, what do you mean by that since the iPhone uses a higher res than the iPad, though the iPad has a larger screen space.
     
  8. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    No...2048x1536 for iPad, 960x640 for iPhone. Unless you mean dpi, but that doesn't seem relevant here.

    --Eric
     
  9. jasonFHH

    jasonFHH

    Joined:
    Jul 17, 2012
    Posts:
    21
    I was referring to the ppi, which does impact things, but I think since the iPad screen dimensions are over twice as large as the iPhone's, scaling a 264 ppi graphic down by a factor of 2x will yield a result ppi that is high enough for the 326 ppi iPhone.