Wednesday, November 10, 2004

Hexes, Squares and other Concerns

When starting off on a new programming project you are always faced with decisions that will determine the course and shape the final product. In building a strategic war game, one such decision I've encounter is the question of whether to use a square grid or hex grid.



I started out building my game using square tiles because the game that inspired me, Walter Bright's Empire, used them and frankly because they are simpler to work with. But about a week ago, after getting a chance to see how the game felt with squares, I've decided to switch over to hexes.



Why hexes? For me it's simply an aesthetic choice. The game doesn't really need the consistent multiple axes of movement offered by hexes, but that won’t hurt either. I grew up playing Avalon Hill games like Tobruk, Stallingrad and Squad Leader and just have a fondness for the hexes those boards had. I also think the jaggy edges of the hexes make more 'realistic' borders between terrain types; the square edges and straight lines of the square tile based board just look too artificial.



Never having worked on any code that used hex space before, I of course turned to the web for some guidance. The amount of information out there never ceases to amaze me.
For getting jump started with hexes I relied on Clark Verbrugge’s sample code from his article: Computing Field of View on a Hexagonal Grid. I don’t need the field of view calculation but reading his code was a big help. For more general game programming information I’ve found Amit's Game Programming Information to be the best. Amit’s page has links to all sorts of topics.

Post a Comment
 
The Out Campaign: Scarlet Letter of Atheism