Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Question How Complex Can We Make Rule Tiles?

Discussion in '2D' started by vandel212, Mar 29, 2022.

  1. vandel212

    vandel212

    Joined:
    May 10, 2020
    Posts:
    24
    I'm working on a game that I'd like to use rule tiles as part of my dungeon generation. I've been playing around them for about a day or so, and I can get close to my goal, but never all the way there. So I'm wondering if I can do what I'm trying to do without custom scripting. I'm not opposed to writing some code to accomplish my goals, I just don't want to do it if it's already built into the tool. I'd like to make a rule tile that can paint a dungeon's floor and walls. If you are wondering why I don't use multiple rule tiles, it's because I'm trying to make the dungeons procedurally generated, and being able to use a single rule tile would make the process a lot easier.

    For example, do something like this with a single rule tile:

     
  2. rarac

    rarac

    Joined:
    Feb 14, 2021
    Posts:
    570
    yes but it will be harder than just making the dungeon generator just use the 2nd tile for walls
     
  3. ZBerm

    ZBerm

    Joined:
    Jan 12, 2017
    Posts:
    61
    I think this should be relatively easy to do with a Rule Tile, by using the Extended Neighbor option.

    upload_2022-3-30_22-22-18.png

    You could set up rules along the lines of...
    no tile above = a
    only 1 tile above = b
    only 2 tiles above = c
    ...
    any more than 4 tiles above = e

    upload_2022-3-30_22-26-39.png

    I haven't actually done this, and it sounds time consuming, and I don't think you could have the gap in the middle (make that a different grid layered ontop?). But it should work.
     
  4. vandel212

    vandel212

    Joined:
    May 10, 2020
    Posts:
    24
    Cool, thank you! I'll play around with it, and see what I come up with.