Cocoa Hex Based Game question
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
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: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.
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
http://www.algonet.se/~afb/gamedev/isohex.html
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
http://www.whisqu.se/per/docs/general39.htm
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Newbie question: Cocoa and Carbon - which for what and how to get started? | BliTz | 3 | 2,874 |
Jul 27, 2006 10:07 PM Last Post: OneSadCookie |
|
| Module Based Game? | KiroNeem | 5 | 2,833 |
Nov 30, 2005 09:17 AM Last Post: ThemsAllTook |
|
| Cocoa/Objective-C Question | infernooo | 2 | 2,937 |
Oct 18, 2005 11:26 PM Last Post: infernooo |
|
| Quick threaded OpenGL drawing question in Cocoa | TomorrowPlusX | 2 | 3,575 |
Nov 11, 2004 05:23 AM Last Post: TomorrowPlusX |
|
| Cocoa Filename Question | Joseph Duchesne | 3 | 3,062 |
Oct 26, 2003 03:55 PM Last Post: Joseph Duchesne |
|

