mapeditor / tiled

Flexible level editor
https://www.mapeditor.org/
Other
11.11k stars 1.75k forks source link

Enable scripting the appearance of objects #2134

Open bjorn opened 5 years ago

bjorn commented 5 years ago

It would be nice if the appearance of objects was not solely determined by a few hardcoded options, but could be replaced or added to by scripts.

A script could for example decide to render some primitive based on a custom property, like displaying a radius or a vector.

In some cases it would even just be useful if the script could determine the color of the object (see this forum thread).

Expansion of #949.

deadowl commented 3 months ago

Use case: ancient game engine supports object which is constrained as x, y, and chardata--the natural mapping is to use a Point object, but the game engine gives this particular class of object fixed dimensions of 32x16px. For editing purposes, it makes sense to use a Point object because it meets all the base requirements. For visualization purposes, it makes sense to render a Rectangle based on the point.

Use case: ancient game engine supports an object which is constrained as x, y, image (optional), and chardata--the natural mapping is to use a Point object because it meets all the base requirements, and this is possibly only because having an image is optional. For editing purposes, it makes sense to use a Point object. For visualization purposes, it may or may not make sense to render something from an Image Collection Tileset. This one's particularly restrictive because you can't mix tiles and objects in the same layer. I'm also not sure whether Image Collection Tilesets are restricted to the grid, and if they are that'd also be a problem in this use case.

Potential solution: A query of objects matching property descriptions, class in particular, in combination with rendering capabilities, could be used by extensions to provide improved visual feedback while editing a map. This could also provide visualizations for things like indicating whether an object is within the constraints of exporting to a specific target game level format.