Share via


Unleash the power of .NetHack!

In the beginning there was Rogue (https://en.wikipedia.org/wiki/Rogue_(computer_game)), then Hack (https://en.wikipedia.org/wiki/Hack_(computer_game)), and then a networked-king-daddy-of-all-text-based-RPGs NetHack (https://en.wikipedia.org/wiki/NetHack).  An idea I have had in the back of my mind for quite some time was to make a NetHack clone taking advantage of .Net; and I don't mean just a managed version of NetHack - I mean using every awesome feature/language concept/tool in the book to make the most robust NetHack clone every in a fraction of the time it would take in C.

Well, like all grandious projects it has sat in the back of my mind for quite some time atrophying; until now.  I saw that some folks were putting together a managed NetHack-like game in VB.Net over at https://www.heroicadventure.com/.  Very cool stuff. 

So I'd like to throw out some of the ideas I had for developing a .NetHack (dot-NetHack) like game, but not just any old clone.  A clone which takes full advantage of the power and flexability of .Net. 

For starters, here are two gems on how you can leverage the type system to quickly get behaviours out of objects without a lot of code.

Using 'is' and 'as'
if (randomThing is IDrinkable)
(randomThing as IDrinkable).Drink(this);
else
Console.WriteLine("You can't drink that cowboy.");

Attributes for declarative functionality
void PlacedInAFire(DNHObject thing)
{
If (thing.GetType().HasAttribute(Flamable))
{
thing.Destroy();
Console.Writeline(thing.Name + "caught on fire.");
}
else
Console.WriteLine("It got warm, but nothing else hapened.");
}

I'll elaborate on both of those more in the future.  Here are some other things things which you can expect later:

  • Abusing Windows Communication Foundation for networked play
  • Localizing text and storing data in Resource (.resx) files 
  • How to use LINQ and XLINQ to do your bidding
  • Abusing the Visual Studio Class Designer for rapid development
  • Abusing Visual Studio Team System for unit testing
  • Harnessing the most powerful weapon the CLR has to offer: System.Reflection.Emit.  You have been warned ;)

If you have any ideas on neat .Net features to leverage and write about let me know.

Comments

  • Anonymous
    October 08, 2006
    The comment has been removed

  • Anonymous
    October 10, 2006
    Good idea, I'll be sure to mention how to do 'plugable' architectures in .Net in the future.

  • Anonymous
    October 16, 2006
    horrible... :( nethack and .net ? ugh...