API custom import of level with embedded tileset, and bounding box groups

So I’m trying to write a “custom map format” import and export for a map format. It’s actually a very old format dating back to the 90s. The map file includes the tileset in bitmap format. Is there a way where I can go about using the javascript API to permit loading the bitmap data without it necessarily having to come from a file? Or if it needs to come from a file how I might export it as a BMP file and then reimport it in whatever process is needed to create a tileset? There isn’t really much for tutorials or documentation on this that I can find except something called tiled.registerTilesetFormat which says you can use BinaryFile to read the file but not exactly how you tell the tileset you’re constructing that this is the image data. Also can’t actually load the map without a tileset so I’ve been resorting to other things for testing that part of it out.

Another thing is what might someone use to map bounding boxes definitions that can be used to specify certain properties like you can’t kill someone here, you can’t teleport elsewhere in the level here, or you automatically teleport elsewhere in the level here?

Tilesets must refer to an image file, so you would need to export the bitmap data as a format Tiled can understand and create a tileset using that, like you said. You should be able to do this as part of your map import process though, using Tiled’s new Image API (available in the snapshot build, and in the upcoming version 1.5). You’d read the relevant part of the data (the bitmap) into an ArrayBuffer, and pass that into the Image constructor. You’ll also need to specify the format of the data, Tiled offers lots of options for that.

You would use objects for this, treating them as zones in-engine. For example, in my game I have a Camera Limits object type, Warp Zones, Trigger Zones, etc - just different object types with the appropriate fields and defaults.