Archive for May, 2009

Crosshairs

May 24, 2009

Finally, after a lot of internal changes, you can tell if a unit can be attacked by holding the mouse pointer over it. A red crosshair will appear over it until you move the pointer away again. Here is a screenshot:
screenshot-090524-1

The mouse pointer doesn’t appear in the screenshot for some reason, but I was holding it over the crosshair. The selected unit is indicated by a sharp border around its hexagon, and the hexes it can move to are highlighted, just like before. The tank isn’t really supposed to be able to cross the strait in one turn, but I haven’t yet bothered to update the terrain graph completely after I made changes to the hex grid.

Another change that can be seen in the screenshot is an anti-aircraft unit, near Copenhagen. I haven’t written any code for it yet though, so it behaves like a tank :)

To accommodate the crosshair functionality I wrote a simple quadtree implementation which can map mouse clicks to scene graph nodes quickly. The new code is about 700 times faster than the old one, which searched through the entire scene graph including terrain and all. Working at this made me realize a lot of things about scene graphs and how they should interact with other parts, which will probably help when I set out to speed things up later. Currently there’s an annoying lag when you do many things that require updating the window, because I redraw too much stuff.

A Year has Passed

May 1, 2009

It has been a year since I posted the first screenshot (on another blog), which is the earliest recorded sign of activity on the game. I can not say exactly when I started, but it seems I have been working on it for about a year now. I have been pretty serious about the game since my vacation last July, much of which I spent coding. That was when the tinkering transformed into an attempt to write a complete game–a product.

Here is the old screenshot along with a fresh one for comparison (click for full size). I’ve come a long way since then.

screenshot-11

screenshot-090501

I have fixed many bugs and shortcomings in the SVG parser recently. Editing the graphics is now much more comfortable, since you can use more SVG features and don’t have to trick Inkscape out of using previously unsupported features such as transformation matrices.

The source code is now 6435 lines, of which 3983 lines are C++. The rest is Scheme code. The count includes comments and blank lines, but not header files. There’s some dead code too that could be deleted, but not much.