Showing posts with label Reflections. Show all posts
Showing posts with label Reflections. Show all posts

Friday, 22 May 2009

r.g.r.d. Roundup #2

Another entry in the occasional series of some of the best recent threads from rec.games.roguelike.development:
  1. "Savefile Design" One of the best threads I've ever seen on r.g.r.d. this thread discusses in detail a subject that is both close to and swinging ominiously over my heart - save files. I'm not implemented them in Kharne yet because in Delphi, serialisation is an utter pain, and I'm saving the worst to last, as it were. I suspect that implementing saving and loading will result in no-small degree of refactoring, when the time comes.
  2. "On AI - ~The best systems". The AI in Kharne is currently very primitive. I had started writing a much more realistic AI for Prelude, but until I recover from the current Assignment Fever, I won't be doing any porting of ideas across into Kharne. For my money though, the best explained treatment of AI in a roguelike game is still the Angband 4th Generation AI.
  3. "SOL Pics". This new roguelike is already a contender for the most beautful looking ASCII roguelike ever, despite only a few screens being completed. I hope the rest of the game (when done) lives up to what we've seen so far.
Roguetemple has also been a hotbed of activity recently, and the recent mention of Quickband reminds me that I've never played it (at all). Might just be the thing to keep me sane during the next few weeks.

Monday, 4 May 2009

Refactoring Madness

I know what Krice is going through...some days it seems like most of the code I've written is utter garbage. Its not as bad as that, and it won't need doing what Netscape famously did (with disasterous results), but I do sometimes wonder, late at night/in the wee small hours/during the long dark tea time of the soul, what I was smoking when I wrote a particular chunk of code...

The main problems I've got with a lot of my current code are what Joel Spolsky refers to in the article above as "architectural problems":
First, there are architectural problems. The code is not factored correctly. The networking code is popping up its own dialog boxes from the middle of nowhere; this should have been handled in the UI code. These problems can be solved, one at a time, by carefully moving code, refactoring, changing interfaces. They can be done by one programmer working carefully and checking in his changes all at once, so that nobody else is disrupted
I'll give you an example of something that was a pain in the arse to fix but when fixed has really added value to the code. Previously (before 0.02b), the function to output text to the message log at the bottom of the screen took two parameters as input:
  • the text to add (as a string)
  • the colour to display it in (as a TColor).
As I'm only human, the natural result of this was that the colours were inconsistently used - a message in one section of the code for would be a different colour to a message resulting from another section of the code even though both messages were used for the same purpose.

Of course, with hindsight, the correct way to handle this is obvious - now, instead of a colour, a message type is passed in, which happens to be a enumerated TColor type, e.g. all messages that refer to killing enemies now are passed in with the second parameter of 'mesPlayerKill' which evaulates to the colour Orange.

Simple, yet the correct solution eluded me the first time.

Now imagine this multiplied by a factor of 50 and this is the task ahead of me (and most other roguelike developers it seems)

Are we masochists or perfectionists? You choose.

Wednesday, 14 January 2009

r.g.r.d. Roundup #1

Years ago (we're talking almost a decade ago), in a former incarnation, I didn't have a very good view of rec.games.roguelike.development - it seemed too elitist, too wed in the one true way of C. Part of that was my own fault, and yet it has changed remarkably over the years, and it seems every day now there are excellent threads on many aspects of programming roguelikes.

So, in the absence of my perceptible progress on my own creation, I'll be regularly rounding up some of the most notable (not necessarily the best) recent threads from the newsgroup here and giving my own two-penneth worth.
  1. "Keep it simple, stupid". For me, the pertinent post was made in this thread by copx regarding rewrites of Roguelikes. The KISS principle has particular meaning for myself - as I've said before was one of the main reasons the original version of Kharne failed. Although I suspect it won't happen due to the developers seemingly having their heads screwed on correctly, am I alone in thinking that Crawl Stone Soup is heading down the same road as Crawl v4.1 and in danger of becoming an (unintentional) overcomplicated mess? Who rewrites the rewriters?
  2. "Intriguing new Line Of Sight algorithm". Why oh why oh why oh why? New FOV algorithms may be interesting from a purely academic point of view (in the same way is probably fun to recalculate the Chandrasekhar limit for White Dwarves from basic physical laws), but do any roguelikes actually use any of these wonderful and new esoteric algorithms?
  3. "The Rogue Bard unveiling". Free music for Roguelikes. I've listened to some of these and they're excellent. However, whilst I have vague ideas of including a music engine in some distanct completed version of Kharne, I would not include any music along with the distribution. Music is, to me, too personal a thing for it to work with a Roguelike out of the box (although the idea of exploring a dungeon to the sounds of The Place Where The Black Stars Hang by Lustmord is somewhat appealing).
  4. "Crawl YASD - guillotined for no reason & orcs in Lair". Alright, this is a refugee from rec.games.roguelike.misc. But it illustrates simultaneously how evil and how excellent Crawl currently is. Crawl Stone Soup seems to be the roguelike to aim for at the moment, and this is a complement to the developers. It would be a real shame if it jumped the shark.
There have been a few other threads on items, item functionality and attributes which have also been of great interest, but since I intend my next few posts to be on this subject, I won't mention them any further at this point other than to say....go read them!

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: