mapeditor / mapeditor/tiled

BIG-BUG!!!!!!!! firstgid corruption when editing multiple maps sharing tilesets

Open
#4,291 8 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

Describe the bug

Our designer encountered firstgid corruption when working with two maps that share some common tilesets.

Actual Behavior:
After saving Season_1_miniMap, the firstgid values for shared tilesets are overwritten and become inconsistent with their original values.

File Evidence:

Normal Season_1_miniMap (before corruption):

<tileset firstgid="264" source="../tilesets/s1/easy_water/s1_easy_water.tsx"/>
<tileset firstgid="288" source="../meta_tilesets/collision_check/collision_check.tsx"/>
<tileset firstgid="290" source="../tilesets/s1/one_tree/s1_2x2sk.tsx"/>
<tileset firstgid="294" source="../tilesets/s1/xzddb/s1_xzddb.tsx"/>
<tileset firstgid="298" source="../tilesets/s1/xzddb/s1_xzddb_c.tsx"/>
<tileset firstgid="314" source="../tilesets/s1/map_anim_objs/map_anim_objs_tileset.tsx"/>

Normal Season_1:

<tileset firstgid="270" source="../tilesets/s1/easy_water/s1_easy_water.tsx"/>
<tileset firstgid="408" source="../tilesets/s1/xzddb/s1_xzddb.tsx"/>
<tileset firstgid="412" source="../tilesets/s1/xzddb/s1_xzddb_c.tsx"/>
<tileset firstgid="428" source="../tilesets/s1/one_tree/s1_2x2sk.tsx"/>
<tileset firstgid="432" source="../tilesets/s1/db_2/s1_db.tsx"/>

Corrupted Season_1_miniMap (after saving):

 <tileset firstgid="264" source="../tilesets/s1/easy_water/s1_easy_water.tsx"/>
 <tileset firstgid="402" source="../meta_tilesets/collision_check/collision_check.tsx"/>
 <tileset firstgid="404" source="../tilesets/s1/one_tree/s1_2x2sk.tsx"/>
 <tileset firstgid="408" source="../tilesets/s1/xzddb/s1_xzddb.tsx"/>
 <tileset firstgid="412" source="../tilesets/s1/xzddb/s1_xzddb_c.tsx"/>
 <tileset firstgid="428" source="../tilesets/s1/map_anim_objs/map_anim_objs_tileset.tsx"/>

Suspected Cause:
We suspect that Tiled might be treating tileset objects as globally shared instances, and the firstgid assignment logic might be using a global context instead of being map-specific.

Steps to reproduce
  1. Open and edit Season_1.tmx
  2. Then open and edit Season_1_miniMap.tmx
  3. Save Season_1_miniMap.tmx
  4. The firstgid values for shared tilesets become corrupted
Expected behavior

Each map should maintain its own firstgid assignments for tilesets, even when they reference the same source tileset files.

OS version

Windows 10

Tiled version

1.11.2

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

Reproduce the issue by opening and editing Season_1.tmx followed by Season_1_miniMap.tmx, then saving the mini-map. Trace the map-specific tileset and firstgid assignment logic, checking how shared source tilesets are handled. Done means each map retains its own firstgid values after saving, without changing the other map.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
desktop, game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.