Monday, 28 April 2008

Kharne in the old days - some reflections

Even now, after all these years, I'm still somewhat proud of Kharne. Though it has many faults. The final publicly released version was 0.13b (or 0.13c according to the included help file), which was probably going to be the last beta version before the introduction of a magic system. Kharne was based upon AD&D 2nd edition rules, and I recall that implementing the AD&D magic system was extremely difficult.

Leaving aside the internals (more of which in later on), the immediate thing that leaps up when running the game is that the UI is.....idiosyncratic. I'm not sure what hallucinogens I was on when I decided on the colour scheme. It is more of a CRPG UI than a Roguelike UI. It reminds me of the early Ultimas, or the old 8-bit adventure game Times of Lore:


This resemblance was more than deliberate. Back in 2001-2002, I was very hostile to ASCII graphics, and many of the other features of traditional Roguelike games, such as keyboard input, permadeath and so on - I think this was because my main exposure to Roguelikes was through Angband, and especially AngbandTk, which could use mouse input and had tiled graphics and were easily cheated. Now of course, after almost another decade of playing Roguelikes (I still haven't beaten either Crawl or Angband), I find my preference is for ASCII graphics and keyboard input.

But most of all, I now feel that Kharne reeks of bloat. We're all familiar with software bloat (well, most of us who use a Microsoft operating system), and if there is one thing that Roguelikes traditionally are anathema to, is bloat. The bloat in Kharne manifested itself in ridiculous memory and storage requirements (because levels weren't compressed upon saving, saved games took up over 10 MB each). Again, now, looking back, with reflection, I also admit that it also fails the UI test - mice can be too clumsy an input method for a Roguelike game.



The biggest stink at the time though was over permadeath. Kharne eschewed the trend of just about every Roguelike known to man and beast and didn't have it, having the traditional CRPG of saving and loading. Sure, I remember adding it into a later version as an option (akin somewhat to Ironman mode in Angband), but death in Kharne was superfluous. And it suffered for it - the game balance was non-existent, and reinforced a CRPG mindset in something that shouldn't have been a CRPG.

This post isn't all a mea-culpa though. It was an accomplishment, and I learned a great deal about programming Delphi from it. As I mentioned in my previous post, Kharne helped me switch careers from C++ to Delphi, and I vividly remember demonstrating the game and some of the concepts behind it during the interviews concerned. Despite the presence of gems such as this in the code (kudos to anyone who spots the mistake in the following snippet):


rollneeded:=MyMonsters[thismonster.monstertype].monsterthaco-acused;
if (playerarmour='banded mail ') then
inc(rollneeded,0);
if (playerarmour='brigandine armour') then
inc(rollneeded,1);
if (playerarmour='chain mail') then
inc(rollneeded,0);
if (playerarmour='field plate') then
inc(rollneeded,1);
if (playerarmour='full plate') then
inc(rollneeded,3);
if (playerarmour='leather armour') then
dec(rollneeded,2);
if (playerarmour='plate mail') then
inc(rollneeded,0);
if (playerarmour='ring mail') then
inc(rollneeded,1);
if (playerarmour='scale mail') then
inc(rollneeded,1);
if (playerarmour='splint mail') then
inc(rollneeded,1);
if (playerarmour='studded leather') then

inc(rollneeded,1);

So, all-in-all, the old Kharne, whilst it undoubtedly gave some people at least a fleeting pleasure, was ripe for a recode and a rewrite, if only for something else to show during any future interviews. And so, here we are, 6 years or so after the previous attempt, with a brand new version of Kharne. It is now written in Delphi 7 (the original used Delphi 4), and will conform much more to traditional Roguelike strictures. Hopefully this time I will finish it and produce something that people will wish to play. And to whet your appetites, here is a screen capture of the current development build of the new Kharne:

4 comments:

The Wicked Flea said...

Your error, aside from the whole code design there ;), was a space in the name of the first armor type. However it wouldn't alter play any, as there'd still be no incrementation of the accuracy.

I'm glad to see that you still use Delphi. Kudos from one Delphi/Object Pascal developer to you.

Dave said...

Thanks. It was rather symptomatic of the code as a whole though. You should have seen the rest of that particular routine. Hundreds of lines of stuff that would qualify for a feature article on TheDailyWTF.com. I look back and almost shudder sometimes *grins*.

And yes, Delphi is still the bees knees for Win32 development, isn't it?

The Wicked Flea said...

Man, oh man, I think we've all been there. I look all the way back and cringe sometimes! :D

I recently wrote an adaptable archive format, and couldn't read the records from the file. So I looked twice and realized, I read the array size of the record without multiplying by the count. Still happens! *laughs*


Delphi sure is the model for Win32 development. I remember the first time I tried installing VC6 and trying to figure out how to design an application. I'd used Delphi for years before that, but never could wrap my head around their obfuscated MVC pattern. I kept scratching my head and wondering where all the forms were!

The latest development version of Lazarus is coming close, though the debugger and deployment size still need work.


My only complaint with Delphi is that I have the Turbo edition, the free copy, and its stability within the IDE is less than stellar.

Dave said...

Hmmm...ideally, I'd eventually like to be in a position where Kharne would compile equally on both Delphi and Lazarus/FreePascal. However, I use a few custom components and I can certainly forsee having issues with transferring some of them into Lazarus.