31 August 2010

Map

Like many games, King of Dragon Pass has a map that’s gradually revealed as you explore. Since your ancestors originally lived in Dragon Pass, you have a rough idea of what’s there. The modern map is superimposed atop the historic one. For simplicity, the map is divided into hexagons, and an entire hex is either known (explored) or unknown (historic memory).

Drawing the map was fairly different for the Mac and Windows versions, and pretty much none of the old code that drew hexes could be used. So until now, I’d just been using the historic map as a placeholder.

I’ve now implemented the hex drawing. The game no longer draws individual pixels — even the iPhone has a graphics accelerator. Instead, it creates a mask, and lets the graphics system draw.

Performance seems adequate on an iPod touch, but I plan to come back and optimize if I can (iOS has some excellent performance analysis tools).

One thing that got dropped in the original version was zooming of the map. (I think it may have been partially implemented for Mac only.) But zooming is basically free in iOS. So here’s how much of the entire map you know at the start of the game. Note the scale changes as you pinch-zoom. (You can also double-tap to zoom in or out.)

1 comment: