Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use TileMapLayer for Godot exports as opposed to deprecated TileMap #4106

Open
csueiras opened this issue Nov 28, 2024 · 2 comments
Open

Use TileMapLayer for Godot exports as opposed to deprecated TileMap #4106

csueiras opened this issue Nov 28, 2024 · 2 comments
Labels
bug Broken behavior.

Comments

@csueiras
Copy link

csueiras commented Nov 28, 2024

Describe the bug
Tiled exports to Godot using the TileMap node which has been deprecated (https://docs.godotengine.org/en/stable/tutorials/migrating/upgrading_to_godot_4.3.html#id4).

I think the change on the plugin is small-ish, it currently produces this:

[node name="01" type="Node2D"]

[node name="TileMap" type="TileMap" parent="."]
tile_set = ExtResource("TileSet_0")
format = 2
layer_0/name = "Ground"
layer_0/tile_data =  PackedInt32Array(...)

We want:

[node name="01" type="Node2D"]

[node name="Ground" type="TileMapLayer" parent="."]
tile_set = ExtResource("TileSet_0")
use_parent_material = true
tile_map_data = PackedByteArray(...)"

So the primary complexity is implementing the change from the int32 array into the data format in the byte array.

I'm not sure if the specs are documented anywhere, but the Godot code is easy enough to follow as a spec (https://github.com/godotengine/godot/blob/9aed9eca40127bcf21ecd71d25fe8809f345d9e3/scene/2d/tile_map_layer.cpp#L2844) and the marshaling functions are defined here https://github.com/godotengine/godot/blob/9aed9eca40127bcf21ecd71d25fe8809f345d9e3/core/io/marshalls.h.

To Reproduce
Steps to reproduce the behavior:

  1. Export a map to Godot
  2. Open map in Godot
  3. See deprecation warning for the use of a TileMap node

Expected behavior
The export should not produce a deprecation warning.

Specifications:

  • OS: macOS
  • Tiled Version: 1.11.0

Not exactly sure if this is a bug or a feature request, please feel free to re-label.

@csueiras csueiras added the bug Broken behavior. label Nov 28, 2024
@csueiras csueiras changed the title Use TileMapLayer for Godot exports as opposed to deprecated TileMapLayer Use TileMapLayer for Godot exports as opposed to deprecated TileMap Dec 1, 2024
@dogboydog
Copy link
Contributor

Just to note, this would be a breaking change for anyone that is using Godot 4.0-4.2. Not sure if the plugin can read the project file and determine the project version or not.

@csueiras
Copy link
Author

csueiras commented Dec 6, 2024

Yeah I did a good amount of digging into this and even started writing my own export plugin purely in javascript but decided to abandon and use YATI instead. Its easier to make sure things all work well if its an import flow in Godot as opposed to this export mechanism.

Either way the current export plugin can generate the necessary things to then have Godot itself migrate it to a TileMapLayer so that perhaps is wnough of a workaround for the time beinf for most people.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Broken behavior.
Projects
None yet
Development

No branches or pull requests

2 participants