mapeditor / mapeditor/tiled

Support for skipping empty tiles in tile set import

Open
#2,960 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
12.9k
Forks
2k
Avg merge
4h 27m
Merged PRs (30d)
8

Description

Unity's recommended way to create the tiles is to import a png and then slice it to create a sprite set. The slicer can skip fully transparent tiles and that seems to the the reasonable thing to do when importing tilesets that are sparse.

Imagine then a png sliced 4x4 in which each corner is empty. When imported in Tiled, the first tile is 0, which is empty while for unity the first tile is 1 (non empty), so an offset of 1, but then for tile 5 the offset now is 2. In other words the offset is not constant. The farther down the tile map the larger the offset to mind.

The feature request here is to keep track of these empty tiles and during map export just use -1, like if there was never a tile there. This is the simplest approach and avoid lots of UI work in the editor. The property sheet for each tile would say if the tile was skipped and maybe skipped tiles would have a different shade or maybe a hashed pattern.

This is mostly a problem for games (like mine) that create the maps programmatically. That is, the game actually uses the exported Tile files (csv or json) and constructs the map at runtime. For static tilemaps you can use the supertiled2unity unity plug in which takes care of things.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Trace the tileset PNG slicing/import path and the map export path described in the issue. Determine how skipped transparent tiles can be retained and represented as -1 during export, then inspect the tile property sheet to assess how skipped tiles should be shown and verify the behavior with sparse tilesets.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.