Hello Guest

Author Topic: A very large background... how would you approach to it?  (Read 4766 times)

skisos

  • Newbie
  • *
  • Posts: 7
    • View Profile
A very large background... how would you approach to it?
« on: March 14, 2014, 10:58:32 am »
Hi!,

I'm developing a 2D top-down game. TK2D fits very well for my purposes, it manages sprites & memory much better than Unity standalone but I'm facing some issues with large backgrounds.

My game uses backgrounds I have been designing in Photoshop to get an organic feeling (not tiled) and using them as sprites. It works ok for small portions of the world but I'm afraid it can become a problem when I make larger levels.

I'm using atlases and collections to optimize it, one for 'props' (trees and stuff player surround) but if I check some forums, tile maps are being recommended. As I want each map to be unique and organic, I don’t see the tile maps a solution because I'd need to create a sprite sheet of almost every “level” (I don't use tiles reapeatily but almost everyone is different). Could you give me some insights about how to approach to this?

- Should I split backgrounds and create another collection with them?
- Should I use a static sprite batcher once I get all the background set up?
- Is it better if I dice the sprites inside a collection? (I don't understand very well this, Is it better to dice all my collections always?)

I've bee reading a lot but I don't know how to face this as I'm afraid to continue programming and have to change everything in the future by memory problems. Some people recommend to split large backgrounds in chunks and just load the ones which are visible but I don't know how to approach to that solution, could you hep me with it? I'd really appreciate it.

Cheers.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: A very large background... how would you approach to it?
« Reply #1 on: March 14, 2014, 05:57:30 pm »
If its hand painted, tile maps arent going to work. If you want to dice collections (you should NOT dice animated sprites), that could work, but if its just a standard background then it might be better if you manage that yourself. You can use the sprite from texture component to do this and bypass the collection side of things for the backgrounds altogether.

skisos

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: A very large background... how would you approach to it?
« Reply #2 on: March 14, 2014, 10:52:57 pm »
Thanks for your reply. Could you explain a little bit what you say? I didn't understand very well what you mean with "bypass the collection side of things".

Sorry if I'm too noob, I just need some tips to continue figuring it out.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: A very large background... how would you approach to it?
« Reply #3 on: March 14, 2014, 10:55:32 pm »
By that I mean don't use collections. This might work better.
http://2dtoolkit.com/docs/latest/reference/sprite_from_selected_texture.html

robertwahler

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: A very large background... how would you approach to it?
« Reply #4 on: March 15, 2014, 02:00:54 pm »
Is sprite from texture just for use at runtime?  I tried creating background prefabs using sprite from texture but it leaves a sprite collection in the scene and I'm not sure how to go about reusing a component composed using sprite from texture. Are there some examples I've missed?  Thanks.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: A very large background... how would you approach to it?
« Reply #5 on: March 15, 2014, 03:02:09 pm »
The sprite collection gets destroyed when your sprite from texture object gets destroyed. I'm not sure why you would need to create prefabs of these - surely you can simply just keep one of these in the scene, the only reference that is relevant here is the texture. I obviously don't know your specific needs, feel free to customise the source if you need something more specific, thats what its there for.