Tiled map editor11/3/2022 ![]() But, I understand if that doesn't work either. Still, defaulting to the script's path still sounds reasonable to me (and we know that path exists). Yeah, I don't like fuzzy solutions either and the default path thing felt too fuzzy as soon as I sent it. Usually the latter is no option though, since it's only the global extensions directory. In addition, there is _filename in global scope for the current file, and see also tiled.extentionsPath. ![]() I'm not really a fan of this solution since it may lead to inconsistent results and if you wanted this it would be easy to combine the relative path with map.fileName explicitly.Ĭould you try whether map.autoMap("ext:foo/foo-rules.txt") or even just map.autoMap("ext:foo-rules.txt") works? ext: refers to a virtual file path that looks up files in all installed extensions. That would mean interpreting it as relative to the respective map, though the map may not have been saved yet. That might be the behavior on Windows, but I guess in the more general case, a non-absolute path will be considered relative to the current working directory of the Tiled process. It does not say what its default path is, but it appears to be tiled.applicationDirPath. #Tiled map editor modOn the other hand, scripts might be more intimidating for users to mod than automaps are. More work, perhaps (could be less work, given the number of automaps required), but more flexibility as well, which I could certainly make use of. I am also considering not including automaps with the tilesets and scripts, and just scripting it all instead. which requires the user to keep the extension in a specific place. Map.autoMap(FileInfo.path(map.fileName) + "/extensions/foo/foo-rules.txt") Regardless of default search path or not, it would be helpful to provide something like a tiled.scriptPath property so that I can build the absolute path properly.Ĭurrently, the best I have found thus far is to partially hard-code the path: It might be more useful, however, if that default search path put the path to the script file up front (or make it the only default path), so that it is easy to put your rules files with your scripts (without needing an absolute path with autoMap()). When giving a rulesOrMapFile arg that is not an absolute path, it might be useful to apply the default search path for rules.txt that the menu option uses. toMap() is difficult to use for creating extensions. #Tiled map editor codeIf anyone takes a peek at the code or tries it out, let me know if there is any feedback.Is your feature request related to a problem? Please describe. UserFunction_HandleTiles(data, data_count) ![]() Then simply access the map's fields like so: Tinytiled_map_t* map = tinytiled_load_map_from_memory(memory, size, 0) Here's a little example of what a typical use-case looks like (this example was taken from the tinytiled.h docs): Load up a Tiled json exported file, either from disk or memory, like so: Additionally, the internals can be customized by defining various macros (like for memory allocation, or even custom CRT functions). ![]() Internally tinytiled.h uses some efficient allocation algorithms and string interning to keep memory consumption to a minimum. #Tiled map editor fullI have a full example here (loads up a test map file and prints out all the contents). #Tiled map editor freeThis header has turned out to be really nice to use for my own stuff, and I'm happy to share! Just load up the map, access relevant fields, and then use the associated free function when done. The structs are just one-to-one mirrors of the json documentation for Tiled. The map is loaded up into plain-old-data C structs, and from there are easily read by the user by directly accessing the struct fields. I've written a single-file header library in C, called tinytiled.h for loading up an entire Tiled map exported in the JSON format. Adding dependencies to a game affects many aspects of a game, a couple of which are: compile/build times and shipping size of the final game. When making a game often times it is really nice to be able to avoid dependencies. Loading up these files can be a bit of a chore, especially if one opts to use heavy-weight parsers, when a potentially much smaller and simpler parser would be nice to have. Tiled can export to a few different formats, one of which is the JSON format. Hey all, Tiled is a pretty cool open-source map editor that many 2D games use. ![]()
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |