Forum:Getting into the Nethack source code

From NetHackWiki
Jump to navigation Jump to search


SO: as the title says, I have just recently begun delving into the Nethack source code, and I must say it has been at once a very confusing and yet exceedingly interesting process. I have a little bit of past experience messing around with Python, and I can (mostly) read C (which is what most of Nethack is written in) but when it comes to making changes or adding items, which is exactly what I want to do, I mostly have no idea what I'm doing. :3

Before someone says this, I know full well that Nethack is NOT a very good first project to work on as a learn-by-doing coding experiment. I am painfully aware that the Nethack source code is the result of many years of jerry-rigged additions and modifications, that most of the code that is written is highly convoluted and make references to bits of code in a billion other places, and that the whole thing, even to an experienced programmer, is rather daunting. Be that as it may, however, this is what I've chosen to (hopefully) learn a thing or two from, and so I hope to get as much help with that as I can get. :D

So, that being said, what I'm looking for is someone who either knows a thing or two about the code and would be willing to put up with my insufferable n00bishness long enough to teach it to me, or a link to another forum/nethack community with someone who does. Any takers? OverWilliam 20:29, 13 May 2009 (UTC)

Hacking NetHack is how I learnt C (and lex and yacc). Good luck! Your best bet might be joining a #NetHack IRC channel so you can talk about things in realtime. Also, there is an old, out-of-date document on how to change the NetHack code here. I wrote a short tutorial on how to add a new special room. You also should take a look on how other people have coded patches; you can download most from the Patch Database --paxed 06:15, 14 May 2009 (UTC)
Thanks! This is a bit of a collaborative effort between myself and my younger brother (between the two of us we have actually ascended once, but he gets most of the credit ;P). I expect to be doing most of the work, but he is going to be my sounding board/test player, and has a lot of crazy ideas to complement my own. That guide is EXACTLY what I was looking for...!!! I have already found the various arrays for objects and mons and the like, but I couldn't figure out from the raw code what each variable did or how to change them in a way that does what I want them to do. Just with a quick scan across that page, it looks like he does a really thorough job of explaining what each element does, and that's just what I need (for now). I'm sure that will bottom out as a resource eventually, but maybe I can add an item or two to an actual running program with the information that's there. Thank you so much! I actually hadn't thought of an IRC channel, I'm going to have to look into that and see if I can find a good one. Thanks again for the advice! OverWilliam 14:28, 14 May 2009 (UTC)
I don't think an IRC channel is an ideal place for code-related questions. Questions about one liners might work, but everything else is a bit hairy (especially in #nethack where you'd likely to drown in the messages and I don't know about another channel that could be called nethack-dev-related). I'd suggest posting to rec.games.roguelike.nethack (that has the added benefit that it gets archived for others to learn). --bhaak 10:55, 14 May 2009 (UTC)
Of course you shouldn't paste dozens of lines; you use pastebin or similar, and just give the link to that. But you're right, RGRN would be better. --62.148.102.64 11:38, 14 May 2009 (UTC)