A Beginner

Posted by DavidMB13 on Sat 02 Jun 2007 11:22 AM — 10 posts, 41,199 views.

#0
Well, my friends, I am sure you have heard this many times, but it's time for me to start my own MUD. I've been mudding for over 8 years and have had experience as an Immortal.

My main questions are these:
Since I don't know anything about C++, what is the main route I want to take in creating a mud? I follow the basic compiling guidelines here and succesfully setup a MUD that is running on my computer.

Now where do I go from here?
Do I read a book on Unix and figure that out first? Or do I start reading up on C++.
The question is here, besides being an immortal on other MUDs, what is the best way to go about learning to code a MUD?
What is the exact process I should take or the steps I should go through in order to learn about coding a MUD succesfully.
Please let me know what the best plan of action to take is.
Thank you.
David
USA #1
Well, first off, most codebases are C rather than C++, but there are codebases that use neither as well, so I'd say the first step is going to be to decide which codebase you'll be using. After that, you can learn in a variety of ways, personally I started with a few books on C and linux (though I also started with some unix and programming, albeit in other languages, experience) and then kind of dove into the code. For the most part, depending on the codebase you've selected, there's likely to already be examples of most concepts in the code itself. Once you figure out what's being done by the code you've got, you can start making small changes to the existing code to learn the effects they have and then build up to adding new stuff from scratch. But mostly how you learn it best is a very individual thing, just be aware that there are plenty of us who are very willing (and usually quite able) to help you when/where needed, but do yourself a favor and try to figure things out some on your own first and don't hesitate to use your resources (like this forum, as one example) thoroughly (ie, search to see if the answer is already posted before asking the question), but don't be afraid to ask anything either. Confused yet? No fear, if you're not you will be eventually and then we'll do what we can to help unconfuse you. ;)
Australia Forum Administrator #2
Also, read this:

http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=2293
USA #3
Conner's suggestions are very good. One thing I might add is that even though most code bases are in C, not C++, you should learn C++ anyhow because it is a superset of C. That is, everything you can do in C you can do in C++ with the same syntax, but the contrary is not true.

So you will be doing yourself a service by learning C++, because not only will you understand and be able to write C, but you will also be able to use the more advanced features and conveniences of C++.

Just as my personal opinion I don't think anybody should be writing new code in straight C unless they have a very good reason to do so. (I think there are some very good reasons, mind you, but many people who think they have one actually don't.)
#4
Alright, so I purchased a book called C++ For Dummies and I'm beginning to get the main concepts down. I installed Dev-C++ and I saw your tiny mud server here, Nick, and I tried to compile it with the program. I get the same error as with other mud source codes I try to compile - There's basically a billion lines with errors, but everytime the program hilights the same exact line:

#include <stddef.h>

What does this mean?
The only time I've ever fixed this problem is by changing the directory that the source code was in, but I've done the same process with the source code for MUDs and it always comes up with the same thing, even with your tiny MUD server.

I am dying to get this tiny mud up and running to just fool around with it a bit.
Please help me with some more suggestions, so far everyone has been really helpful.
#5
I looked at the compile log and this is just a fraction of the errors:

Compiler: Default compiler
Executing g++.exe...
g++.exe "C:\tinymudserver\tinymudserver.cpp" -o "C:\tinymudserver\tinymudserver.exe" -fexceptions -g3 -I"C:\Dev-Cpp\include\c++" -I"C:\Dev-Cpp\include\c++\mingw32" -I"C:\Dev-Cpp\include\c++\backward" -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib"
In file included from C:/Dev-Cpp/include/stdio.h:42,
from C:/Dev-Cpp/include/io.h:36,
from C:/Dev-Cpp/include/fcntl.h:39,
from C:/tinymudserver/tinymudserver.cpp:33:
C:/Dev-Cpp/include/stddef.h:6:24: no include path in which to find stddef.h
In file included from C:/Dev-Cpp/include/stdio.h:44,

from C:/Dev-Cpp/include/io.h:36,
from C:/Dev-Cpp/include/fcntl.h:39,
from C:/tinymudserver/tinymudserver.cpp:33:
C:/Dev-Cpp/include/stdarg.h:6:24: no include path in which to find stdarg.h
In file included from C:/Dev-Cpp/include/io.h:36,
from C:/Dev-Cpp/include/fcntl.h:39,
from C:/tinymudserver/tinymudserver.cpp:33:
C:/Dev-Cpp/include/stdio.h:204: type specifier omitted for parameter `size_t'
C:/Dev-Cpp/include/stdio.h:215: type specifier omitted for parameter `size_t'
C:/Dev-Cpp/include/stdio.h:216: type specifier omitted for parameter `
__gnuc_va_list'
C:/Dev-Cpp/include/stdio.h:217: type specifier omitted for parameter `
__gnuc_va_list'
C:/Dev-Cpp/include/stdio.h:218: type specifier omitted for parameter `
__gnuc_va_list'
C:/Dev-Cpp/include/stdio.h:219: type specifier omitted for parameter `size_t'
C:/Dev-Cpp/include/stdio.h:219: type specifier omitted for parameter `
__gnuc_va_list'


#include <stddef.h>

What is this garbage? :(
Help.
#6
#include <stddef.h>

That is what's hilighted when a new tab called stdio.h pops up next to tinymudserver.cpp when I try to compile the source code.
USA #7
Just as a guess, I'd say check and see if you're missing the file stddef.h from your C:\Dev-Cpp\include folder (and those under it). *shrug*
#8
Nope, it's there.
Australia Forum Administrator #9
Quote:

I installed Dev-C++ and I saw your tiny mud server here, Nick, and I tried to compile it with the program.


My example server should compile under Cygwin using gcc.

However I caution you about trying to get a MUD running, and making code changes, if you are not familiar with C. You will get frustrated by heaps of error messages that are hard to understand, if you are just learning the language.

There are thousands of lines of code in MUD servers, and they use some of the more sophisticated concepts that programmers use, like dynamic memory allocation, asynchronous IO, string manipulation including hashing, bit manipulation (shifting left, right, anding, oring, and so on).

Grab a beginners' book on C (or C++), and work through some examples. You will save yourself a lot of grief.

An alternative it to grab a "precompiled" version of SMAUG (see http://www.gammon.com.au/downloads/dlsmaug.htm) or ROM (http://www.gammon.com.au/downloads/dlrom.htm), then you don't have to compile anything. Just fire it up and have fun running your own server.