What do I need to learn for a zork clone in C#

Started by
4 comments, last by lotlat 11 years, 10 months ago
Hello, this is my first post ever on the forum. I'd like to know what I'd first need to know to create a zork-like game in C#. I am an absolute beginner at C# programming but I do know some commands here and there. What kinds of commands would I need to learn to make a game like that, preferably in a book? I already know how to make those simple 1 2 3 option text adventures since it only uses the case break etc. commands. I don't feel like going into graphical gaming just yet, and if I do, I only want to stay 2D.
Advertisement
I don't want to disuade you (and perhaps I'm misunderstanding your goal), but Zork-like games (traditionally called interactive fiction, or text adventures) can get very complex. This is due to the rather complex world models involved, and the parser itself.

That said, you can throw together a very simplified type of IF parser by limiting commands to Verb + Noun (or just Verb). If doing this, I doubt you would need a "real" parser, just a series of switch cases. Adding a large number of verbs, or allowing more flexible input, will quickly render this approach infeasible, however.

If you are just beginning (which it sounds like), try putting together a simple three room adventure, where each room has a description, and allow movement between them by checking for cardinal direction commands. Later you can add items and inventory.

If you are past that point (which is doesn't sound like), then I can provide some links I found helpful when I was dabbling with IF parsers a while back - be warned, however, if you do not have any background in parsing theory it will be a large bite to take at once.
Hmm... I didn't know that games like that would be so complex. Okay, I guess I can start by making a simple maze game with the wasd keys and I'll come back when I become familiar with it. I heard that I could use booleans as a way of storing inventory but I don't know if it's reliable. Also, I've never learned about parsing, so do you have a link I could follow that could teach me more about parsing?
There is just simple "parsing" which, in the above case, would just be getting input into a string, splitting it at the space character into 2 strings (verb and noun), then comparing them to known values (commands and nouns, the latter usually being items or objects the player can interact with).

Then there is the more technical definition, which is a whole different beast - I wouldn't worry about that now. If you are curious, Wikipedia can give you a rundown.

At this point it sounds like you need to concentrate on honing your programming skills. Incrementally add more complexity to something you have already written, or start the small maze project you mentioned. Make sure you understand string handling (which is amazingly great in C#), and reading and writing to the Console. Learn collections, especially List and maybe Dictionary. Become comfortable with using the standard library and classes - you don't need them memorized, but you should find them predictable enough that a quick glance at MSDN is all you might need to use something you haven't before.

Understanding Classes and object oriented programming will come in handy when your projects get to be larger and more complex.

I don't have any useful links to learning resources or books, but I bet if you search this site for "C# tutorials" or "C# learning" you will likely find some useful posts.
The only game I've never found complex is Guess My Number...Everything takes longer and is harder than you think, as a general rule.

There is just simple "parsing" which, in the above case, would just be getting input into a string, splitting it at the space character into 2 strings (verb and noun), then comparing them to known values (commands and nouns, the latter usually being items or objects the player can interact with).

Then there is the more technical definition, which is a whole different beast - I wouldn't worry about that now. If you are curious, Wikipedia can give you a rundown.

At this point it sounds like you need to concentrate on honing your programming skills. Incrementally add more complexity to something you have already written, or start the small maze project you mentioned. Make sure you understand string handling (which is amazingly great in C#), and reading and writing to the Console. Learn collections, especially List and maybe Dictionary. Become comfortable with using the standard library and classes - you don't need them memorized, but you should find them predictable enough that a quick glance at MSDN is all you might need to use something you haven't before.

Understanding Classes and object oriented programming will come in handy when your projects get to be larger and more complex.

I don't have any useful links to learning resources or books, but I bet if you search this site for "C# tutorials" or "C# learning" you will likely find some useful posts.

Okay, thanks for the information >.< I'll come back in a couple months once I get the hang of it.

This topic is closed to new replies.

Advertisement