Search Unity

Tilemap with rotation and tiles larger than 1x1

Discussion in '2D' started by stulleman, Apr 2, 2015.

  1. stulleman

    stulleman

    Joined:
    Jun 5, 2013
    Posts:
    44
    Hello!

    I'm quite experienced with normal tilemaps and terrain generation.

    Currently I'm building my games roughly like this:
    One array for all tiles in the map.
    One array for all lightning values (for each tile).
    And so on...

    But now I wanted to go a step forward and allow the player to not only modify the terrain but also to add some things on top of the terrain.

    For this I have an array big enough for three layers of tiles on top of each other (terrain, vegetation, overground).
    This works for objects that fit in one tile.
    But what is with for example solar panels or beds? I could use 2 ids for the bed. One for the upper part and one for the lower part of the bed. But that would be wasteful, wouldn't it? (id array is of type byte = so only 256 ids possible)
    Furthermore I would like to be able to rotate blocks. How are your experiences with this? Would you use another array with rotations for each tile?

    I also thought in using prefabs for those things. Is it weird that I don't want to use them to have everything in one mesh? Another problem I see with prefabs would be the lightning, as I use uv colors for this.

    I would appreciate any suggestions!