Search Unity

Limit to 4096

Discussion in '2D' started by Cognitive Dissonance, Nov 16, 2013.

  1. Cognitive Dissonance

    Cognitive Dissonance

    Joined:
    Nov 15, 2013
    Posts:
    4
    Hello everyone :),

    I am trying to do is import a 30000 x 1960 sprite that is my ground area however, i realised that only sprites up to 4096x4096 are allowed.

    What workaround would you suggest on this? Split the ground in many different sprites and make them spawn when the player approaches them?

    Note: I cannot scale the area down as it starts looking pixelated.
    Note2: This is my first post so if i am somehow breaking any rules that i am unaware of, please let me know.
     
  2. unitylover

    unitylover

    Joined:
    Jul 6, 2013
    Posts:
    346
    Use tiles instead of creating one giant area. It's pretty resource intensive to constantly draw a 30000px X 1960px sprite on the screen at all times. There are many tiles editors available on the asset store or you can place them yourself. A method I use for making tile setup easier is to create a 2x2, 4x4, 8x8 and 16x16 area of tiles and make duplicate them in grounds so I don't have to manually place each individual tile 1 by 1.

    All the above aside, I will be posting a video tutorial on create top-down games using the new 2D features soon. I will keep you posted.
     
  3. Cognitive Dissonance

    Cognitive Dissonance

    Joined:
    Nov 15, 2013
    Posts:
    4
    Thank you for the reply,

    The thing is i am using an assymetric terrain ( there are hills etc ), it looks sort of like a painting. Example:

    $WithAtmosphere.PNG

    Therefore the tiles approach would not really work i'm afraid :/
     
  4. unitylover

    unitylover

    Joined:
    Jul 6, 2013
    Posts:
    346

    Ahh, well this is a different story then you're right, tiles wouldn't work very well in this situation. You might try breaking up your terrain into 7 pieces each 4096 long? I cannot think of any other solution at the moment that would accommodate this.
     
  5. the_motionblur

    the_motionblur

    Joined:
    Mar 4, 2008
    Posts:
    1,774
    It depends a little on how much your terrain/level really (and I mean really and absolutely necessarily) has to be one piece with absolutely no repetition, whatsoever.

    At least in your screenshot I'd see the possibility to slice the picture into a few repetitive tiles. For example the tree in the background might be one - the floor can be a repetitive tile and the upwards slope then can also be created in that fashion.
    Have a look at what Super Mario World 2 did on the SNES in 1995 in terms of hand drawn (yet modular) style: http://www.mobygames.com/game/snes/super-mario-world-2-yoshis-island/screenshots

    If you really must have everything made from one piece - at least slice the whole thing up into several pieces. The more you can re-use the better. MAybe you can at least reuse some things and make them tileable. Try to save space and performance wherever possible.
     
  6. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    There's no hardware that can do textures of 30000 x 1960, and for maximum compatibility you wouldn't want to go beyond 2048x2048 for a single texture anyway. You're talking about >200MB (uncompressed) for the texture size with that many pixels, so unless there's some serious need for it to be completely unique, you should build the level out of blocks, which will massively reduce the memory requirements. (If you don't mind a shameless plug, my upcoming SpriteTile system can use tiles of any size, so you can mix large blocks with smaller blocks as you like, and they don't need to be square either.)

    --Eric
     
  7. Cognitive Dissonance

    Cognitive Dissonance

    Joined:
    Nov 15, 2013
    Posts:
    4
    I see. Then i guess an idea could be that i slice the terrain and only spawn the adjacent left and right terrain pieces of the current terrain every time. So i would effectively have 3 pieces of terrain by 1960x4096 each. Can pretty much every modern machine handle a 4096 resolution? I am so new to this, if you have a related article post it no matter how long and i ll read that instead of taking up your time.

    Thank you once more :).
     
  8. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    2,433

    This is the right idea. If your strip height is 1960, I would suggest you go ahead and make all the chunks of your background as 2048x2048. Many platforms require each dimension of an image to be a power of two (2[sup]11[/sup] = 2048), and some platforms require both dimensions to be the same (square). Plus, this way you're only 37MB uncompressed at any given time, rather than 72MB uncompressed for the dimensions you suggest.
     
  9. Cognitive Dissonance

    Cognitive Dissonance

    Joined:
    Nov 15, 2013
    Posts:
    4
    I guess i will just glue together all those 2048x2048 pieces. (Bummer, now i have to take so much time dividing all terrain and arranging it perfectly like a puzzle in unity T_T)

    Out of curiosity, can anyone explain why a machine can handle 2x 4096 pieces but not 1x 8192? I would guess its a hardware thing (?).
     
  10. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    It's a hardware thing.

    --Eric
     
  11. TomasJ

    TomasJ

    Joined:
    Sep 26, 2010
    Posts:
    256