TiledSharp icon indicating copy to clipboard operation
TiledSharp copied to clipboard

API Notice: File object inputs, Layer integration

Open marshallward opened this issue 8 years ago • 7 comments

This is a notice and request for comment on upcoming API changes. This will resolve a number of outstanding issues (#15, #25, #28).

The next tagged release will adopt the following changes:

  • TMX files will no longer be specified by filepath. Instead, the Map object will be created using an already-opened file object. While this will require additional file and resource management from the user, it will eliminate any filesystem dependencies from TiledSharp. This will also allow compilation as a Portable Class Library, and run on a greater number of platforms.

  • The ObjectGroup and ImageLayer lists will be merged into Layers, which more closely resembles the TMX layout format. Elements can still be accessed by layer name, so this should not introduce any major problems.

    If two layers of different types were using the same name, then there may be some internal namechanges, but this is probably not a major issue.

The following change is also being considered:

  • Removing the DotNetZip code dump and replacing it with a .NET 3.5 compatible zlib library (possibly ZLib.Portable). This would address issues #15 and #16.

The following changes have been completed:

  • Tiles within Tileset are now stored as an id-index Dictionary, rather than a list (as suggested in #38)
  • DotNetZip has been removed, zlib support now provided by DeflateStream over data section

Any comments on these changes (including approval) can be posted here.

marshallward avatar Apr 05 '16 05:04 marshallward

Sounds good. As long as it still works with Unity I'll be a happy bunny :) Thank you for TiledSharp!

TheMightyGit avatar Apr 05 '16 18:04 TheMightyGit

As long as "Instead, the Map object will be created using an already-opened file object" means we can pass a Stream into it, everything should be good.

hach-que avatar Apr 10 '17 00:04 hach-que

I haven't followed up on this as I liked, but yes - the intention was to have a Stream input in place of the path-based constructor, which has been more trouble than it's worth.

Things have finally calmed down for me workwise, so hopefully I'll have time to get this finished up.

marshallward avatar Apr 10 '17 03:04 marshallward

Would it be possible to have an overload where you pass a string as well?

Cryru avatar May 06 '17 10:05 Cryru

Yeah I'm OK with that.

marshallward avatar May 09 '17 09:05 marshallward

Any word on these changes? I've been using TiledShape in my own personal project and made some modifications to it similar to #28. I've also written some code that allows loading maps that have infinite size, if you'd like me to make a pull request for that at some point.

briankendall avatar Feb 20 '18 15:02 briankendall

It's probably obvious to everyone that I've had to put anything related to this project at the bottom of my work (I haven't looked at C# code in years), so I think at this point it's up to others to improve things. So I'm sure that others would welcome the changes you've made, and I'm happy to integrate them.

I'm also open to handing this project over somewhere else, such as a Tiled organization or something similar.

marshallward avatar Feb 21 '18 02:02 marshallward