Tilengine - The 2D retro graphics engine forum
Getting a Invaild Tileset Reference - Printable Version

+- Tilengine - The 2D retro graphics engine forum (http://tilengine.org/forum)
+-- Forum: English forums (http://tilengine.org/forum/forumdisplay.php?fid=3)
+--- Forum: Support (http://tilengine.org/forum/forumdisplay.php?fid=7)
+--- Thread: Getting a Invaild Tileset Reference (/showthread.php?tid=393)

Pages: 1 2


Getting a Invaild Tileset Reference - RootBeerKing - 11-13-2019

Hello, I've been playing around with the sample files and I finally got around to trying to load some of my own artwork into the engine, however I have ran into an error that I'm not sure how to fix. I've basically taken the Platformer.py sample and replaced the tilemap with one that I have made personally. Everything is the same I just changed lines 64 and 65 the file to redirect to my tmx files. Doing this I get the error "tilengine.TilengineException: 'Invalid Tileset reference'" Any ideas what might be wrong?


Thank you and have a wonderful day.


RE: Getting a Invaild Tileset Reference - megamarc - 11-13-2019

Without having your artwork and the contents of the line you have changed, I can't tell the problem. However my guess is that you've produced 32-bit ARGB artwork, whereas Tilengine requires 8-bit indexed color format, and it's refusing to load it. It's a common mistake. Make sure your PNGs are 8-bit and index 0 is the transparent color.

The python binding is a bit outdated, but the core library got a TLN_SetLogLevel() function in release 2.10 to print this kind of errors to the standard output before they crash something.

Thanks and goog luck!


RE: Getting a Invaild Tileset Reference - RootBeerKing - 11-13-2019

(11-13-2019, 07:10 AM)megamarc Wrote: Without having your artwork and the contents of the line you have changed, I can't tell the problem. However my guess is that you've produced 32-bit ARGB artwork, whereas Tilengine requires 8-bit indexed color format, and it's refusing to load it. It's a common mistake. Make sure your PNGs are 8-bit and index 0 is the transparent color.

The python binding is a bit outdated, but the core library got a TLN_SetLogLevel() function in release 2.10 to print this kind of errors to the standard output before they crash something.

Thanks and goog luck!

Hey Marc, thank you for reply, unfortunately the file is already an 8-bit indexed color PNG. Would it be possible for me to send you the file which I'm having trouble with so you could take a look?


RE: Getting a Invaild Tileset Reference - megamarc - 11-13-2019

Of course, you can post the files here in the forum if you want. And also the modified Platformer.py


RE: Getting a Invaild Tileset Reference - RootBeerKing - 11-13-2019

(11-13-2019, 07:43 AM)megamarc Wrote: Of course, you can post the files here in the forum if you want. And also the modified Platformer.py

I've attached a zip with all the files. Let me know what you find. Thank you again for the help, it's much appreciated.


RE: Getting a Invaild Tileset Reference - megamarc - 11-13-2019

Hi again,

Spritesets are loaded from a pair of files with the same base name, different extension:
  • a png file with all the sprites packed together (player.png)
  • a txt describing the rectangles and names of each individual graphic inside the big png. (player.txt)
In the zipfile you provide, the associated "player.txt" required by "player.png" is missing. 

Also, the funcion call to load the spriteset expects the base name without the extension, line 65 should be:

Code:
playerSprite = Spriteset.fromfile("player")

I see the documentation is not clear in this regard.

For a full working example in python, i recommend you to check this project:
https://github.com/megamarc/TilenginePythonPlatformer

Your interest is much appreciated too Smile


RE: Getting a Invaild Tileset Reference - RootBeerKing - 11-13-2019

(11-13-2019, 08:17 AM)megamarc Wrote: Hi again,

Spritesets are loaded from a pair of files with the same base name, different extension:
  • a png file with all the sprites packed together (player.png)
  • a txt describing the rectangles and names of each individual graphic inside the big png. (player.txt)
In the zipfile you provide, the associated "player.txt" required by "player.png" is missing. 

Also, the funcion call to load the spriteset expects the base name without the extension, line 65 should be:

Code:
playerSprite = Spriteset.fromfile("player")

I see the documentation is not clear in this regard.

For a full working example in python, i recommend you to check this project:
https://github.com/megamarc/TilenginePythonPlatformer

Your interest is much appreciated too Smile
Were you able to get the tmx files to load? If so, how did you fix the issue with invaild tileset reference?


RE: Getting a Invaild Tileset Reference - megamarc - 11-13-2019

Hi again,

I didn't try loading more assets as I saw the error with the sprites. I was going to try it now, but I'm on another computer and you've removed the attachment from the post


RE: Getting a Invaild Tileset Reference - RootBeerKing - 11-13-2019

(11-13-2019, 06:04 PM)megamarc Wrote: Hi again,

I didn't try loading more assets as I saw the error with the sprites. I was going to try it now, but I'm on another computer and you've removed the attachment from the post

Oh sorry, I just didn't want any others getting a hold of my art, I'll upload it one more time, just let me know when you got it so I can delete it again.


RE: Getting a Invaild Tileset Reference - megamarc - 11-13-2019

Done. The problem is that Tilengine doesn't load tilesets embedded inside tilemaps (something that Tiled editor itself can do), they must be exported as stand-alone tilesets. I've done it, here you can find attached the resulting decoupled tmx/tsx files. I haven't included the png.

Let me know your progress!