Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tile sheet with different sized tiles #1008

Open
Spanfile opened this issue Jun 29, 2015 · 11 comments
Open

Tile sheet with different sized tiles #1008

Spanfile opened this issue Jun 29, 2015 · 11 comments
Labels
feature It's a feature, not a bug.
Milestone

Comments

@Spanfile
Copy link

I have a tile sheet of isometric tiles, where the tiles aren't all exactly the same size and aren't placed like tiles would be, neatly in rows and columns. For example, the "first" tile in the sheet is at coordinates 265, 1057 and is 132 pixels wide and 83 pixels tall. The next tile is at 265, 1452 and is 132 pixels wide and 99 pixels tall. Next to the sheet, I have an XML file which defines all the tile positions and sizes by their names so extracting them from the sheet is just like loading them as individual images.

Currently, Tiled wants all the tiles in the sheet to be the exact same size and be placed neatly in rows and columns in the sheet, which means I can't use my tile sheet in Tiled.

Would it be possible to add a way to read tile positions and sizes from some kind of file, such as an XML file like I currently have? It can be a proprietary Tiled file, following a Tiled format, it shouldn't be too hard converting between my XML and it. I would think it would work just like using a collection of images, but have the images come from a sheet, rather than individual files.

@bjorn bjorn added the feature It's a feature, not a bug. label Sep 26, 2015
@bjorn bjorn changed the title Isometric tile sheet with different sized tiles Tile sheet with different sized tiles Sep 26, 2015
@brenolf
Copy link

brenolf commented Nov 9, 2015

👍 for this feature

@Glissando
Copy link

Support for texture atlases is something I've wanted for a while. I've been using multiple tilesets based on size as a workaround.

@bjorn
Copy link
Member

bjorn commented Nov 12, 2015

Alright, I've added it to the Tiled roadmap where you can also vote on it: https://trello.com/b/yl3PAtN0/tiled-roadmap

One worry I have with this feature is that people will pack their images using for example TexturePacker and then use the result in Tiled. When done this way, Tiled has currently no way of numbering the tiles in a way that would remain stable in the event that the texture atlas is re-packed after images have been added/removed. For this use case, the user is expected to use the individual images in Tiled and only use the packed texture in the game, as an optimization.

The reason I still want to support this feature is mainly because it is often convenient for an artist to put related tiles on the same image, even if they have different sizes. In this case, there should be a way to tell Tiled where to find those tiles and to update that information when the image changes, without invalidating tile references.

@bjorn
Copy link
Member

bjorn commented Jun 5, 2017

Also asked for on the forum.

@zyend36
Copy link

zyend36 commented Jan 9, 2019

@zyend36
Copy link

zyend36 commented Jan 9, 2019

Bjorn,

When a texture atlas is re-packed again, it may impact existing tileset and invalidate the reference.
But I believe it's the responsability of the user to relocate the tileset location in the atlas by providing the following parameters:

  • x and y offset (or margin)
  • width and height of the tile set
  • spacing if any.

If the user is using a tool such as TexturePacker, then he has the possibility to export a Json file that describe the location of each tileset in the atlas.
Therefore, if the texture is repacked he can re-enter manually the parameters above to keep the tile references valid.

Z.

@ghost
Copy link

ghost commented May 11, 2021

A simple way to add this feature could be to add some attributes to select a "sub" image.

This new attributes could be inspired by canvas drawImage arguments: at least sx and sy, maybe sWidth and sHeight.

<?xml version="1.0" encoding="UTF-8"?>
<tileset version="1.4" tiledversion="1.4.2" name="background">
 <grid orientation="orthogonal" width="1" height="1"/>
 <tile id="0">
  <image sx="1" sy="1" width="32" height="32" source="image.png"/>
 </tile>
<tile id="1">
  <image sx="33" sy="1" width="48" height="64" source="image.png"/>
 </tile>
<tile id="2">
  <image sx="1" sy="33" width="16" height="16" source="image.png"/>
 </tile>
</tileset>

@bjorn
Copy link
Member

bjorn commented May 11, 2021

@devnewton Hmm, a similar feature is planned for regular tilesets (#2863), but I agree it could be a good idea to also support this for a collection of images tileset like in your example. Though probably a unified element should be used for specifying the sub-rectangle.

@Arcanorum
Copy link

Why even use numbers for the indexes for these kinds of tilesets?
Just use the frame name, so if it moves around on the texture atlas as long as the frame name is the same everything that was using it should still work.

@eishiya
Copy link
Contributor

eishiya commented Nov 21, 2022

Why even use numbers for the indexes for these kinds of tilesets? Just use the frame name, so if it moves around on the texture atlas as long as the frame name is the same everything that was using it should still work.

Numbers are shorter, easier to deal with, and don't require user input, and Tiled can ensure uniqueness much more easily. If #2863 is implemented, they'll do just as good a job of dealing with arbitrary tile rectangles too.

@bjorn
Copy link
Member

bjorn commented Nov 26, 2022

Why even use numbers for the indexes for these kinds of tilesets?

I think the simple answer is that the tile addressing scheme needs to stay uniform. There is no way a tile layer could refer to some tiles by number and others by name, depending on the kind of tileset it is referencing. It would add least add a form of complexity better avoided.

@bjorn bjorn added this to the Tiled 1.11 milestone Mar 14, 2023
@bjorn bjorn modified the milestones: Tiled 1.11, Tiled 1.12 Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature It's a feature, not a bug.
Projects
Status: Todo
Development

No branches or pull requests

7 participants