Best approach to create friction tiles

Hello,
I want to create a layer holding tiles with a custom friction property. So if I am on ice, the custom friction property would be 0.1, if I am on mud the same tile would a friction property of 5.
Reading similar topics, I learned that I can’t use a tileset layer because it doesn’t allow to set a different value for the friction. So the alternative is to use an object layer and add that tile as an image with a friction property, since that way I can change it individually for each. I can even use the type property to inherit the friction property.
Is there any other alternative that works better?

Or I thought that maybe I should use a friction tiles set, where each tile has a different friction value and forget about custom properties because I remember reading that it’s more optimized than image objects with editable attributes.

What do you think?

Thanks

If all mud tiles have friction 5 and all ice tiles have friction 0.1, why not assign those values to your ice, mud, etc tiles?

If it needs to vary independently of the tiles, then my usual approach is to use a tile layer with special tiles. It doesn’t have to be a separate tileset, it can just be your usual tiles, interpreted differently because they’re in a “special” layer. A special tileset might be clearer visually though.

Whether you derive friction from the main tiles or from another layer, tile layers are definitely the way to go for this scenario. Objects are overkill for this task, and more tedious to edit.

Thanks, that’s what I wanted to know from a performance point of view.
The reason I wanted to customize each instead of assigning the same to all, was because I thought that not all mud tiles might have the same value. Maybe I could have 10 mud tiles in a row with a friction of 5, 7, 5, 4, 8, 6… Using a tileset I have to do 10 friction tiles where all have the same friction property, with a different value each.
Maybe I am overthinking it.
I could do the special layer as you said. So maybe depending on the layer, the code would tweak the property.

Having 10 different mud tiles with different frictions would be pretty confusing/annoying for a player, so I would think having a small number of different friction values, tie-able to the art (but possibly specified using a special tileset just for visual clarity while editing), would be best.

Yeah, I agree. It might be confusing. And I really can’t think about that many surfaces. Standard floor, Ice, mud…maybe snow.
I assume that the same thing applies to sounds? By creating a special tileset holding the path to the sound (or sounds in case I want to randomize which one is picked) that will trigger when contacting the tile

Sounds are something that make sense being assigned to each tile (many tiles will just have the same sound) rather than being specified independently. Similarly, if there are only a few friction values and they’re consistent for each floor type, you’d usually assign those to the visible tiles rather than having a special tileset, so that there’s no risk of having the wrong value for a tile and so there’s no extra work to assign these values.

1 Like