Take the 2-minute tour ×
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
add comment

closed as off-topic by Sean Middleditch, bummzack, Byte56 Aug 26 '13 at 14:42

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions that are about "which tech to use" are outside the scope of the site. For more information, see this meta post" – Sean Middleditch, bummzack, Byte56
If this question can be reworded to fit the rules in the help center, please edit the question.

4 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
1  
FYI, for those who haven't heard of it - the Wayback Machine tries to archive old pages. In this case, it has one snapshot of the tutorial (but not the images, alas), so there's at least code and text to read. –  Cyclops Sep 28 '12 at 11:30
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
add comment

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
add comment

Pieter Geerkens (who is here on stackexchange) has a C# library for hexagons.

share|improve this answer
    
Thank you for the plug; I try to extend or enhance the library at least once a month. –  Pieter Geerkens Aug 28 '13 at 4:08
add comment

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