mapeditor / tiled

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

Support for autotile (RPG Maker format) #1022

Open Frozenfire92 opened 8 years ago

Frozenfire92 commented 8 years ago

Tiled is a great tool, especially for those who use Unity or game engines other than RPG maker. With the release of the newest humble bundle I foresee many people like myself wanting to use their new assets with Tiled (and eventually game engines other than RPG maker). It appears that their Autotile format is quite common and works well for compacting things, but makes it difficult to use in Tiled without an external tool.

I think it is within the scope of Tiled to support importing this format and then automatically slicing it up. While the terrain tool works well for some sprites, it doesn't seem to work with this format. There is an existing tool Remex but it only supports the 64x96 pixel image at a time. It would be better to automatically detect the size and split it accordingly (It appears 512x384 is standard)

bjorn commented 8 years ago

It would definitely be interesting to support this type of terrain, though I have not seen it used outside of RPG Maker so I kind of disagree with the format being "quite common". Outside of RPG Maker, the format used by Tiled is actually quite common. In any case the question comes up a lot, I guess mainly because of the vast library of tilesets available alongside (or made for use with) RPG Maker.

I'm not sure what's the best way to support it. There are some options:

In any case, if you want to help me get around to a feature like this, please do consider supporting me on Patreon. The amount of time I have for Tiled directly depends on how many hours I can afford to drop from my job.

Frozenfire92 commented 8 years ago

Thanks for the quick response,

Forgive me in being a bit uneducated in the commonality of this format. I think a lot of people like myself have bought the humble bundle and now have a ton of assets in a format for an engine they aren't interested in using.

Ship a tool like Remex with Tiled. However, it is plain annoying to have to preprocess your tilesets and it needlessly increases the texture size.

I think this is the best option. When creating a new tileset the dropdown for type could be Based on RPG Maker tileset which would then auto-detect and split into 64x96 sized chunks to be used by Remex (or the forked code integrated). I think this would make the process much smoother than it is now (cutting the image up and running remex on each individually before loading into tiled)

I thank you for your time you have invested in this project, it is very useful :smile: I will try and have a peek a the code for it and Remex over the next week and look into helping with this feature.

lefticus commented 8 years ago

I bought the Game Maker Humble Bundle myself and feel compelled to point out that much (most?) of the material in it has a Copyright statement such as:

The graphics included in the Product (the "Pirate Ship Tile Pack") may be used with any of ENTERBRAIN's game development software (include all related titles of "RPG MAKER Series" or "our products") that retains the Company's rights. You cannot use the Resource Pack with other game engines/software. User can create, distribute, or sell their original game by using the Resource Pack only if they meet all the following conditions:

If I read that correctly that means we cannot legally use these tilesets with tools like "tiled" anyhow.

This is now the second Humble Bundle with RPG Maker in it that I've bought and I've seen many copyright licenses similar to this one.

bjorn commented 8 years ago

Right, that's the deal with RPG Maker's own tilesets unfortunately, so supporting them directly is pretty much only useful for 3rd party tilesets that were painted to be RPG Maker compatible.

Frozenfire92 commented 8 years ago

I believe they addressed that here https://support.humblebundle.com/hc/en-us/articles/206156508 . I think limiting assets to a specific engine goes against what humble bundle is about anyhow, I believe all of the assets included in the humble bundle were as you said painted to be RPG maker compatible

lefticus commented 8 years ago

@Frozenfire92 Ah, thank you. I was pretty confused by that.

bjorn commented 8 years ago

@Frozenfire92 That's great to know!

fmoo commented 8 years ago

Just wanted to add a link to some docs on how autotiles work in RMVXA.

Like Remex (which is basically abandoned these days), that link only covers the most popular "A2" format, so I'll to provide some extra details from my investigation on the other "A" formats.

kphillisjr commented 7 years ago

I also think this is a good idea, and will greatly expand on what @fmoo stated. Also I will say that the following information can be used by anyone wishing to import tiles into this map editor.

Tile Types

Generic Terrain autotile

These are the easiest to work with, and cover most of the auto-tiles. For RPGMaker VX Ace optimized tilesets these are a 16 pixel by 16 pixel grid. I know my example is smaller than this. The Blue area represents the edge case with other tiles, and the white area is the terrain type for the Auto-Tile. coreautotile

Animated Terrain autotile

These are terrain auto-Tiles from above where you have 3 frames of animation side by side.

Generic Wall Auto-Tile

This works exactly the same as Terrain auto-Tiles, but lacks the small inner corner case. In General these tiles do not have interaction with other tile-types. wallautotile

WaterFall Auto-Tiles

This tile type is a set of two 32px by 32px animated tiles side by side where each row is a frame of animation. This means that this tile takes up the same amount of space on a sprite sheet as a generic terrain auto-tile. This can form an animated wall auto-tile when you have 3 or more that can be linked together. In general this is the type of tile where the users need to configure on a set-by-set basis because this can involve 3 types of terrain ( Waterfall, Water, and land type )

RPG Maker Tile Layers

Tile Layer A1

This is the most complex of the sprite sheets, but in general all of these have the similar layout as shown below: autotilea

Tile Layer A1 - Area A - Water/Ocean

This is a Animated Terrain Auto-tile. In general it is used for water.

Tile Layer A1 - Area B - Deep Water/Ocean

This is a Animated Terrain Auto-tile. In general it is used for deeper water, and sometimes is placed within Area A.

Tile Layer A1 - Area C - More animated Water Tiles

More Animated Terrain Auto-Tiles. To my knowledge these have been used for Lava, Ice, and even more water animations.

Tile Layer A1 - Area D - Water Tile decoration

These are generally used for decoration of water tiles in an auto-terrain format.

Tile Layer A1 - Area E - More Water Decoration Tiles

These could be terrain auto-tiles or waterfall tiles. Either way this section requires a lot of user input, but in general these are always two 32px by 32px tiles side by side, and sometimes 3 of these can be combined to form a wall auto-tile.

Tile Layer A2

This is a straight forward import, this is a grid of 8 by 4 terrain auto-tiles.

Tile Layer A3 - Exterior wall/Ceiling

This is used for exterior Ceiling/walls, and is a 8 by 4 grid of wall auto-tiles. I believe the easiest solution for now is to define each wall auto-tile as a terrain.

Tile Layer A4 - Wall/Ceiling

This is is simply a row of 8 terrain auto-tiles used for Ceilings followed by a row of 8 wall auto-tiles. In general this forms a total of 48 tiles total.

Tile Layer A5 - Generic Tiles

These are 32px by 32px tiles.

Tile Layer B to E - Generic Tiles

These are Objects of varying size.

Possible issues.

Animated Terrains

I have not found any simple way to create animated terrains yet, and this is a required feature for this bug report.

Cross-File Terrains

I have found that occasionally the terrain auto-tiles have the center fill-tile found in the TileA5 file. To my knowledge there is no easy way to resolve this issue without editing the input files directly.

Terrain Fill

There is no easy way to fill using defined terrains. Instead you need to fill using tiles in the tile sheet directly.

Possible Solution

There is many solutions for this, but the easiest would be to use import wizard. The Wizard will need to have the user help guide the import since there is going to be a large set of tiles imported in one go. Most of the work would be terrain definition/names, and the occasional cross-file terrain fix.

no-identd commented 5 years ago

Some semi-recent discussion of this issue on itch:

https://itch.io/post/487538

no-identd commented 4 years ago

1421 has now gotten closed as #2708 by @phlosioneer has landed. This still has a catch tho, to quote @bjorn:

I think the main catch right now is that automatic updating of the meta-tileset image will only be triggered when its map file is changed. Changes to any images or other meta-tilesets referenced by the map file will not trigger such an update.

(I don't think a follow up issue exists for this yet, but I assume one will soon arise.)

However, either way, how much closer does that bring this issue (#1022) to finding a resolution? 🤔

bjorn commented 4 years ago

@no-identd Well, since RPG Maker performs its autotile magic by cutting the tiles into even smaller pieces and recombining them, this could now be done using a map and then that map can be used as the image of a tileset, where the terrain information for the terrain tool can then be set up.

Of course, that's a rather manual process that could also have been done using any image editing software. But a big time-saver is that the map of this tileset as well as the terrain information can be re-used with different RPG Maker tilesets, so it only needs to be set up once.

bjorn commented 3 years ago

Just a note to those wanting to use RPG Maker autotiles in Tiled: @fmoo wrote a tool for converting such tiles to a format that Tiled's Terrain tool can work with, available at https://fmoo.itch.io/autotile-packing-tools.

devium commented 3 years ago

I wasn't happy with the tools available, so I wrote another conversion tool that pre-combines RPG Maker's smaller subtiles into all possible combinations: https://github.com/devium/tiled-autotile It's so far just a quick and dirty implementation, lacks documentation, config options, and only works with tileset layers in the specific A1 to A4 formats as explained by @kphillisjr above. But it gets the job done for now.

Basically, it turns this: image into this: image So it also makes single-tile "rivers" and paths available and arranges them a little neater.

bjorn commented 3 years ago

@devium That looks great! Since you're creating blobs, I wanted to try it out with the recently improved Terrain Brush, and it worked great:

image

Eventually it would still be nice if we could avoid the explicit expanding, though actually we would not get around to that without either implementing the sub-tile logic in Tiled as well as in the various game engines, or saving to a tile layer with smaller tiles (which depends on supporting tile layers with differently sized tiles in general).

Also unfortunately the single-tile is currently not covered by the Terrain Brush. Hopefully we can find a solution to this some time.

eishiya commented 2 years ago

I made a version of @devium's script that runs directly in Tiled (requires 1.8 RC or newer): https://github.com/eishiya/tiled-expand-autotile This one outputs a Tiled map, which can be exported as an image, or saved to use as a Tileset source directly. The output layout is the same as in the original script.

I'm hoping that with a script like this, Metatilesets, and another script to import terrains from the original tileset(s) into the metatileset, and hopefully importer/exporter support for metatilesets, using RPG Maker tilesets in Tiled can become a lot less painful. Unfortunately, I don't foresee wide support for metatilesets. However, they can be pretty painlessly replaced with an image export of the source map for production use. ...and engine support for metatilesets seems more likely than engine support for RPG Maker-style minitiles outside of RPG Maker :/ So, I think expanding has value, if not for maps made for RPG Maker, then at least for maps made for other engines using tilesets designed for RPG Maker.

bjorn commented 2 years ago

@eishiya That's great! Now if only we could also find a way to automatically set up the terrains. Problem of course is that then you need to create the tileset, for which you'd first need to save the image. Could be added as a separate action I guess.

eishiya commented 2 years ago

In the README I mentioned wanting to write a script that imports and expands labels from the original tileset, since that's a lot less work for the user than labelling the expanded tileset, but still gives the user control over what's what. It would be a separate script, since it's useful beyond just RPG Maker tilesets. It would only work:

Do you think that's worth taking the time to write?

It would've been cool to be able to generate the terrains directly as part of the autotile expanding script, but as you said, it would require saving the image/map first to create the tileset. I could write the terrain import script above, and then write a bridge script that the user can run after saving the map that generates the tileset, runs the terrain import action, and outputs the tileset, I suppose...