-
-
Notifications
You must be signed in to change notification settings - Fork 990
Description
What happened?
Using the following method to load a RenderableTiledMap fails when my maps only have one image associated with them:
renderableTiledMap = await RenderableTiledMap.fromFile(
fileName,
Vector2.all(tileSize),
useAtlas: false,
prefix: '', // Don't default to /assets/tiles/
images: Images(prefix: ''),
layerPaintFactory: (it) => _layerPaint(),
);
Loading the image is failing because in tile_atlas.dart
on line 163 a separate logical path is followed when the imageList associated with a map is equal to 1.
This separate logical path only uses the entry.$2
field of the image whereas the standard logical path uses entry.$1
.
This causes an inconsistency when relative paths are being used.
What do you expect?
The behavior is consistent between maps that only have one image versus maps that have multiple. The pathing should either always be relative or always be absolute.
How can we reproduce this?
Configure the following folder structure for your Tiled assets:
- assets/
- assets/chunks/
- assets/chunks/maps/
- assets/chunks/TileSets/
- assets/chunks/Images/
- assets/chunks/
Maps inside of the maps
folder reference TileSets using paths relative to the root assets/chunks/TileSets/[name].tsx
.
TileSets inside of the TileSets
folder reference Images using paths relative from their current folder ../Images/[name].png
.
Create a RenderableTiledMap
but ensure that all prefix options are set to ''
since the library assumes a different folder structure.
You will need a map with one image, and a map with multiple images. Loading of the map with multiple images will succeed whereas the map with a single image will fail to load.
What steps should take to fix this?
The entry.$1
field and entry.$2
have different representations of the source image path.
entry.$1
includes the path of the TileSet assets/chunks/TileSets/../Images/[name].png
entry.$2
does not ../Images/[name].png
On line 166 of tile_atlas.dart
when a single image is present in a TileSet it is using entry.$2
as the derived path of the asset.
On line 202 of tile_atlas.dart
when more than one image is present in a TileSet it is using entry.$1
as the derived path of the asset.
This inconsistency needs to be corrected since making changes to support one breaks the other.
Do have an example of where the bug occurs?
Lines 163:178 of tile_atlas.dart
.
Relevant log output
Execute in a terminal and put output into the code block below
Output of: flutter doctor -v
[✓] Flutter (Channel stable, 3.35.1, on macOS 15.6 24G84 darwin-arm64, locale en-US) [123ms]
• Flutter version 3.35.1 on channel stable at /Users/michaelwrock/Sources/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 20f8274939 (5 days ago), 2025-08-14 10:53:09 -0700
• Engine revision 1e9a811bf8
• Dart version 3.9.0
• DevTools version 2.48.0
• Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios,
cli-animations, enable-lldb-debugging
[!] Android toolchain - develop for Android devices (Android SDK version 35.0.0) [1,489ms]
• Android SDK at /Users/michaelwrock/Library/Android/sdk
• Emulator version 35.2.10.0 (build_id 12414864) (CL:N/A)
• Platform android-35, build-tools 35.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
This is the JDK bundled with the latest Android Studio installation on this machine.
To manually set the JDK path, use: flutter config --jdk-dir="path/to/jdk"
.
• Java version OpenJDK Runtime Environment (build 21.0.3+-79915917-b509.11)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[✗] Xcode - develop for iOS and macOS [63ms]
✗ Xcode installation is incomplete; a full installation is necessary for iOS and macOS development.
Download at: https://developer.apple.com/xcode/
Or install Xcode via the App Store.
Once installed, run:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -runFirstLaunch
✗ CocoaPods not installed.
CocoaPods is a package manager for iOS or macOS platform code.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/to/platform-plugins
For installation instructions, see https://guides.cocoapods.org/using/getting-started.html#installation
[✓] Chrome - develop for the web [29ms]
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2024.2) [29ms]
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 21.0.3+-79915917-b509.11)
[✓] VS Code (version 1.101.0) [28ms]
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.116.0
[✓] Connected device (2 available) [139ms]
• macOS (desktop) • macos • darwin-arm64 • macOS 15.6 24G84 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 139.0.7258.128
[✓] Network resources [183ms]
• All expected network resources are available.
Affected platforms
Web
Other information
No response
Are you interested in working on a PR for this?
- I want to work on this