Home » Community » Forums » » MUD Pies Part I
  Intel sponsors gamedev.net search:   
[Control Panel] [Register] [Bookmarks] [Who's Online] [Active Topics] [Stats] [FAQ] [Search]

Add Forum to Favorites |  Send Topic To a Friend | View Forum FAQ | Track this topic

Page:   1 2 »»

 Last Thread Next Thread 
 MUD Pies Part I
Post Reply 
Some errors:

In GlobalWndProc: The WM_NCCREATE message is sent prior to the WM_CREATE message when a window is first created. Thus SetWindowLong should be called for WM_NCCREATE and not for WM_CREATE.

When describing inlines: Don't confuse the readers more than you have to:
inline void foo(int n) { output(n); return n+5; }
should be:
inline int foo(int n) { output(n); return n+5; }



Update GameDev.net system time campaign - success at last

 User Rating: 1149   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

quote:
Original post by dalleboy
Some errors:


Thanks for pointing these out. First article and all, it is much appreciated.

quote:
In GlobalWndProc: The WM_NCCREATE message is sent prior to the WM_CREATE message when a window is first created. Thus SetWindowLong should be called for WM_NCCREATE and not for WM_CREATE.

hmmn, not too sure about this one. I will take your word for it. I am not a huge fan of the Win32 API, I prefer to use a libary for windowing (Borland's VCL), so the most I actualy use it is in my OpenGL programs, or (of course) servers (where the 'normal' way is a far eaiser method of accessing the message system). Suffice to say that it works in all the programs I have made, so unless it will cause a fatal error, I shall leave it that way. I will investigate it, though, for any future programing or articles.

quote:
When describing inlines: Don't confuse the readers more than you have to:
inline void foo(int n) { output(n); return n+5; }
should be:
inline int foo(int n) { output(n); return n+5; }

Typo. Ack. There's one in every article. Either Dave will see this and correct it or I will email him as soon as I can. It has been updated in my original copy of the article.

Do not meddle in the affairs of moderators, for they are subtle and quick to anger.


ANDREW RUSSELL STUDIOS
Cool Links :: [ GD | TG | MS | NeHe | PA | SA | M&S | TA | LiT | H*R ]
Got Clue? :: [ Start Here! | Google | MSDN | GameDev.net Reference | OGL v D3D | File Formats | Asking Questions | Go FAQ yourself ]


[edited by - Andrew Russell on April 13, 2003 10:29:52 AM]

 User Rating: 1841   |  Rate This User  Send Private MessageView ProfileView Journal Report this Post to a Moderator | Link

Actualy, there is a bit of false advertising in that article

"He is currently developing the game mechanics and story line for an up coming MUD."

This is no longer the case. That project has been transfered to someone else.

Another typo: I called a "switch" statement a "select" statement (although, the code was correct)

Do not meddle in the affairs of moderators, for they are subtle and quick to anger.


ANDREW RUSSELL STUDIOS
Cool Links :: [ GD | TG | MS | NeHe | PA | SA | M&S | TA | LiT | H*R ]
Got Clue? :: [ Start Here! | Google | MSDN | GameDev.net Reference | OGL v D3D | File Formats | Asking Questions | Go FAQ yourself ]


 User Rating: 1841   |  Rate This User  Send Private MessageView ProfileView Journal Report this Post to a Moderator | Link

Andrew, I updated the errors pointed out here in the text of the article. If you could update the source and send it to me, I'd appreciate it.

 User Rating: 2088   |  Rate This User  Send Private MessageView ProfileView Journal Report this Post to a Moderator | Link

You know, I've often thought muds would be a lot better if they could escape the fact that they have to manually implement the telnet protocol.

Surely a mud SHELL, using -existing resources- to allow telnet, ssh, etc. to connect, and simply devoted entirely to the database management and player processing would be much better?

I mean, when you think about it, imagine a std. unix box which allows the player to login using any std. method. The player can then pick their shell (ie. which mud on the machine to use), and the system can use:

- Existing server / client code
- Existing database management (read, filesystem)
- Existing security measures
- Existing logging capabilities
- Existing user-to-user communication abilities

PLUS, you could implement all of the mud commands as independent applications on the OS, allowing them each to be implemented in what ever language you wanted: you just have to define the file formats they must obey...

Mobs could be implemented as independent processes, allowing totally flexible and dynamic mob control at virtually no cost (all that nasty process control is already native to the os).

You could even run the damn thing off a windows machine using
emulation (like what's it, that normal emulation layer stuff,
I forget the name)...

Just a thought. Classical mud code sucks IMHO. There are SO MANY THINGS you can just avoid having to do, allowing you to focus on the real meat of the mud (content, commands), its depressing watching people trying to write muds from scratch.

Of course, I realise the point of this article series is to expose the issues of networking, security, etc. to people, but indeed. Just my $0.02.

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

OK, I have updated the sources and am bout to send, the only change was the WM_NCCREATE thing.

And speaking of which, what is the difference?


And to Shadow Mint:

Nifty idea, but well beyond the scope of the article.

But I do agree, I would prefer to at least use libarys instead of doing it the "old-fashoned" way, but all the basics need to be taught. Not to mention that there is fun to be had in doing it all yourself.

Speaking of libarys, coming up with a good way to do the databases is being pants, as I have some really nice DB libs, that few of the readers would also have access too.

Do not meddle in the affairs of moderators, for they are subtle and quick to anger.


ANDREW RUSSELL STUDIOS
Cool Links :: [ GD | TG | MS | NeHe | PA | SA | M&S | TA | LiT | H*R ]
Got Clue? :: [ Start Here! | Google | MSDN | GameDev.net Reference | OGL v D3D | File Formats | Asking Questions | Go FAQ yourself ]


 User Rating: 1841   |  Rate This User  Send Private MessageView ProfileView Journal Report this Post to a Moderator | Link

Well I read the article (loved it and excited by it) and got the code for the system I am familiar with, MSVC (from the "Cow in the Well" guy). It compiled fine, and I tried to connect to it using telnet localhost 3000

it connects and crashed the program, upon some investigation it seemed that it did not like the value of rootuser on the line:

if(rootuser){rootuser->prev = user;}
in code:
CUser* CServer::AddUser()
{
    CUser* user = new CUser;

    user->next = rootuser;
    if(rootuser){rootuser->prev = user;}
    rootuser = user;

    return user;
}
 


So I changed the CServer constructor from empty to this:
CServer::CServer()
{
	rootuser=NULL;

}
 

it seems to connect and only crashes sometimes and I havent figured out how or why yet. I was just curious, if making the rootuser=NULL was a proper fix, and or if I did something wrong to begin with (or missed something) though not sure what I could of done wrong to begin with it was pretty straightforward:
Downlaod Code
Unzip it
Compile and Run
use telnet to connect to localhost port 3000

Any feedback here?

Thanks for the good article!
-Shane



 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Great article. I've been interested in writing my own MUD for a while now, but I really didn't know how to make it work with telnet clients. I'm excited to see the rest of this article, and hopefully create my own MUD. Thanks a lot!

[edited by - Coaster Kev on April 14, 2003 11:37:54 PM]

 User Rating: 1112   |  Rate This User  Send Private MessageView ProfileView Journal Report this Post to a Moderator | Link

Nice article Andrew!

Shane, I had the same problem with the crash after connecting. Fixed the problem the same way as you and after that it worked fine
I set the next and prev to NULL to in the constructor for CUser, I don't know if this is the way to go since I'm no expert, can someone else please comment on this?

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Now that was definatly bad codeing on my part.

The reason that this happens is because when you use the if(rootuser) statement, it checks if rootuser != 0. NULL is defined as zero, so it is all good. If there is no root user (rootuser _should_ be defined as NULL in this case), it will create one.

When there is no root user, the pointer should be NULL. However, when your compiler is alocating the pointer, it is leaving the memory just as it was (basicly filled with random data), while my compiler is probably both alocating the pointer as well as clearing the memory (to zero, ie: NULL).

What is happening is that when it runs, it goes to the rootuser pointer and sees it is not equal to NULL, therefore decides that it must be a pointer (entering into block with the if statement) and tries to access (and modify) the memory at this point. This is Not A Good Thing(tm). There are (depending on a few things) three possible cases (if it is not NULL and not a proper pointer):

The program tries to modify data outside the programs memory space. This causes the OS to go and yell "Access Violation".

The program tries to modify data inside its memory space, causing it to overwrite some other variables, possibly other pointers (causing the above error) and generaly causing havoc and eventualy crashing (just as bad and harder to track down).

The pointer points to something that won't cause either of the two above cases, and goes along its way (still not fantstic, though).


This is pretty critical, so I have emailed dave new source (again). I will probably make a note of this in my next article too.



And to all the praise: Thankyou very much, I am glad you enjoyed it. Part two will be online as soon as it can be.

Do not meddle in the affairs of moderators, for they are subtle and quick to anger.


ANDREW RUSSELL STUDIOS
Cool Links :: [ GD | TG | MS | NeHe | PA | SA | M&S | TA | LiT | H*R ]         Articles :: [ MUD Pies ]
Got Clue? :: [ Start Here | Google | MSDN | GDN Reference | OGL v D3D | Formats | Asking | Go FAQ yourself ]


 User Rating: 1841   |  Rate This User  Send Private MessageView ProfileView Journal Report this Post to a Moderator | Link

Ya, I guess its some issue with visual C++ grabbing whatever is there if you dont explicity set a default value for any variable. In either case it seems to be running now, and damned if im not chompin at the bit for the next article have an eta on that?

Thanks again,
Shane


 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Great article! I can't wait for the next part.

 User Rating: 1039   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Ready for part 2! My server doesn't do much! It's ready to do stuff now!!

 User Rating: 1112   |  Rate This User  Send Private MessageView ProfileView Journal Report this Post to a Moderator | Link

Wow! Thanx AR for your ARticle... peh.. I suppose I can amuse myself with that one for a few more hours .

Anyways. I went on the differnt approach. I actually started making my game content and then sorted out how the server was operating. They are both fairly detached from each other appart from the sending of data and the logging of users.

Much awaiting the next installment!

-Chris Bennett of Dwarfsoft - The future of RPGs GPA Thanks to all the goblins in the GDCorner niche

 User Rating: 1649   |  Rate This User  Send Private MessageView ProfileView JournalView GD Showcase Entries Report this Post to a Moderator | Link

Hey Andrew
I just wanted to compliment you on your article. Ive been trying to write my own mud but I was having too many problems writing the server code to work with telnet. Your article is just what I needed.

Thanks again, cant wait to read next second part

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

GREAT article! Just the kind of fun trivia and do-it-yourself thing that hits the spot. Ah... Really looking forward to the next article!

 User Rating: 1015    Report this Post to a Moderator | Link

Downloaded the "Cow-Well" MSVC source code in fits of wild ecstasy at being enabled to start making my own mud -

-but then when i try to make an executable off the mudsrv.cpp file by itself, the linker pukes! what the? sure, there's your primitive .exe file which i can connect to without a problem, but i can't modify/add/whatever the source code without figuring out why the original code is making the linker puke!

 User Rating: 1015    Report this Post to a Moderator | Link

Make sure you are putting the libarys into the project properly. I don't have MSVC so I can't help too much with it.


To everyone else:

Sorry about number two taking so long, the first article was left in the queue for quite a while, and although I am pleased it went up, it went up at a really bad time for me. I am afraid that the next one is still in progress, and won't be ready for at least another week or two. Three or four is probably a more accurate estimate.

Do not meddle in the affairs of moderators, for they are subtle and quick to anger.


ANDREW RUSSELL STUDIOS
Cool Links :: [ GD | TG | MS | NeHe | PA | SA | M&S | TA | LiT | H*R ]         Articles :: [ MUD Pies ]
Got Clue? :: [ Start Here | Google | MSDN | GDN Reference | OGL v D3D | Formats | Asking | Go FAQ yourself ]


 User Rating: 1841   |  Rate This User  Send Private MessageView ProfileView Journal Report this Post to a Moderator | Link

quote:
Original post by Anonymous Poster
Downloaded the "Cow-Well" MSVC source code in fits of wild ecstasy at being enabled to start making my own mud -

-but then when i try to make an executable off the mudsrv.cpp file by itself, the linker pukes! what the? sure, there's your primitive .exe file which i can connect to without a problem, but i can't modify/add/whatever the source code without figuring out why the original code is making the linker puke!


Please define "puke" (ie. post the linker errors). Then i can try to help you.

- Thomas

 User Rating: 1348   |  Rate This User  Send Private MessageView ProfileView Journal Report this Post to a Moderator | Link

quote:
by cow_in_the_well
- Thomas
Since when did you start ending your posts with your name?

 User Rating: 1841   |  Rate This User  Send Private MessageView ProfileView Journal Report this Post to a Moderator | Link

I have for a long time now (its my sig -_^), its just that i hardly ever post .

- Thomas

 User Rating: 1348   |  Rate This User  Send Private MessageView ProfileView Journal Report this Post to a Moderator | Link

Are you still planning on finishing this?
I rather enjoyed the first article and would like to see
it finished out.

Thanks! ^^;;

-Hyatus
"da da da"

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Ditto! Awesome job on the first part. I have yet to find anything on coding a mud server from the ground up as comprehensive as this! Thanks!

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

This line:

socket = socket(AF_INET, SOCK_STREAM, 0);
 


Comes up with an error message: Does not evaluate to a function. Any reason why this comes up? Also, I changed sock to socket, so that is why it says socket.

 User Rating: 991   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link
Page:   1 2 »»
All times are ET (US)

Post Reply
 Last Thread Next Thread 
Forum Rules:
You may not post new threads
You may post replies
You may not edit your posts
You may not use HTML in your posts
Jump To:
Administrative Options: