Cocoa Hex Based Game question

akinnie
Unregistered
 
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
Grin
Quote this message in a reply
kainsin
Unregistered
 
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
akinnie
Unregistered
 
Post: #3
Thanks for the help!

Andrew
Quote this message in a reply
WFleming
Unregistered
 
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)

http://www.algonet.se/~afb/gamedev/isohex.html
Quote this message in a reply
Apprentice
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:

http://www.whisqu.se/per/docs/general39.htm
Quote this message in a reply
akinnie
Unregistered
 
Post: #6
Thanks!

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

Andrew
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Newbie question: Cocoa and Carbon - which for what and how to get started? BliTz 3 3,253 Jul 27, 2006 10:07 PM
Last Post: OneSadCookie
  Module Based Game? KiroNeem 5 3,063 Nov 30, 2005 09:17 AM
Last Post: ThemsAllTook
  Cocoa/Objective-C Question infernooo 2 3,183 Oct 18, 2005 11:26 PM
Last Post: infernooo
  Quick threaded OpenGL drawing question in Cocoa TomorrowPlusX 2 3,908 Nov 11, 2004 05:23 AM
Last Post: TomorrowPlusX
  Cocoa Filename Question Joseph Duchesne 3 3,362 Oct 26, 2003 03:55 PM
Last Post: Joseph Duchesne