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

Need properties for placed tiles #1138

Closed
mccotehub opened this issue Nov 17, 2015 · 10 comments
Closed

Need properties for placed tiles #1138

mccotehub opened this issue Nov 17, 2015 · 10 comments

Comments

@mccotehub
Copy link

I know you can add custom properties to each tile in the tileset, but I need to add properties to the actual placed tiles on the map.

I found this old issue thread where it basically looked like biouxtai wrote code to solve the problem, but then it seems like it was never pulled into the project:

#31

I would very much like this feature. Can you please comment on why it was ignored back in 2011 after biouxtai seemingly put a bunch of work into the feature? OR please comment on how stupid I am, if the feature is already in the program and I'm just not seeing it.

@olsonjeffery
Copy link

👍

@bjorn
Copy link
Member

bjorn commented Nov 21, 2015

It is not merged to master because no pull request was ever opened for it, and I've personally never been convinced enough about the feature to merge it in myself. The reason is that the feature seems redundant to me because there already exists an object layer with which you can annotate your map in any way you want.

I'm interested to hear whether you (@mccotehub and @olsonjeffery) tried to use objects and why this didn't work for you.

I'll close this since it's a duplicate of #31.

@bjorn bjorn closed this as completed Nov 21, 2015
@mccotehub
Copy link
Author

Thanks for the response. I'm happy to describe my scenario.

I am currently using object layers to accomplish what I need, its just that it feels clunky and I'm pretty sure it is taking several more steps than it would if I could just assign properties directly to individual tiles.

I'm using TILED to place floor tiles, walls, enemies, doors, warps, items, etc in my game. Almost all of these things can and do have customized individual stats. For example tiles have friction, walls have amount of damage they can take before they break, enemies have hitpoints and speed and damage, etc. I want full control of the level design process - I want to be able to assign different hitpoints and speeds to any particular enemy for example. And different friction to any particular tile, and different triggers to any particular door.

Keep in mind that an individual cell can contain multiple things. For example one cell can contain a floor tile, an item or two, an enemy or two, and maybe a trigger that sets off an explosion elsewhere. For all of these custom attributes, I'm currently using object layers and objects rectangles. I've gone back and forth between using a single object layer for everything, versus a separate object layer for enemies, items, walls, triggers, etc. Neither method feels right. There are object rectangles everywhere, its a mess.

http://imgur.com/Cr07hlM

Also I have to carefully draw the object rectangle within the bounds of an individual tile. Granted, it doesn't matter to me what dimensions the rectangle is, as long as it is entirely with in a single tile/cell so that I can apply the property only to that cell. Its very tedious to draw these rectangles within the grid, rather than just click an individual tile/cell and assign a property.

The very fact that you can assign a property to a tile in the tileset proves that the feature I'm requesting is useful. It is merely an extension of what is already there. Individual placed tiles should be able to have different property values than the parent tile in the tileset.

Instead of having the enemy tile and 4 rectangles (or 1 rectangle with 4 properties), I'd like to have just the one enemy tile, with 4 assigned properties (hitpoints, speed, damage, gold dropped).

I know I can technically accomplish this with object layers but being able to assign properties directly to tiles seems like an obvious missing feature.

Thanks for listening. I love the program otherwise!

@bjorn
Copy link
Member

bjorn commented Nov 21, 2015

Alright, thanks for the detailed explanation. First of all I want to make you aware of two features:

  • You can snap objects to the grid to make tile-aligned placement easier. You can turn that on in the View menu.
  • You can use tile objects for things like enemies. Tile objects render like the tile, but they can be moved around and can have individual properties.

Second, I would like to know your opinion about the following feature request:

http://forum.mapeditor.org/t/could-you-add-the-ability-to-have-arbitrary-table-layers-id-like-to-be-able-to-enter-arbitrary-text-or-numbers-etc-into-any-map-tile-and-export-it-as-a-csv/765

In short, this request is about adding a layer type that can be configured to hold some arbitrary value for each cell. Do you think that would help your use-case as well?

@mccotehub
Copy link
Author

Yup, I actually had snap to grid turned off, on purpose. The reason is because with it on, clicking the map draws a small square at the grid intersection, which is definitely not what I want. So I have to click and drag in order to draw a tile-sized square over exactly one tile. Not only that, but I can only drag right and down, so I have to be sure to click the top left corner of the tile I want. So thats several "actions" in order to draw an object over a tile. With the alternative (snap to grid OFF) - I only have to click the center of a tile in order to draw a small square completely within the bounds of the tile. Its less work. I know it sounds like I'm being very nit-picky, but I'm looking at making several very large maps, so 2 clicks vs 1 click is a huge deal for example.

Tile Objects! Cool. Sorry that I didn't do my research before posting. Tile Objects are not bad, probably an improvement over what I'm doing now. Obviously snap to grid ON is the better mode when dealing with tile objects (as opposed to rectangles). I'm still playing around with them, but I'm wondering why I would ever need to use regular tiles anymore? Tile objects seem to be what I wanted - tiles with properties. Unfortunately they work slightly differently than regular tiles. You cant click and drag to paint a while bunch of them at once for example. Being able to select and move them is nice. It would be cool if using the arrow keys while a tile object is selected, would move it an entire cell rather than just one pixel. Snap to grid is on, afterall.

Another weird thing I noticed about tile objects is that the coordinates work differently. If I draw a tile object in the top left corner of the map, the coordinates are 0, 50. However If I draw a regular object in the exact same spot, the coordinates are 0,0. Looks like one draws top down, one draws bottom up. Bit of a gotcha I guess.

I might be able to use tile objects for my enemies as you mentioned. However as I mentioned, I also want to have properties for other things, like walls and floors and doors. So essentially I want to use tile objects for everything in my map now, because it gives me the ability to add properties. But this is impractical because as I mentioned above, tile objects are a bit more of a pain to work with than regular tiles.

I will continue to experiment but I'm thinking that tile object aren't quite as good as the feature I was originally requesting. Sorry to sound like a broken record, but I still thinking the ability to add properties to individual tiles would help :)

The data layer idea would not help me I don't believe. I'd rather assign properties to an actual entity (tile, baddie, wall) than just a location on the grid like 1050,1400. I'd like to be able to move the baddie and have his properties come with him for example. However Depending on the game type, a data layer could be useful, I'm not against the idea.

@bjorn
Copy link
Member

bjorn commented Nov 22, 2015

So I have to click and drag in order to draw a tile-sized square over exactly one tile. Not only that, but I can only drag right and down, so I have to be sure to click the top left corner of the tile I want.

Right, that because rectangles can also have zero-size (in which case they'll render a little confusing). About the drag right and down, I should really fix is so that you can drag in any direction.

It would be cool if using the arrow keys while a tile object is selected, would move it an entire cell rather than just one pixel. Snap to grid is on, afterall.

Hmm, nice suggestion. Actually, at the moment you can hold Shift to move objects by whole cell distances (though this only makes sense for orthogonal maps).

If I draw a tile object in the top left corner of the map, the coordinates are 0, 50. However If I draw a regular object in the exact same spot, the coordinates are 0,0. Looks like one draws top down, one draws bottom up. Bit of a gotcha I guess.

This is because the tiles are currently bottom-left aligned, for both regular tiles as well as tile objects. See the discussion at #91.

Thanks for your feedback!

@olsonjeffery
Copy link

Second, I would like to know your opinion about the following feature request:
http://forum.mapeditor.org/t/could-you-add-the-ability-to-have-arbitrary-table-layers-id-like-to-be-able-to-enter-arbitrary-text-or-numbers-etc-into-any-map-tile-and-export-it-as-a-csv/765

@bjorn: yes, per-tile scalar data as a new layer type would be great. How would you represent it in a JSON export? Would it be another array ala the data property?

fwiw, I would immediately use a feature like that for representing per-tile lighting in a map. Perhaps also event triggers, as the OP in the linked forum post mentions.

@bjorn
Copy link
Member

bjorn commented Nov 23, 2015

@olsonjeffery I wonder a little about how such an arbitrary data layer is supposed to be visualized. If it's about specifying terrain height, then a tileset with tiles of varying height could be a lot better suited than just having numbers. And with your lighting layer, wouldn't it also be visually less confusing to just have a tileset with tiles of varying light intensity?

In the JSON export it could indeed just be another array, though it could also be interesting to support sparse arrays along with a more optimal storage format for that use-case.

@Ktar5
Copy link

Ktar5 commented Sep 2, 2018

Can we get an update because I'd love this feature simply because the new object layer seems clunky as opposed to setting per-tile properties.

@bjorn
Copy link
Member

bjorn commented Sep 4, 2018

@Ktar5 Please continue the discussion at #31 since this issue was closed as a duplicate. Also see #1139 for a proposed patch and a discussion about problems with the patch as-is.

But as for getting an update, I don't think I have anything to add that wasn't already written before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants