Wednesday, February 6, 2013

time to make a nethack variant

As an avid fan and player of nethack and its variants, I've always been struck with ideas for additions/changes to the game while playing.  As a C programmer, it only made sense to make my own nethack variant.

My posts will contain my thoughts about game play as well as my thoughts about the code.  Some posts will be geared more towards general game play concepts and brainstorming, such as thoughts for new roles or races.  Some posts will be geared more towards game specifics, such as racial stats, role abilities, probabilities of succeeding at various tasks.  Finally, some posts _may_ end up being geared towards coding, such as monster struct consolidation, the use of function pointer lists for special attacks, and the beauties of C type declarations.  Even if you don't care about the code stuff, all posts will be geared towards nethack, so feel free to comment on, question about, or suggest anything.

I'll be using the slashem source code as a base for my project, however, I plan on adding features from several different variants (such as sporkhack and unnethack), other patches (color alchemy, hpmon) and new features of my own.  At the end of all this, and potentially throughout development, I will, of course, make the source code available for y'all to test.  In addition, I will also make pkg.tar.gz and .tgz files available for easy installation on Arch Linux and FreeBSD, respectively.  Most of my testing will be done on Arch Linux (if you think ascending a Tourist is hard, try building nethack from source on an Ubuntu or Mint box).  I will also be compiling with gcc, and _maybe_ LLVM on BSD, so hopefully using the two different compilers will catch any mistakes I make relating to compiler specific extensions, like branch prediction (which is fun but generally not needed for a turn-based, user-land game) or other code that doesn't fit the old C89 standard.



As this is the first blog entry, I will lay out my big-picture plans and *try* to leave the details for future posts.  Keep in mind, a lot of this is still in the brainstorming phase.

1) Re-write/re-structure large parts of the game engine.

First, I will split the code into two modules.  The first module will handle game play.  I will replace all closures with their equivalent trigraphs, then implement the entire game in a single function using only pre-processor macros.  All control flow will be handled with goto's.  The second module will parse the data files, and will be written entirely in perl keywords.

All kidding aside, the slashem code is pretty kludgy.  Then again, I'm used to kernel programming, where we like to keep things robust and concise instead of adding lots of complicated conditionals for specific situations, of which there are many in slashem.  That said, I do not see any reason why the 'hit monster' function has to be 1000 lines of nested if and switch blocks.

Basically, I want to make the code more generic.

For example, there are three different source files for hitting things: monsters hitting you (mhitu.c), you hitting monsters (uhitm.c), and monsters hitting monsters (mhitm.c).  There is also a file for monsters throwing items at you (mthrowu.c), and you throwing items at monsters (dothrow.c).  (Can you guess which file contains the code for monsters throwing at monsters?)


2) Religion.

Alignment will play a bigger role in things, from first sacrifice artifacts to different codes of conduct.  Similar to sporkhack, sacrifice gifts are not guaranteed to be artifacts, and the probability with which you receive an artifact gift from a sacrifice will be based on xp level.


3) Add new stuff (below are just some examples).

3a) New Races.

Kobold strikes me as a reasonable starting race.  They would have a racial technique at first level, "Poison", that poisons inventory objects such as darts or other projectiles.

Mindflayer is another race I'm considering.  They would probably resemble Vampires in slashem, i.e., start with a penalty (either slow, or negative luck) and they would have a bite attack, but they wouldn't fly and would have better Int and Wis stats.

3b) New Roles.

Soldier: the game has guns, why not have a soldier role?  They would be able to attain "expert" in firearm proficiency, among other weapons.  The quest artifact, of course, would be The Holy Hand Grenade.  More details on this in a future post.

Jedi: slashem has lightsabers, so of course, someone already made a Jedi patch.  I had some issues with it, so I improved (according to me, at least) on the Jedi role substantially.  I'll have a more detailed post about this in the future, and I'll make the patch available when I'm happy with it.

Psion: this one is my real brain child.  I'm saving the details for a future post(s), but let's just say that brainstorming for the Psion role has been a driving force behind other changes I want to make to the game that will affect all roles (quick teaser: a system for throwing, and being thrown by, monsters).


3c) New Monsters.

Probably some monsters from the biodiversity patch and Gold Dragons from sporkhack, to name a few.


3d) New Items.

Definitely going to include the "bag of poo" from sporkhack.  I also like sporkhack's magic staff system.  Also, why not add things like Gauntlets of Offense, spellbooks of probing, and wands of wonder?  Nethack and its variants make references to various parts of geek culture, but they all left out one of the greatest roguelikes of all time: Toe Jame & Earl.  Rocket Skates anyone?  I envision them as being generated cursed most of the time, providing a faster movement rate than boots of speed, while forcing you to run (as if holding down the shift key when moving).


4) Interface.

No real changes here.  I've seen screenshots of the inventory window patch, and other similar layout patches, but I've never tried them.  Honestly, I think they are a great idea, but I'm not going to include them because I feel that the game should be able to fit in a standard 80x24 console.

4 comments:

  1. Awesome! In addition to porting in the Convict patch, you may want to consider looking at the Bard patch and seeing if you can't make some improvements to that as well. Two other ideas I've had that I'd love to see tried are a Beastmaster (like a combo of caveman/ranger but can tame monsters and ride bareback), and a Cowboy (tough early game like Tourist, but starts with a pistol, lasso, and horse).

    ReplyDelete
  2. Thanks for the comment!

    I've heard of the Bard patch but haven't checked out the source. I remember someone commented about it on the patch database saying it'd be nice if Music was it's own system separate from Magic and I really like that idea. I mean, why should the castle drawbridge tune be the only song in the game? All in all, good idea, I'll have to check that out.

    My thoughts on the Beastmaster: I think some of your ideas can be incorporated into the Yeoman role from slashem. Currently, there is a "calm steed" technique that, according to the source, isn't really implemented. It seems like it's set up to allow a Yeoman to saddle an untame monster (which is possible in both slashem and nethack), ride the monster, then use the tech to tame the steed. Unfortunately, in both nethack and slashem, it's impossible to mount a non-tame steed, so maybe that should change. As for riding bare-backed, as someone who's dealt with carrying a saddle all the way down to the castle unti I could wish for a Ki-rin, I know saddles are a pain... but for now my thought is that it should be a pain to have a mount.

    Cowboy is an interesting idea. It sounds sort of like a mix between a rogue and archeologist that is good at riding. A lasso could be equivalent to a light-weight grappling hook xor a whip.

    ReplyDelete
  3. Why SLASH'EM as start? It is unbalanced heap of everything, I would think that SporkHack/UnNetHack would be better start.

    ReplyDelete
  4. I started with slashem because I thought it would mean it would save me time adding features, but now that I've gotten into the code, it's an unbalanced heap of everything. I downloaded unnethack the other day and will check it out. I've played a little sporkhack and I really like a lot of the features.

    ReplyDelete