mapeditor / tiled

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

Add support for other types of plugins #454

Closed leiradel closed 1 year ago

leiradel commented 11 years ago

Right now Tiled only supports plugins for reading/writing map files. It would be great if there was an option to add more functionality to Tiled via other types of plugins.

Some examples:

toddcarnes commented 11 years ago

On 6/9/2013 6:01 PM, Andre Leiradella wrote:

Right now Tiled only supports plugins for reading/writing map files. It would be great if there was an option to add more functionality to Tiled via other types of plugins.

Some examples:

  • A maze plugin which generates a random maze as a new layer in the current map, maybe using a terrain or user-chosen tiles.
  • A forest plugin which generates a new layer with a forest, where the user specifies the tree density and maybe a constraint that the forest should be walkable from a point to another. The tiles that form the tree(s) should be selected by the user.
  • A house plugin that would generate random houses from a tileset (this plugin would be tied to a specific tileset.)

— Reply to this email directly or view it on GitHub https://github.com/bjorn/tiled/issues/454.

When you think about it, deep down all three of your examples are really different forms of the same thing - a maze algorithm.

Todd

leiradel commented 11 years ago

On 09/06/2013 21:57, Todd Carnes wrote:

When you think about it, deep down all three of your examples are really different forms of the same thing - a maze algorithm.

The reason I've added them as separate is that the underlying algorithm could be quite different. For the forest I thought of just randomly adding trees to the layer, and for the maze a "proper" maze algorithm should be used (i.e. one listed at http://www.astrolog.org/labyrnth/algrithm.htm) I don't see how the 3rd example relates to mazes.

Another example is terrain generation, which employ its own specialized algorithms.

Cheers,

Andre

toddcarnes commented 11 years ago

On 6/9/2013 10:16 PM, Andre Leiradella wrote:

On 09/06/2013 21:57, Todd Carnes wrote:

When you think about it, deep down all three of your examples are really different forms of the same thing - a maze algorithm.

The reason I've added them as separate is that the underlying algorithm could be quite different. For the forest I thought of just randomly adding trees to the layer, and for the maze a "proper" maze algorithm should be used (i.e. one listed at http://www.astrolog.org/labyrnth/algrithm.htm) I don't see how the 3rd example relates to mazes.

Another example is terrain generation, which employ its own specialized algorithms.

Cheers,

Andre

— Reply to this email directly or view it on GitHub https://github.com/bjorn/tiled/issues/454#issuecomment-19178443.

Well, you said you wanted to ensure you could walk from point A in the forest to point B. That's what a maze algorithm does.

As for the random house one, I was thinking more of houses built from randomly sized & shaped rooms. In that case, you would still need to ensure that doors were placed to allow entry into all the rooms... i.e. no isolated, non-accessible rooms. Again, a maze algorithm could be used to do that. However, if you just meant that each tile would represent a different type of house, then, no, that wouldn't be related to mazes.

Todd

leiradel commented 11 years ago

Well, you said you wanted to ensure you could walk from point A in the forest to point B. That's what a maze algorithm does. Ah, I see. I was thinking in maybe applying A* for each placed tree to check if the path is open, so it wouldn't matter if there is more than one possible path, but that's off topic :)

As for the random house one, I was thinking more of houses built from randomly sized & shaped rooms. In that case, you would still need to ensure that doors were placed to allow entry into all the rooms... i.e. no isolated, non-accessible rooms. Again, a maze algorithm could be used to do that. However, if you just meant that each tile would represent a different type of house, then, no, that wouldn't be related to mazes. I was thinking of creating the houses exteriors, but that's an excellent example for a Tiled plugin.

Cheers,

Andre

bjorn commented 11 years ago

My plan is to allow such things to be done through a scripting API. I would prefer either Lua or JavaScript, the first because it's light-weight, easy to embed and already used a lot in the game development world or the second because Qt has JavaScript support built-in and bindings to that language also shouldn't be hard to set up.

bjorn commented 11 years ago

Btw guys, for some reason your replies look completely messed up on github. :-)

toddcarnes commented 11 years ago

Wow, you're right. That looks terrible. :)

ameyp commented 11 years ago

@bjorn Have you started working on this? If not, I'd like your suggestions for how you'd like the plugin support to be structured. My initial (and probably naive) idea is to simply add a lot more interfaces similar to the existing MapRendererInterface.

bjorn commented 11 years ago

@ameyp Well as I commented before rather than adding more interfaces I'd prefer to add a scripting layer to Tiled. The binary compatibility requirements of the plugins make them unsuitable for distributing them separately so in the end it's not at all that useful for them to be plugins in the first place.

However, if you have any particular problem to solve that would be good to do as a plugin, feel free to propose new interfaces.

rae commented 9 years ago

+1 for adding scripting to Tiled. I'd like to use it to validate maps using game-specific logic.

s-m-k commented 6 years ago

This is the feature Tiled needs to become a really good production-tier multi-purpose editor. Now it's good for limited cases, but if I want to add some custom features, the workflow becomes not that good and it's clear that I will have to write my own specialized editor from scratch.

For example, I want to encode some logic in a visual way. I have to either write/use some external tool or mess with objects (which isn't a good workflow). With plugins, I could just code my own node system on top of the rest and edit everything in Tiled.

eishiya commented 1 year ago

Since Tiled supports JavaScript scripting now and allows scripts to implement not only new map and tileset formats, but also arbitrary actions, signal handers, and entire custom tools and GUI windows, perhaps this issue can be closed?

There are some features that are still not present and which can still only be added via forking Tiled, such as previewing objects (#3383), but I think those are best off having their own specific issues.

bjorn commented 1 year ago

Thanks for bringing this up, @eishiya. The addition of scripting definitely addressed this need and already allows for a broad range of extensions, including those initially suggested here.