Brush creation

slik
Member
Registered: 2015-08-04
Posts: 11

Topic

Hi, a few things would be nice to have.

Tileset brushes:
- a new Select button that selects all except empty (transparent) tiles on Brush creator tab.
- ability to set a prefix text for Auto name feature; so after I click on Auto name button I would get "SomePrefix 1", "SomePrefix 2" etc brush names.
- a bit changed Auto name behavior: do not replace already entered brush names with autonames.

Autotile/oriented brushes:
- ability to set Coalesce Mode when creating/modifying Autotile brushes.
- If Coalesce Mode set to Any, if it possible to have separate tiles for joins? Ideally: different tiles for joins with different groups.

If something/all of this can be done by extending brush/editor classes I'd like to read how.

Thank you for such a good tool!

P.S. would be nice to read tutorials about typical workflows for rotorz tile system, for example "simple terraria clone" or "simple top down shooter".

Lea Hayes
Rotorz Limited
From: United Kingdom
Registered: 2014-03-04
Posts: 638

Response 1

Thanks for all of the wonderful suggestions!

Everything has been noted and will be considered for implementation :)

slik wrote:

- a bit changed Auto name behavior: do not replace already entered brush names with autonames.

This is because you can create multiple tileset brushes with the same visual representation; although there are planned changes in this area.

slik wrote:

- ability to set Coalesce Mode when creating/modifying Autotile brushes.

You should already be able to customize this property from the Extended Properties foldout which can be toggled on the right-side of the designer window.

slik wrote:

- If Coalesce Mode set to Any, if it possible to have separate tiles for joins? Ideally: different tiles for joins with different groups.

I am unsure as to what you mean here; would you be able to elaborate for me?

slik wrote:

If something/all of this can be done by extending brush/editor classes I'd like to read how.

Most of the editor interfaces can be overridden and customized via the editor API. In the case of automating the creation of tileset brushes with custom conventions you could just create a custom editor window to implement this:

  • Allow selection of a tileset using something like this:

    private Tileset _tileset;
    
    private void OnGUI() {
        DrawTilesetPopupField();
    }
    
    private void DrawTilesetPopupField() {
        string selectedTilesetLabel = _tileset != null ? _tileset.name : "(None)";
        if (GUILayout.Button(selectedTilesetLabel, EditorStyles.popup))
            ShowTilesetPopup(GUILayoutUtility.GetLastRect());
    }
    
    private void ShowTilesetPopup(Rect buttonPosition) {
        var menu = new GenericMenu();
        foreach (var record in BrushDatabase.Instance.TilesetRecords) {
            var tileset = record.Tileset;
            menu.AddItem(new GUIContent(tileset.name), false, () => {
                _tileset = tileset;
            });
        }
        menu.DropDown(buttonPosition);
    }
  • And then create your tileset brushes using BrushUtility.CreateTilesetBrush

I hope that this helps! please let me know if you have further questions and I will do my best to assist :)

slik
Member
Registered: 2015-08-04
Posts: 11

Response 2

Lea Hayes wrote:

You should already be able to customize this property from the Extended Properties foldout which can be toggled on the right-side of the designer window.

Thank you and sorry, didn't notice this option.

Lea Hayes wrote:

I am unsure as to what you mean here; would you be able to elaborate for me?

Sorry for my poor english, I will try to explain using a bit modified Prison Architect tiles.
original.png
1) typical Coalesce Mode = Own
2) typical Coalesce Mode = Any
3) what I will get using Coalesce Mode = Any and placing a door
4) what I would like to get (you may say I can add black borders to the door sprite, but that's not fully correct, see 6)
5) when I hide the door (but don't destroy the tile) I'd like to see this (notice the black borders on the walls)
6) that's similar to what I'm getting now

I request the ability to use different sprites when edging with different types of tiles, in other words, I'd like to have 1, 4 and 5 working with the same oriented/autotile brush. Something like that.
I hope this helps to understand what I mean.

Thanks for your answers, very helpful!

Last edited by slik (2015-08-04 19:50:27)

Lea Hayes
Rotorz Limited
From: United Kingdom
Registered: 2014-03-04
Posts: 638

Response 3

If your door has an open and a shut state then why not just have two versions of the sprite that both have the black borders. So; when the door is shut the player sees a green door with black borders; and then the door is open the player sees the black borders still.

Another option would be to manually place the "Wall End" pieces with brushes that coalesce with the concrete/brick walls (or if you are using an oriented brush; just to add another variation for the end pieces that has the black edge):

  • Concrete Wall (Autotile/Oriented Brush) Brush Group=1, Coalesce Mode=Own and Group 1

  • Concrete Wall End (Tileset/Oriented Brush) Brush Group=1

  • Brick Wall (Autotile/Oriented Brush) Brush Group=2, Coalesce Mode=Own and Group 2

  • Brick Wall End (Tileset/Oriented Brush) Brush Group=2

  • Green Door

I hope that this helps!

Just let me know if you have further questions regarding this and I will try my best to assist :)

slik
Member
Registered: 2015-08-04
Posts: 11

Response 4

Well, yes, this would work :) Thanks.

slik
Member
Registered: 2015-08-04
Posts: 11

Response 5

Oh, a few more things, regarding drawing.

- would be nice to have ability to change Erase (right mouse button) to another tile

for example I have a yard of grass tiles, and want to draw a trod (i hope i use correct word), and while drawing I'd like to "erase" trod tiles replacing them by a grass tiles

- also would be nice to have ability to link brush to a tilesystem

for example I have tilesystem "background" with all these grass etc, and another tileset "main" for walls, and when I select grass brush it would automatically select background tilesystem for drawing, and when I select some wall brush it would automatically select main tilesystem for drawing

Lea Hayes
Rotorz Limited
From: United Kingdom
Registered: 2014-03-04
Posts: 638

Response 6

slik wrote:

- would be nice to have ability to change Erase (right mouse button) to another tile

You already can :) there are 2 ways to do this.

Method 1
Hold the "Ctrl" key whilst using the mouse to right click on the brush that you would like to assign to the right mouse button.

Method 2
Select the desired brush using the left mouse button as usual and then use the "Swap" button (or keyboard shortcut 'X') to quickly swap the brushes that are assigned to the left and right mouse buttons.

slik wrote:

- also would be nice to have ability to link brush to a tilesystem

This is quite a project specific request; but you can do this easily with a custom editor script:

// Assets/Editor/AutoTileSystemSelector.cs
using System.Linq;
using Rotorz.Tile;
using Rotorz.Tile.Editor;
using UnityEditor;
using UnityEngine;

[InitializeOnLoad]
internal static class AutoTileSystemSelector {

    static AutoTileSystemSelector() {
        ToolUtility.SharedBrushListModel.SelectedBrushChanged += OnSelectedBrushChanged;
    }

    private static void OnSelectedBrushChanged(Brush previous, Brush current) {
        string queryName = MapBrushToTileSystemName(brush);
        var system = FindTileSystemByName(queryName);
        if (system != null) {
            // Only change the active tile system if the desired one was found.
            ToolUtility.ActiveTileSystem = system;
        }
    }

    private static TileSystem FindTileSystemByName(string queryName) {
        return ToolUtility.GetAllTileSystemsInScene().First(x => x.name == queryName);
    }

    private static string MapBrushToTileSystemName(Brush brush) {
        // Apply any mapping policy here; ideas:
        //  - Use naming convention in brushes.
        //  - Use one or more brush flags (as demonstrated here for simplicity).
        //  - Define a custom ScriptableObject asset which maps brush assets to tile system names.
        if (brush.GetUserFlag(1))
            return "Foreground System";
        else if (brush.GetUserFlag(2))
            return "Background System";
        else
            return null;
    }

}

Click here to find more information regarding the Rotorz Tile System editor API functions that were used above

slik
Member
Registered: 2015-08-04
Posts: 11

Response 7

Thank you again :)