flame_tiled: tileset image in a subfolder of an external .tsx resolves to the wrong path

Đã đóng
#4,117 1 bình luận 1 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@ufrshubham đang làm issue này rồi.

Từ ngày 16/10/2026.

  • #4118 của @ufrshubham — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
dart, flutter
Lĩnh vực
game-dev

Hướng nghiên cứu

Start with TiledAtlas.fromTiledMap in lib/src/tile_atlas.dart and trace how the map path, external .tsx path, and image source are combined. Compare the failing sets/edge.tsx and img/edge.png case with the ../tilesets/a.tsx case that already works. Done means external tileset images resolve relative to the .tsx folder and the resulting path is normalized; an open linked pull request #4118 is already addressing this issue.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

What happens

TiledComponent.load loads a tileset's image from the wrong folder when the external tileset and
its image paths have the same number of segments.

Map assets/tiles/edge.tmx:

<tileset firstgid="1" source="sets/edge.tsx"/>

Tileset assets/tiles/sets/edge.tsx:

<image source="img/edge.png" width="32" height="16"/>

Tiled resolves the image relative to the .tsx: assets/tiles/sets/img/edge.png.
flame_tiled 3.1.2 loads img/edge.png relative to the map folder instead
(assets/tiles/img/edge.png), so loading fails with Unable to load asset.

Why

TiledAtlas.fromTiledMap (lib/src/tile_atlas.dart) only prepends the tileset's folder when the
paths' segment counts differ:

if (tilesetParts.length != imageParts.length) {
  tileImageSource = [...tilesetParts.sublist(0, tilesetParts.length - 1), ...imageParts].join('/');
}

sets/edge.tsx and img/edge.png both have 2 segments, so no join happens. ../tilesets/a.tsx +
a.png (3 vs 1) works, which is probably why this hasn't come up.

Expected

The image path is always resolved against the folder of the file that declares it (the .tsx
for external tilesets, the map for embedded ones), then normalized, the way Tiled does it.

Versions

flame 1.38.2, flame_tiled 3.1.2, tiled 0.11.1, Flutter 3.44.2, macOS. Possibly relevant to
#4015 (new imagesDirectory resolution) and #4073 (tiled 0.12 loader).

A minimal reproduction (generated assets + app) is available if useful.

Ngôn ngữ chính
Dart
Star
10.8k
Fork
1.1k
Merge trung bình
1 ngày 21 giờ
Pull request đã merge (30 ngày)
62

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của flame-engine/flame

Tất cả issue của flame-engine/flame

Issue tương tự

Thêm issue về Dart

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.