excaliburjs / excalibur-tiled

Adds Tiled Map Editor File support to Excalibur
https://excaliburjs.com/docs/tiled-plugin
BSD 2-Clause "Simplified" License
49 stars 22 forks source link

Readme example outdated? #13

Closed jlbeard84 closed 7 years ago

jlbeard84 commented 7 years ago

I've tried using excalibur-tiled with both the most recent version (13.1 as of now) as well as 11.0 that is mentioned here in the docs with no luck. Is the example to load a sheet in the readme out of date, or did something else break in the engine? I've been trying everything I could think of to get something loaded to no avail. Any suggestions would be appreciated.

bferguson3 commented 7 years ago

Seconded, the closest I can get to loading in a Tiled map is by altering the assetPath, but even then it doesn't seem to pull the image from anywhere and insists the spritesheet array is 0x0: excalibur.js:6019 Uncaught RangeError: Invalid array length

kamranayub commented 7 years ago

Have you tried running the sample inside the repo? Is that working? It was working when I last upgraded excalibur inside the repo.

Ensure you are running under a server and not from your local file:// path. This uses AJAX and that requires running on a server (the example uses webpack-dev-server I think).

jlbeard84 commented 7 years ago

From the sample inside the repo do you mean what is in the test directory? I assumed that was unit tests, but I can certainly run that if it's an example.

And yeah, I'm trying to get it going via webpack-dev-server.

kamranayub commented 7 years ago

Yep! It should work, I just tested it:

image

kamranayub commented 7 years ago

Another tip, I think newer Tiled likes to export as base64 JSON, don't do that, use regular JSON...

bferguson3 commented 7 years ago

I got it to build, but here's where I think its failing on my end: You have one file for the tilemap, when the latest version of Tiled requires both a map and tileset (.tsx/.json) file as well as the image in order to render. It seems that the test.json file included in your /test/ has the data from the .tsx file already inside the "tilesets": block.

What version of Tiled do you use? When did Tiled start using tilesets as seperate files?

bferguson3 commented 7 years ago

As another note the structure for the .json tileset file that new versions of Tiled outputs looks different than what is in your test.json map file.

kamranayub commented 7 years ago

Oh very interesting! I'll have to take a look, when I have a chance I'll send the version I was using, it was probably around the April 2017 timeframe where we last used it.

If indeed there's been a schema update, I'll need to work through the details and update the plugin to support the newer format. Thanks for bringing this up!

bferguson3 commented 7 years ago

Awesome, thanks Kamran ^^

kamranayub commented 7 years ago

No thank you because now I know what my next live stream will be about ;)

bferguson3 commented 7 years ago

I can confirm that it works fine with Tiled files created on < v1.0 (like 0.18, pre-May). Thanks for your assistance diagnosing this!

jlbeard84 commented 7 years ago

Yep! Can also confirm. I think it would probably be helpful to have something in the documentation with regards to the version of Tiled for devs going forward. Thanks for your help!

eonarheim commented 7 years ago

@kamranayub would it make sense to support both formats under a flag of some kind?

Perhaps a LEGACY flag to support older tiled files pre v1.0 then by default support the newer format?

kamranayub commented 7 years ago

I think I'll be able to detect it automatically. We will find out Thursday when I work on it. Tune in to help if you like!

On Tue, Oct 24, 2017, 09:51 Erik Onarheim notifications@github.com wrote:

@kamranayub https://github.com/kamranayub would it make sense to support both formats under a flag of somekind?

Perhaps a LEGACY flag to support older tiled files pre v1.0 then by default support the newer format?

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/excaliburjs/excalibur-tiled/issues/13#issuecomment-339017083, or mute the thread https://github.com/notifications/unsubscribe-auth/AAiaa2CPfUrWJb92ssWCopAlwm8C_vpwks5svflZgaJpZM4QBEOD .

kamranayub commented 7 years ago

Hi guys, thanks for reporting this issue. I've found the problem! If you don't check "embed in map" when you create a tileset:

image

Then it requires an external file. If you embed it, it will work as it did before.

I will create a new issue for adding support for loading dependent TSX files when not embedded but that's the workaround for now!

kamranayub commented 6 years ago

This support should now work out of the box. Thanks for reporting!

jlbeard84 commented 6 years ago

Thanks for the update!