## Gong Worthy Game: Update 4

June 18, 2015## The Art of Drawing Hexagons

How hard is it to draw a 6 sided regular polygon? Easy. How hard is it to draw a *lot* of them? Slightly harder because now you have to think about interactions. Thankfully I have some excellent notes to use for my implementation which were recommended by Greg Raiz himself while I was talking about the design of the game during a past hack day.

Technically speaking, drawing one hexagon for the hex grid looks a lot like drawing a circle very very badly. Instead of drawing nearly infinite sides or curves, just connect a point every 60 degrees. This does make one thing obvious, all of my calculations should be calculated based on the radius of the hexagon, as it makes a lot of the calculations more straightforward.

The tricky part is that because I’m drawing a very bad circle, a lot of the other math doesn’t line up. The width of a pointy-topped hexagon is less than the radius because I’m chopping off the edge of the circle. This means when placing hexes horizontally I need to account for those, and when stacking rows of pointy-topped hexagons, I need to account for the fact that they’re nested within the divots on the bottom of the preceding row. I found a wonderfully succinct diagram of what the relations are between all of those sizes, and I’ve borrowed from those models to create the helper functions that will do all of that math for me in my model code so that the complex geometry is all stashed in one place.

The only thing that may be a very interesting challenge is that once I have tappable prototype, I may want to experiment with adding a slight isometric projection to the field of play. I may change the dimensions of everything to accomplish this, or it may be a purely artistic flourish on the hex cells themselves.