Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

2d game Atlas questions: there are 3

Discussion in 'iOS and tvOS' started by TrinityGamer531, Mar 6, 2021.

  1. TrinityGamer531

    TrinityGamer531

    Joined:
    Nov 8, 2019
    Posts:
    2
    Hello and thanks in advance for anyone who can answer this, as i've googled, searched the forum, and have just become more uncertain with each post i've found.


    -----------------------
    Back information:
    -----------------------
    The 2d game i'm making has seasons and weather in it. Most of the tiles in each scene 'versions' are the same (about 60-75%). Itt is only the remainder that changes based on the weather or season. Also, most of the Mobs and characters can pop up in most locations.

    because so many of the scenes use 60-75% of the same tiles, it means that my build size will most likely be much, much larger if i use different atlases for different scenes, however, i was able to put all the images into 1 1024x2048 atlas, heavily reducing the build size, but the information i came across on the web implied that if most of the atlas is not used in the scene, then it would hurt performance a great deal.

    I also found conflicting information about how to handle the character/mob images, some of them said to put them into their own seperate atlas, and some said to put them all in the same atlas as the scene terrain if they will be in the same terrain (and as stated, the npcs, at least, can appear in almost all scenes. If i put all of the npcs, mobs, and all terrain into the same atlas, it makes a total atlas size of 2048x2048, if i keep them seperate, then it's a single atlas of 1024x2048 plus which ever mob is loaded.

    -----------------------
    Actual questions:
    -----------------------
    Q1: is it better to put all the tiles into the single 2048x atlas (less redundant tiles, cutting down on build size), or keep them in their own atlases, ( smaller atlases, but larger build size)

    Q2: should mob and character sprites all be put into the single atlas as well, or kept to their own individual atlases?

    Q3: most of the information i've read said that a 2048x2048 atlas is safe for almost all mobile devices, barring only the oldest ones that most people do not use anymore, but a few said that it was actually 1024x1024, which is correct?
     
    Last edited: Mar 6, 2021
  2. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,786
    3) I'd say that 2048 resolution is a safe maximum size, haven't had any issues with that size on mobile.

    1) Size of 2048 atlas=4x1024 atlases=16x512 atlases. So, if you separate your single 2048 atlas and end up with 3 atlases of 1024 resolution, your build size will be smaller than using a 2048 atlas. Even if you end up with 4x1024 atlases, if only one of these atlases are used in the currently active scene, then only that atlas will consume RAM and there will be 3x1024 atlas worth of free space in RAM. However, if 3-4 of these 1024 atlases are used in the scene, then I'd expect that the performance would be worse than a single 2048 atlas because sprites in different atlases can't be batched in a single draw call (it may not be the case with SRP Batcher).

    2) If you are planning to use different import settings for these sprites (e.g. enable Mipmaps for a fraction of them), then you need to create different atlases for these different configurations (put Mipmap sprites into an atlas with Mipmaps enabled, the rest on an atlas with Mipmaps disabled). If you put Mipmap sprites into an atlas with mipmaps disabled, AFAIK those sprites won't have mipmaps after the build. Let's say all your sprites will have the same import settings. Then you need to decide what's more important for you as described in point 1: build size, RAM and/or dynamic batching. Honestly, if we are talking about a single 2048 atlas for all the characters in the game, then I'd go for it. Optimizing that single sprite atlas shouldn't really matter for the majority of mobile hardware.
     
  3. TrinityGamer531

    TrinityGamer531

    Joined:
    Nov 8, 2019
    Posts:
    2
    Thank you, because of the reuse of the buildings and most trees for the both the season and weather (rainy, dry), it actually comes out to 6 1024x1024, but only 1 2048. So i'll go with that. And for the characters, none of them have mipmaps (think top down 2d zelda kind of thing). so being able to put them all into 1 sheet is great. thanks so much for the advice.
     
    yasirkula likes this.