- Home /
Large finite background for vertical scroller - best approach?
Hi, I'm working on a 2D vertically scrolling shoot 'em up in the style of old Amiga games like Battle Squadron and Banshee.
The game needs to have a scrolling background, but not the infinite, parallax-scrolling type common in tutorials.
I've already ruled out using a single, large .png, as the vertical dimensions are going to be beyond Unity's size limit, as I understand it.
I've considered multiple approaches:
1: A tile-mapped approach using 32x32 tiles - this would lead to quite a number of tiles pr. level, around 500 (25*20) for one screen height's worth. Is it possible to do this without too much of a performance overhead (i.e. by using object pooling for the tiles, adding tiles as needed rather than loading them all at once)?
2: A tile-mapped approach using 800x540 or 800x1080 "tiles". This would use more memory, but would reduce the number of tiles to something in the range of 25-30 pr. level.
Are either of those approaches workable? Or is there a better, third way to do it?
Answer by tanoshimi · Jul 20, 2017 at 07:13 PM
A "tile" is simply a UV-mapped quad; even the most humble of mobile devices can easily push around 10,000s of these. You don't need to use object pooling because each tile doesn't beed to be a separate object - they're just triangles in a mesh. Use a standard sized POT tilesize like 32x32, 64x64, or 256x256 and you'll gain benefits of efficient compression on your tile atlas.
I suggest you look up "Tiled" and "Tiled2Unity" - a free 2d tile map editor for Unity. http://www.mapeditor.org
Thanks, in that case I believe I'll go with 32x32 tiles, neatly mapped in square images with nice power-of-two dimensions.
I've already been looking into Tiled and Tiled2Unity, but wasn't sure how well that would cope with big levels. If that's not an issue, I'll be using those.