Reuse tileset between different tilemaps

Hey everyone!

I’ve got a game that will have different areas (think metroidvania-like) and I’m planning on building out those different areas as individual tilemaps.

The tileset that they will all share will have certain properties assigned to different tiles, like whether or not they should be collideable.

The problem I’m running into is that Phaser 3 requires tilesets to be embedded into the tilemap. And you can’t seem to re-use embedded tilesets across tilemaps.

Does anyone have some advice for the best way to share a tileset across tilemaps in Phaser 3?

An embedded tileset is part of the tilemap’s data, which is why you can’t re-use it across tilemaps. An external tileset, on the other hand, is a completely separate file, which really is a lot more convenient.

The simplest solution is to manually update your tilesets. This will work alright if you don’t have many tilemaps. Considering that Phaser doesn’t currently support external tilesets, however, the next best option is to write a script (or Webpack plugin, or an equivalent thereof) that parses your tilemaps and embeds the tileset into them automatically. I’m not sure if there are any existing libraries for this.

1 Like