Cocoa Hex Based Game question

Post: #1
I'm porting a boardgame to computer and need a simple way to implement a hex map. I want to have the board made up of hexes. In fact, I am going to attempt to map them to an actual map jpeg I get from the boardgame author.

Would you know where I could get suggestions for this sort of thing? Or source code?

I assume I use a custom view in the map window, but I'm a bit unsure of how to implement the hex class. I assume the custom view will have a 2-d array of hexes, and I'll fiddle with the display so odd numbered rows will be offset up by 1/2 the hex's pixel height, or some such.

Any suggestions would be appreciated. Thanks!

Andrew Kinnie
Quote this message in a reply
Post: #2
Quote:I'm porting a boardgame to computer

Hehe, that sounds pretty funny.

Anyways, it might be easiest to have a 2-dimensional array that represents the tiles as columns ( instead of the traditional representation of rows ). That way you can easily do what you said, move the placement of the hexes of every other column down 1/2 of the height.

I would make images that represent your tiles, and build the display image programatically. Look into the NSImage documentation to use lockFocus/unlockFocus to draw into an NSImage. Then just display the final image. This is probably slow but I doubt you'll need much performance if you're modeling the game after a board game.
Quote this message in a reply
Post: #3
Thanks for the help!

Quote this message in a reply
Post: #4
Here's a link with a little bit of info, on Isometric and Hexagonal tiles (though it looks like there isn't much there except for some really basic info, so far)
Quote this message in a reply
Posts: 14
Joined: 2008.10
Post: #5
I'm working on a Hex-based game too, here is a site I found that has some info:
Quote this message in a reply
Post: #6

I'm going to work on it a bit today.

Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Turn based game match data in iOS vijaycse03 0 2,677 Jul 24, 2015 12:11 AM
Last Post: vijaycse03
  Newbie question: Cocoa and Carbon - which for what and how to get started? BliTz 3 5,421 Jul 27, 2006 10:07 PM
Last Post: OneSadCookie
  Module Based Game? KiroNeem 5 5,082 Nov 30, 2005 09:17 AM
Last Post: ThemsAllTook
  Cocoa/Objective-C Question infernooo 2 4,521 Oct 18, 2005 11:26 PM
Last Post: infernooo
  Quick threaded OpenGL drawing question in Cocoa TomorrowPlusX 2 5,263 Nov 11, 2004 05:23 AM
Last Post: TomorrowPlusX