Mon, 06 Feb 2006

Wesnoth hacking

So I am now a Wesnoth developer. So far I've been fixing bug and making minor changes: it's fun, and *so* easy to work on after the kernel. You can reproduce bug reports, then run the whole thing under gdb!

One interesting project was to try to get an improved attack result prediction, initially for defensive weapon selection. This proves to be an interesting problem. So interesting I included a simple version of it as question 2 of the LCA hackfest.

The initial code, with comments, can be found here. One contestant caused it to run twice as fast, but being IBMers, they were eliminated. Noone else made significant improvements; it was quite depressing to see what people thought would optimize the code 8(

The algorithm itself can be improved significantly by realizing that we needn't keep the entire matrix, merely the probability distributions of each unit at every point the combat could end. Summing these independent (and exhaustive) outcomes will give the correct results. I would estimate a 10x speedup doing this, although I haven't completed a working variation (it was my initial version, but the matrix solution was easier to debug).

[/tech] permanent link