Search Unity

Question Best ways to create tilemaps for top down RPG interiors (Maybe rule tiles?)

Discussion in '2D' started by PaperMouseGames, Jun 1, 2020.

  1. PaperMouseGames

    PaperMouseGames

    Joined:
    Jul 31, 2018
    Posts:
    434
    Hi there! I'm working on a top down RPG with a visual style similar to Stardew Valley, Chrono Trigger, or the SNES Final Fantasy games as an example.

    I'm having issues with creating the tilemaps for the interiors in my game though (e.g. houses, caves, etc.). The main Issue I'm running into is that I want the walls of the interior to sort of "come up off the floor", but I'm not sure how I want to set all of this up.

    I'm having issues with the floor meeting my walls in the right way. See the two examples below:

    1. In this example the bottom wall is set to pivot point "Top Middle" but you can see there's a gap between the floor tile and the wall tile.

    1.png

    2. In the next example I set the bottom tile to a "Center" pivot but now the red floor tile cuts off the bottom wall tile.

    2.png

    So I'm just not sure what I should be doing I guess, I know my tileset here is incomplete (I need the corner tiles in a few places) but I'm mostly just trying to decide how to get this working.

    See for my outdoor areas I was using rule tiles from the 2D extras pack but inside I'm having trouble setting up the rules for the floor and the walls to work together. I guess I'm not sure if I should be trying to set up a rule tile for the interior floor AND walls together or if I should be trying to keep the wall tiles on their own rule tile and the floor on a separate one, maybe even a separate tilemap.

    Any ideas from someone who has maybe done something like this before?
     
  2. brigas

    brigas

    Joined:
    Oct 4, 2014
    Posts:
    522
    maybe put the walls in a diffrent layer/tilemap, so you can draw the walls over the floor
     
    PaperMouseGames likes this.
  3. PaperMouseGames

    PaperMouseGames

    Joined:
    Jul 31, 2018
    Posts:
    434
    Hey thanks for the reply, yeah this is what I'm trying right now and it seems to be working better. I made a tilemap for the floor (that is completely filled in) and a tilemap for the wall (also completely filled in).

    So after that I started erasing parts of the wall tilemap and it's creating "rooms". This is pretty much the desired effect so that's great! Having trouble with the wall colliders and order in layers with the player though...

    Basically I can get the player to appear in front of the back walls (top of the screen), and I can get the player to appear behind the front walls (bottom of the screen), but along the side walls the player sprite still renders in front of the wall sprite so I'm not sure how to fix that.

    If I can't figure it out I might make a different post on the topic but anyway, it does seem like having the walls be a separate tilemap is working a lot better!
     
  4. brigas

    brigas

    Joined:
    Oct 4, 2014
    Posts:
    522
    you will have to look into sorting by custom axis, usualy for these cases you can sort by the Y position, there are some threads that talk about this maybe they can be useful in your case

    https://forum.unity.com/threads/tile-map-how-to-change-one-tiles-sorting-order-or-z-axis.532286/

    https://forum.unity.com/threads/is-...g-tilemap-with-top-down-sorting-order.600082/
     
    PaperMouseGames likes this.
  5. PaperMouseGames

    PaperMouseGames

    Joined:
    Jul 31, 2018
    Posts:
    434
    Thanks a lot! I had found the first thread when I was troubleshooting and switched to individual render mode , but the second thread is very interesting, I'll have to go through it.

    Thanks again!
     
    brigas likes this.