Working with Hex-based maps

I want to use Tiled to create a hex-based wargame map, the kind you find in “analog” or boxed wargames. There are certain tasks associated with such maps for example:

  • Determining line of sight
  • Determining range or distance

Question:
Are there routines that come with Tiled that would allow me to do these calculations?

I’ve done some searching but couldn’t find anything to indicate there is, so my second question is:

Is there a library that supports the functionality I’m looking for?

Any help would be greatly appreciated.

Thanks,

TJ

No, Tiled is purely a map editor. Any game features such as distance checking needs to be implemented in the game itself.

Let’s say I wanted to add hex-based functionality. Are there any files I would need from the map editor as a starting point?

I wouldn’t do it myself I don’t have the skills but I need this functionality for a project. I’m seriously considering paying someone to do this for me.

I think a lot of the code is done:

But I have no clue on where to begin to make this work with a Tiled map.

Any thoughts on how I should proceed?

The hexagonal maps supported by Tiled are the four variants of what that article calls Offset Coordinates (in Tiled I called it “Hexagonal (Staggered)”).

Once you know how to convert the coordinates (and Tiled has some code for this as well: src/libtiled/hex.h defines a Hex class that represents a hex cube coordinate), you can use the other algorithms explained on that website to implement distance or field of view calculations.

Of course @darkhog is right that Tiled is just an editor. If you need to have this functionality available as a tool inside Tiled, for use during editing, then I can help you. But if you need it to be available in your game, then it will need to be implemented there. I do not know of a library that helps you with this, but maybe there is.

Bjorn,
If you could implement this functionality in the editor that would be great, not sure how popular it would be. The kind of games I’m interested in require such functionality.

As far as in-game functions go I will look for some local talent, maybe they can help. I do not have the skills to do it on my own.

Yeah I know it’s just an editor but I figure someone could point me to a “hex” lib that works with Tiled.