Thursday, 25 September 2008


My apologies if this blog has been a little bit quiet as of late. I'm in the process of refactoring a large amount of code: in fact, I'm in the middle of one of those big ugly patches that are impossible to land unless you are the only developer working on a particular branch. Luckily for me, this is the Unangband trunk.

I've got a mixed view of refactoring: I don't normally do it, unless I can transform code into data. In this particular instance, I'm part way through moving information about all the monster and spell blows out into an external file, which to date I have been calling blows.txt, but which I am likely to rename methods.txt (to avoid confusion with the individual monster and spell blow structures). This file is the UnAngband library of shapes that I was talking about in part ten of the Designing a Magic System series of articles, and which I will expand on more in the Unangband Edit Files series of articles.

UnAngband over time has grown into a large loosely held together patchwork of code, which has a solid core, but plenty of exceptions. The solid core, for the most part, is held together by the edit files, and the logic to implement these edit files, and the exceptions grow in the code and periodically get shorn into the edit files, usually by adding a flag to note the particular exception.

I think there's light at the end of the tunnel for this development work, but its going to take me a bit longer to finish than I expected.


Unknown said...

Being a Lazy bastard and not wanting to code-dive, how much of the core game code (as opposed to interface code and the like, which I assume remains relatively unscathed) remains from Vanilla Angband?

Mikolaj said...

Interface is hacked too, sometimes a lot, e.g. 2 modes of main screen layout or the Windows port. About the Vanillia code left: some is from 10 years ago, some if a month old. :) No idea how many screenfuls of code are untouched, but from a practical point of view (e.g. merging patches from V) it does not really matter. A wild guess would be one quarter of screenfulls of code is verbatim from old V. UnAndrew?

Mikolaj said...

Oh, and I'd guess one tenth of the core you were speaking about.

Andrew Doull said...

Really hard to say. Its 100% inspired by Angband, of course. I think 20-25% is about right... excluding the edit files, of course.