In the beginning there was Rogue (http://en.wikipedia.org/wiki/Rogue_(computer_game)), then Hack (http://en.wikipedia.org/wiki/Hack_(computer_game)), and then a networked-king-daddy-of-all-text-based-RPGs NetHack (http://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 http://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);
Console.WriteLine("You can't drink that cowboy.");
Attributes for declarative functionality
void PlacedInAFire(DNHObject thing)
Console.Writeline(thing.Name + "caught on fire.");
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.