Groups of Tiles

Hello everyone.

I am having trouble with templates (I believe that is what I’m looking for).

The image file for my tileset is compact, and some tiles aren’t together, so putting down an object like a tree, or a stone, becomes cumbersome with the tiles not always being together. I would like to predefine items like stones or trees and be able to place them intact.

I’m assuming what I want is a template (I have no need for properties yet). I looked at the documentation and saw the note for it requiring an external tileset (which I tried) and I’m still not able to right click and save as template. Do I need to be in the map or the tileset file to save the template? Is there a certain tool I need to have selected?

Thank you for your help.

The template feature currently only supports objects, placed on object layers. An object can only refer to a single tile so this won’t help you place your trees.

For your purposes, Tiled supports saving of tile stamps. Open the Tile Stamps view, select your tree in the tileset (or capture an area from the map, where this even works with multiple layers) and then save the tile stamp in the Tile Stamps view. That allows you to quickly select it later, even on maps that don’t yet use the tileset (it will get added automatically).

image

I realize this may not be as convenient as selecting them directly from the tilesets view. When I added this feature I also wanted to support variations, so you can add variations to a stamp and assign the probabilities based on which they are randomly chosen.

1 Like

Whaaaaat I didn’t even know this was a thing! It sounds perfect for some of what I need. Took me a while to find it in the UI (for anyone lost: right-click on any of the view headers, e.g. the header of the layers view, and check “Tile Stamps”), but now that I know it’s a thing and supports variants, I’m really looking forward to trying it out!

Is there any way to automate the creation of stamps, e.g. some way to have a script sample every N x M section of a source map (or better yet, many source maps) and create stamps out of those? I have an approximate gazillion of procgen trees I’d love to use as stamps instead of copy+pasting them from a map. Or is there a keyboard shortcut for “add new stamp” I could use to speed up the process of making stamps?

1 Like

By default there is no keyboard shortcut for “Add New Stamp”, but you can set one in Edit > Preferences > Keyboard. I’ve personally set it to Alt+S, and Alt+Shift+S to add variations.

It should indeed be possible to script this, but probably finding the regions is not trivial. The script would need to determine each region, copy each region to a new tile layer and set that as tiled.mapEditor.currentBrush before calling tiled.trigger("NewStamp").

1 Like

I’ll have to wait until my 1.2.5 detects that 1.3 is out before I can assign the shortcut, sadly :'D It always takes quite a while.

I added some variations manually and immediately ran into a problem: the stamps are “anchored” to the cursor in the middle of the stamp, and if the variants have differing sizes, this makes it very difficult to place them correctly (since it’ll select a different variant when you move the cursor to another tile). Is there any way to either
A. Randomly select a variant and allow free positioning of it, or
B. Change the anchor? In my case, I’d need center bottom.

For B, a graphical anchor selector like this somewhere (I guess next to the tool options like random and rotations, since it’s useful for regular multi-tile stamping too?) would be perfect:
image (this one’s from Photoshop’s transform tool)

From Tiled 1.3 on there’s a native notification that’s easier for me to maintain, but it will no longer automatically download & install a new version.

Hmm, that’s a rather tricky problem indeed. The customizeable anchor is an interesting suggestion that could definitely be implemented. Indeed I imagine such a setting could also be interesting even if no random variations are involved.

In the meantime I guess I would suggest to only add variations that are the same size.

1 Like

This works great. I’ll have to play around with the variations too. Thanks!