**Describe the project you are working on:**
Godot
**Describe the problem or… limitation you are having in your project:**
Tilemap/Tileset UX is bad
# Draft proposal
This proposals aims at improving the tilset/tilemap UX with a big refactor. This proposal thus lists a lot of changes.
## Global changes
- Merging the tilemap and the tilset inside the same place, at the bottom.
## Tilemap node update
Move those properties to tilesets/tileset layers:
- Mode (tile shape), then add new options ("offset square" and "hexagon")
- Cell size
- Y sort and tile origin
- Collision and occluder related properties (moved to their respective tilset layers, see below)
- Cell clip UV (while it does not seem doing something, it is apparently useful for tilsets with filtered textures)
Remove:
- Compatibility mode
- Centered texture (not sure for what it is useful for)
- Custom transform (Replaced by a skew parameter for all modes)
- Half offset = replaced by new "offset square" and "hexagon" tile modes.
The rotation, translation, etc... of individual tiles is now handled inside the tileset, with the possibility to create "alternative versions" of each tile
I plan to add dragable handles to increase/decrease the size of the working area, similar to what LEd implements. It should make it easier to work with the bucket fill for example.
## Tilemap editor



With this proposal, the two editors get merged at the bottom. Consequently a switch allows switching between the tilemap and the tileset editor.
In the tilemap editor, the common tools to edit tilemaps are present (paint, rectangle, bucket fill, etc...) in a toolbar.
With possibly some tool-specific options in the toolbar too.
Proposals:
- Add the possibility to select multiple tiles at the same time in the bottom panel, to paint a pattern,
- With the "use random tiles" option, instead of painting the pattern, the tool used randomly choose tiles out of the selected ones,
- When selecting a tile, a panel on the right appears where you can select alternative tiles,
- You can either paint "tiles", "terrains" or "scenes". Once configured correctly, terrains are basically acting like autotiles.
The scenes tabs is missing on the picture, but the idea would be to have a list of scenes to paint as if they were tiles.
## The tileset editor
With a button on the top right of the tileset editor, you can open the tileset resouce in the inspector.
This allow modifying properties global to the tileset (tile mode, cell size, etc...).
### The source panel

The source tab in the bottom tilset editor simply allows to use textures in the tilset. For each source, you have two properties:
- Offset: offset at the origin of the texture,
- Separation: space between each tile in the texture.
No need to choose a tile size, this is defined by the tileset's size property.
Possibly, this panel might be also used to:
- remove some unused tiles from each source,
- create some alternative tiles for each tile, by potentially rotating or flipping them.
### The tileset layers
The new tileset editor introduces the concept of Tileset Layers. A tileset layer is simply a way to add a set of properties assigned to each tile.
All tileset layers are optionally added to a tileset, each added layer provides a single feature to the tileset. For example, adding a "Tilset collision layer" to a tileset allows it to handle collisions.
Occlusion or navigation have also their dedicated tileset layers.
Tileset layers are global to the whole tileset resource, whatever the source image you use, the tileset layers are the same.
Tileset layer properties are edited in a dedicated tab in the Tileset tileset editor. There, you can edit a set of properties global to the whole layer, and add or remove layers. This is an example where the Terrain layer would be edited:

Here follows the list of possible tileset layers.
#### Collision layer

*Info:*
Handle collisions for one type of physic objects
Limited to 1 layer for now, but possibly we could add more, for each type of phisycal material to handle (like "water" only slowing down the player while "wall" would block them)
*Layer properties:*
- is area (?)
- collision mask
- collision layer
- friction
- bounce
- use kinematic
etc...
*Tile properties for this layer:*
- A shape
#### Occlusion layer
*Info:*
Handle occlusion for one light layer.
Limited to 1 layer for now, but possibly we could add more if it is uselful ?
*Layer properties:*
- layer
*Tile properties for this layer:*
- A shape
#### Navigation layer
*Info:*
Handles navigation.
Limited to 1 layer for now, but possibly we could add more if it is uselful ?
*Layer properties:*
None
*Tile properties for this layer:*
- A shape
#### Probability layer
*Info:*
Allow assigning probabilities to tiles when they are picked randomly to be placed.
This is used either when using the "select random tiles" options or when tiles are automatically picked by the terrain painting tools.
When several tiles are possible to be placed, the higher the probability value, the higher the chances for this tile to be picked.
Limited to 1 layer.
*Layer properties:*
None
*Tile properties for this layer:*
- A float value
#### Z-Index layer
*Info:*
Allow assigning a z-index to tiles.
Limited to 1 layer.
*Layer properties:*
None
*Tile properties for this layer:*
- An integer value
#### Terrain layers (several types of layers: 2-edges, 2-corners, 3x3, or even special patterns for half-offset and hexagons)

*Info:*
This layer allows to create autotiles. A set of terrain types (water, sand and grass for example) are needed, then applied to part of tiles.
This would work like what Tiled does, and is very similar to bitmaps we have now.
All tiles marked of a given terrain then might be picked by the corresponding painted terrain in the tilemap painting mode.
While the previous system handled autotiles separately, now all tiles can take part in autotiling. Also, the terrain thing allows mixing different autotiles.
Limited to 1 layer per type of autotiling (usually you don't have to mix them but it might happen).
*Layer properties:*
A set of terrain types, needing each:
- A name
- An icon (this likely shoud be picked automatically by selecting the tile with the highest amount of corresponding terrains)
- A color -> this is needed to identify the terrain on the tileset
*Tile properties for this layer:*
- A pattern identifying which part of the tile are of which terrain.
#### Metadata layers

*Info:*
Allow assigning custom metadata to tiles.
Unlimited amount of layers.
*Layer properties:*
- Type of the metadata
*Tile properties for this layer:*
- Value of the metadata
### The scene tabs
In the tileset editor, you can also define a set of scenes to be used as tiles. For consistency, those scenes act as normal tiles, so both a scene and a normal tile can't be present on the same place at the same time. You need two tilemaps for stacking a scene on a normal tile. There, you can also provide an offset to position your scene correctly.

Even if the mockup does not display it, I hope to be able to have a preview for each scene.
### Editing tile's properties
As you can see from the pictures above, each layer has its own dedicated way of editing the tiles properties.
The common approach is to have a value selection on a left panel (with the possibility to save favorite values), then paint this value on the tileset.
Only the terrain editor will likely add the possibility to paint directly with autotiles sub-tiles, it would be annoying to have to choose a shape for the whole tile everytime.
---
Personal notes on eventual use cases to support:
- godotengine/godot#31003
- #310