Tell me more ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

It would represent a map that is semi-square of arbitrary size. It would have a simple system for representation of the map coordinates such as 0101 (first column, 1st hex). I'd want the map to be able to tell me the distance between two points, and what other hexes lay between those two points as a list or array.

I don't care as much about the language but c# or python would be ideal.

Does one exist?

share|improve this question
This might help, Mappy. – iamcreasy Dec 24 '11 at 6:23

3 Answers

up vote 4 down vote accepted

Not a library but more of a tutorial. Looking though the tutorial it seems to do everything you requested. It uses C# / XNA.

http://www.sgtconker.com/2009/12/article-hexagonal-coordinates/

Edit: Link is dead so see the WaybackMachine

share|improve this answer
Do you have one for pygame? =) – Kort Pleco Dec 24 '11 at 8:11
No. But the math is the same. Incidentally, the version of that code in jemginehex.codeplex.com includes a variety with the other alignment. [Seeing my own article pop up as an answer is nice.] – Blecki Dec 24 '11 at 13:11
Sorry it took so long to mark this as the answer. It really is a fantastic link. – Pete Mancini Aug 8 '12 at 22:49
Sadly, the link is dead. Page is just a bunch of ads now. – luiscubal Sep 27 '12 at 21:05
Hmm thats a shame I'll contact the owner and see if there is some way to get them back online. – ClassicThunder Sep 27 '12 at 21:44
show 1 more comment

I believe the Java version of the Tiled Map Editor supports hexagonal maps. Have a look for yourself at: http://www.mapeditor.org/

share|improve this answer

The Cocos 2D library has support for rendering hex tile maps. I have not used it, but the library has been around for years and seems quite popular.

That might be more for rendering than for doing calculations on the hex map though. Fortunately what you ask for is quite simple to implement anyway, especially if you use a good x/y coordinate system for your hexes. See: http://www-cs-students.stanford.edu/~amitp/gameprog.html#hex

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.