Dear Unity forum,
What is the best approach for building complex 2d backgrounds? I’m working on a game with 2D backgrounds that are fairly elaborate, and wanted to know if anyone has tried and succeeded with fairly heterogeneous 2d backgrounds in Unity.
Here are some basic aspects of my particular project. Let’s call them Requirements, but surely they are up for debate:
- It’s a top-down game, where the player drifts upward continuously, passing a parallax background of 2-5 layers depending on the level.
- Only the bottom-most layer is complex like this. Other layers hold the player, clouds, obstacles, etc.
- I want to support fairly large levels: 2048 wide by 20000+ pixels tall. To think of it another way, each level when this was a vector-based Flash game was comprised of 10 to 20 1920x1080 tiles, which I am now rebuilding as sprites.
- There are not many repeatable “tiles” in the game, but there are repeatable elements.
- A level may have 50-100 different elements, or sprites for the background.
- A single sprite might be used hundreds of times throughout a level or thorughout the game, such as a pine tree.
Here are the issues I’ve faced that led to making this cry for help on the forum:
- Tiles become very big filewise, since I don’t repeat many tiles.
- Tiles show seams between them when the camera moves.
- Sprites don’t look very crisp.
- Using the unity 2d sorting layer solution works, but it’s tedious, especially compared to changing layer depth of 2d elements in something like Photoshop, Illustrator, or Flash.
- I’m not sure if the sprite-by-sprite approach (rebuilding each level from the ground up using game objects for every individual thing) is going to lead to performance problems, when there are, say, 2000 objects total, or 400 instances of the same pine tree in the level.
I thought I’d start with a call for a generally accepted best practice for high-detail, low redundancy backgrounds and go from there.
Any direction or help with this is vastly appreciated!
I’ve included an image of 1/3 of a background level so that you can see the size and nature of what I’m talking about.
Thanks,
Jon