Search Unity

2D Tilemap questions

Discussion in '2D' started by squigglyo, Dec 6, 2019.

  1. squigglyo

    squigglyo

    Joined:
    May 21, 2012
    Posts:
    107
    Hey guys

    Im using Tilemap to create my game and before i delve too deep into things I wanna make sure I start right.

    I am aiming for a Zelda-ish style game. So many different 'rooms' with differing sizes with a camera that follows the player.

    Is it better to create 1 large map or break them down into their respective rooms.
    So have 1 map that the player is free to explore. Or say 50 'room sized' maps, that turn on/off when relevant..

    I experimented with the multiple room option, and found it got annoying the more rooms (so many layers to the tilemap). I mostly did this to make it easier to move rooms around and to optimize, but perhaps both of those issues are solved in easier ways.


    Secondly, for different areas, such as houses and dungeons. Would I be better to create say a 'Houses' scene, and draw all the houses in it and control where the player spawns. Or, 1 scene per house.
    1 Scene per house/dungeon/temple/shop is definitely easier, but this would see the number of scenes in the 100s. Is that a problem?
     
  2. Olmi

    Olmi

    Joined:
    Nov 29, 2012
    Posts:
    1,553
    Hi,

    Having things in different scenes is better for your memory usage, then you can load/unload scenes as you want. If you got one large tilemap, you don't have that option. Separate tilemap layers don't help you much, they are still in the same scene.

    And generally speaking, It's much better to have many small parts of big whatever-it-is than have one big debugging nightmare. Not to mention that it's much harder to share your work with others - lets say you want to have part of a map edited by some one else? What happens to that one map file then? You are pretty much forced to freeze your work on it and wait until it's done. It's hard to merge scene content etc. and you probably need to make some sort of tools for that kind of situations... And I could list many other reasons too that make it a bad choice.

    And what comes to big numbers of anything, you need to organize things as well as you can - structure things according to some rules you define, use naming conventions and so on.
     
  3. blu3drag0n

    blu3drag0n

    Joined:
    Nov 9, 2018
    Posts:
    94
    I general I would say that sounds right, but in some scenarios it's not.
    If you have a living population of NPC that walk around and do things then I recommend (as I do know for an RPG) to have a bigger scene with map-chunks spreaded in the worldspace.
    If it's getting into the thousands of objects doing stuff then you will for sure lack CPU and memory one day and might think of some sort of "fast forward" when you load such a scene to caculate what happend while your were "abscent".

    Furthermore if you have multiple objects e.g. EventSystem container, GUI container and whatever in your scene that you need over each and every scene, then lately having 100 scene does not scale very well.
    Then you need to consider how to reprocude everything and if you wanna keep states of the containers, how will you unload & load them. Which will then consumes time again when switching scenes.

    You see, it absolutly depends on the requirements and scale of a project.