Wednesday, 30 April 2008

Thoughts on Permadeath

"You must pay for your mistakes and choices, sometimes at the cost of life. Restoring games is discouraged and only provided to allow continuing split games." - Roguetemple on Permadeath

As previously mentioned, one of the differences in this version of Kharne is that the game wil be balanced around the implementation of permadeath. However, I do want to extend to the player the possibility of getting around permadeath. Not as a buffer for gross stupidity (the penalty for that in a Roguelike should always be death) but rather as reward for additional preparation and careful play.

So what could be implemented that wouldn't be overpowered? Roguebasin lists many alternatives, but there are a few in particular I think could be easily implemented in Kharne. The first are powerful necromantic magical spells would give the player a chance of ressurecting. Of course, there would be a heavy price to pay for such twisting of fate (perhaps coming back as an undead, which would be a whole different game experience). Another is a powerful artifact (which should be unique, albeit randomly found) that allows a single resurrection under certain circumstances. Again, there should be a penalty associated with use.

What I haven't mentioned is resurrection by deity. The original Kharne had a half-implemented (and -arsed) deity system. Although I've not played it, the roguelike Incursion appears to have a textbook resurrection by deity system:

"...in Incursion...The basic theory is that if you're in good standing with your diety, he can ressurect you if you die, but (A) some of the gods don't do this, while others do it only at varying levels of favor, (B) you lose an experience level as well as a point of Constitution when you get raised, and move back to the start of the dungeon (or the local temple, when I get wilderness levels done), (C) you need to attain a certain minimum character level before being raised and (D) you have a ressurection survival chance that is nearly certain the first time, and grows worse and worse with each death -- so it's only "certain" the first time."

I'm not convinced about this, but perhaps if deities are implemented in the new Kharne, this sort of system might be worth considering. What do you think?

Tuesday, 29 April 2008

Things from Roguelikes that would be useful in real-life #1: "Cotton Socks of Ooze Slaying"

I was playing about with item generation code earlier, and I found this unexpected item, which appears to particularly useful in case our brave little '@' is ever attacked by giant mutant verrucas or something :



This is an artifact of the way items will be generated in Kharne. Just like in MMORPGs, there are different "quality levels" of items, from Junk Items such as broken dolls that are there mainly for flavour through Common items like your standard short sword, through increasing powerful magical items all the way up to Epic and Artifact Items. Magical items have got certain "enchantments" placed upon them, and these enchantments are (in most cases) randomly generated. In the above case, the socks have two enchants on them - one of increasing AC (which worn items tend to have), and increased damage against oozes(!). The code at the bottom, "]27ENCH_ACENCH_SLAYOOZE" is used as a unique identifier for stacking purposes.

Does anyone else have any examples of similar useful items?

(incidentally, the above screenshot shows the current state of the inventory screen with graphics turned ON. At the moment I'm aware it breaks one of the rules in my previous posting - that of keyboard and mouse equivalence -being heavily drag-and-drop based; any released version will have much better keyboard control functionality, of course)

Some aims and assumptions

Before I go into detail on the rewrite progress, I want to lay out a few important points about the rewrite.

  • Graphics will not be important. In my previous post, I mentioned the reasons why the original Kharne used tile-based. However, in the intervening years, I’ve come to appreciate the use of ASCII in roguelikes. Most of this perhaps is due to obsessively playing (and dying) in ASCII roguelikes like Crawl. But even when both are available, for example in Paprika, I tend to nowadays prefer ASCII. Perhaps Tomas Biskup (the creator of ADOM) had it right after all:

    "...most roguelike games do not use any graphics but rather rely on the ASCII character set to display their surroundings. While this might sound horrible to you, you will be surprised how quickly you start to enjoy this "primitive" type of display. Your imagination quickly will take over and you'll no longer miss those ugly hand-drawn graphical tiles that do not resemble your picture of a dragon at all. But in your imagination, that blue D will soon become the most horrible and frightening ice wyrm you can imagine. Try it out. You won't be disappointed. "

    I do recognise however that some people find tile graphics preferable (to say this is a contentious issue would be quite an understatement), so therefore the rewritten Kharne will support both ASCII and Tile Graphics, with full equivalence between them. But for now however, ASCII graphics will be the focus of development (though tiles can and will be plugged in very easily). I need to concentrate on getting things done, not drawing pretty pictures.

  • Using the mouse and using the keyboard should be equivalent. One of the most powerful features of Roguelikes is their interface – its often quicker to use the keyboard to do something than to use the mouse. On the flipside of this, the converse can be true as well. Since Kharne is designed to run natively on Win32 OSes, both methods of input will be supported.

  • Yes, Kharne will still be Win32-based. I do not have a Linux-based machine, and Delphi is currently Windows-only development. I am open to it being ported to Linux via Lazarus in the future, but for now, I think it is more important that the first version gets written, never mind any ports. Use of Delphi also allows me to use a modern windowed GUI environment where I think it will enhance the game.

  • The gameplay of Kharne will be balanced around permadeath. Yes, its bloody annoying when all your hard work ends in nowt and you make a stupid mistake, but we all restart the game almost immediately, learning something (hopefully) from the death. Even though it is now a common meme (and possibly even the truth) that the implementation of permadeath on Rogue was driven mainly by technical considerations and not for reasons of gameplay, permadeath in a roguelike does actually make sense, if the gameplay is indeed balanced for it.
  • Kharne will be easily extendible and customizable. I will not however, use the Angband model and use edit files. Rather, where feasible, Kharne’s data will be held in an SQLite database. SQLite is a rather remarkable free portable single-user database in the public domain that requires only the distribution of a 200k DLL file along with your code. SQLite databases are also absurdly easy to edit, using one of many freely available tools. Using an RDMS moves the storage of data away from the “flat” structure of info files into something resembling their true meaning (you can probably tell I’m a database programmer by trade at this point).

  • The source code of Kharne will eventually be released under the LGPL or similar license (I’m restricted from using the GPL because I use some closed-source (albeit freeware) custom components). Not for a few versions though.

I intend my next post to lay out progress so far, with quite a few screenshots. I hope to have these up in the next few days, real-life permitting.

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:

In the beginning...

The first post in a blog is usually meant to be something profound, something dramatic that explains the need for a stream of consciousness that I'm about to write and you're about to read (hopefully). This post is no different, for I'm going to tell you a little story about a game called Kharne.

Kharne (or to give it its full title "Kharne: The Relevation"- I was going through a pretentious phase at the time) was an abortive Graphic GUI-based Roguelike game I wrote in Borland Delphi back around the turn of the millenium. It was originally intended as a stepping stone to get me from writing C++ in a commercial context to a job writing Delphi. It actually succeeded in that respect - I've been involved in Delphi Development as a job for the last 7 years or so, albeit mainly in the fields of data analysis and warehousing.

But the game was never finished. People who code things for a living know that finishing things and getting things done are the bane of both software development and software developers, and actually getting employment using Delphi during the working day drained what little motivation I had left to finish off Kharne. To be honest, looking back now, with the benefit of the clarity of hindsight, the fact that the code was...shall we say, sub-optimal, and I was going through an extremely difficult time in my personal life also contributed to a general malaise. But despite this, Kharne was fully functioning, if you left out the fact that magic wasn't actually implemented. A big if, though, for a fantasy roguelike.

Despite this, and despite many adverse issues (such as the final boss being bugged and undefeatable), Kharne actually got quite a few downloads and a lot of play. There was even a suggestion of a rewrite a few years ago, but one other thing got in the way big time: a great hulking obstacle called World of Warcraft. Now, MMORPGs are probably, on the greater balance of things, a bad thing for many people, myself included. I'm firmly of the opinion that they suck out individual creativity and energy, to an unacceptable degree. Having said that, personally, I no longer play World of Warcraft, and so, here I am, in 2008, rewriting Kharne, having got the buzz for coding back. Back in 2001 I couldn't have envisaged this happening. But that's true for many things in life.

Strictly speaking, "rewrite" is the wrong word to use. I've already rewritten some of the engine and internal datahanding routines (very, very little is, or will be reused from the original game for reasons that will become clear soon). The original announcement of the commencement of the rewrite occured last October on rec.games.roguelike.development, but due to personal circumstances, the last few months have been too busy to get any coding done. So now, with the establishment of this blog, this is the offical announcement of the recommencement of the rewrite.

The purpose of this diary is to keep the reader updated with progress, to discuss various aspects of roguelike development, and to solicit in-progress feedback on Kharne as it develops. I'm aware it will be a pale imitation of probably the best roguelike development blog out there, ASCII Dreams, but blogging isn't a zero-sum endeavour. I have a Roguelike to sell (or rather give away) to you, the reader.

In the next few posts, I'll discuss the original Kharne, how my views of Roguelikes have changed over the years, the issues that arise from recoding a roguelike, and anything else of interest. When I release the first playable betas, they'll also be announced here first. Your comments are appreciated and most welcome. If you don't want to comment here, you can email me at starbog@gmail.com