Can I use Tiled Editor to create a HUD?

I was wondering if I could create a layer that would be specified in screen coordinates vs world coordinates. The idea is to put a layer in that would serve as my HUD or GUI. I think if you had a layer that could be drawn in screen coordinates instead of world then that would be all that you need to specify GUI layout in Tiled instead of the game itself or some other externalized form. Is it possible? Or has it be considered as a new feature? TIA

Starting in the next big Tiled release (1.5), you’ll be able to set parallax scroll factors on layers. A layer with parallax scroll 0.0 is fixed to the camera, so essentially its coordinates become screen-space. You could use this for a HUD even if you don’t have any parallax in your game (all the other layers would be at the default value of 1.0)

Of course, it’ll be up to your engine/parser to correctly load in this data and to parse your HUD as a HUD, and since this is a new feature, it will take time for existing Tiled parsers to implement it if you’re not writing it yourself. Plus, all the dynamic elements of the HUD (such as health bars) will still need to be defined in code or at least rely on hooks in your code, there’s no getting around that.

Caveat emptor understood. That’s all that I would expect from the feature as you described it. Since engines/parsers would need to implement it, is there a preferred algorithm that each engine would have to implement?

But the idea of using parallax scrolling for layers with screen coordinates is cool idea.

I’m not aware of any common ways of doing it, and I’ve only heard of HUDs in Tiled before in the context of a preview, not as the actual place where the HUD is put together.

HUDs are usually implemented separately from the maps, because

  1. There’s usually one HUD for the whole game, but multiple maps, and it makes no sense to redefine the same HUD data for every map
  2. The HUD has so many dynamic elements that vary per game that a significant chunk of the HUD has to be done some other way anyway, making an in-map HUD further redundant for most scenarios
  3. HUDs often don’t lend themselves to a tiled approach anyway, and while Tiled does support Image Layers, such things are often more convenient to put together in-engine rather than in tiled.

That’s not to say there aren’t situations where it makes sense to define a HUD in Tiled. For example, a single-map game might work fine with that, as would games where the static parts of the UI change with each map. It’s just unusual and not always the best idea.

I suppose a general approach would be to have a layer for the static elements of the HUD, and an Object Layer denoting where the dynamic elements go, if they’re not hard-coded. With custom properties you could even define which artwork to use for the dynamic elements. I’ve never heard of anyone actually doing this though, it’s just a theoretical possibility. I don’t think any existing parser has any special HUD-related features, which would be required for such usage.