Kudos for relative file references!

Maybe this was an obvious choice, but a BIG KUDO for electing to make all of the Tileset file references in the .tmx files as RELATIVE refs! It might have been easy/tempting to make them absolute refs, which would lock them to the individual’s PC file structure. Instead, once the Tiled .tmx is loaded, the relative refs can go find the Tileset (and other) graphic files with ease (assuming of course they are in their relative place).

Why is this a big deal for me? I am working with a team on a WWII game, and we are using Tiled to produce maps. We elected to put the Tiled files all out on a shared GoogleDrive to facilitate teamwork. And because the internal refs are all relative to the main .tmx… once ANY of us navigates to and loads that .tmx, all of the rest of the support files (graphics, etc.) get picked up automatically via those relative refs on GDrive. Ergo: Very easy to work as a team!

So, a kudo for that choice! :slight_smile:

I’m glad to hear working with a team with Tiled is working out well for you! It was indeed an obvious choice, since using absolute paths would have caused so much trouble. :slight_smile:

Of course, even relative paths can end up pointing to the wrong location. In Tiled 0.15, one of the most important improvements I made was that any file reference can be fixed up when opening the map. Before that version, the map would fail to open and the only way to fix it was to open the map file in a text editor in order to correct the paths.

Btw, are the files also kept in a version control? I think Google Drive is a great tool for collaboration, but it’s probably not a good way to keep track of changes and backing up old states.

@bjorn How do I make Tiled use relative references? For my first project it used relative references automatically, but after creating a new project everything is an absolute path. Is there an order I should be creating things?

I have created a project, created a map in that project, created a tile set, then selected an image. That image reference is absolute.

My project folder structure is very simple

  • Project Root
    • Maps
    • Tilesets
    • Images

Thank you in advance

Hmm, in general you will only get absolute references when the referenced files are on a different drive. Are you sure the tileset is saved in your project directory and referring to an image in your project directory?

Edit: Come to think of it, probably there should be a warning when referencing files on a different drive, or even files outside of any project folder. And of course it should be easier to select files from the project in this case.

Thank you so much for the very rapid response.

So… I validated they are all in the same place, spent a few minutes frustratedly clicking around… decided I would close everything and tweak the xml and see if Tiled was happier… and in the XML they are relative. So I guess I was dumb… in the UI you should the resolved path, but actually store it as a relative path? That makes perfect sense to me, and you are right a warning that non-relative paths are being used because files are on different drives… would be perfect.

Thanks once again!

Ah, good to know it was just a confusion due to the absolute paths being shown in the UI! Indeed I think this makes sense in general, since the resources are not forced to be within the project.

Though, with the introduction of projects I’ve begun showing project-relative paths, for example in the popup that shows up when you use Ctrl+P to open files. It probably makes sense to start doing that in more places. For now I don’t plan to change the file-relative references inside each file though, especially since using projects is not mandatory.

1 Like

I think you’ve made all the right decisions… I think the only thing you could do is show the “full path” part of the string grayed out, but I don’t think it’s worth the effort required… or maybe showing the relative path with the full path in the tool tip.

ANYWAY! Thank you for the app and support, much appreciated.

1 Like

I’ve also been confused by Tiled showing the full path once, and I think it would be fantastic to have the UI reflect that the paths are kept relative, and I think SwiftStudies’s tooltip/hover suggestion is a good one. I was going to recommend having the resolved part of the path greyed out, but that wouldn’t work well for paths that step up the directory tree (..).

But, I also agree it’s a very small thing that’s probably not worth the effort.

1 Like