[MUD-Dev] New to MUD Dev, need friendly advice!

Jacob Cord jacobc at chiefarchitect.com
Fri Apr 25 08:43:59 New Zealand Standard Time 2003

On Wed, 2003-04-16 at 12:04, Lance Rotten wrote:

>   1. Connections - What is the best method for accepting multiple
>   connections? Ive heard individual threads are an awful idea, and

I'm no pro in high availability here, but as I understand (primarily
Linux) sockets, if you are going for a real high number of
connections, you can either fork() child processes to handle
incoming connections or spawn threads, but some methods will share
socket file descriptors and others won't, so it requires some
planning up front.  Also (in Linux, anyway, any Windows experts have
comments about this?), you need to be careful with high-load servers
when you are spawning new processes that you don't fill up the
process table, since even when processes die they don't always get
removed right away.  Perhaps I should just leave this to the other
more professional people on this list :)

I wrote a connection driver recently just using select() and threads
(and semaphores and mutexes), and it seems to run great, although
I've never had 1000 connections to it (more like 20).  I block when
there is no socket activity, but timeout every 2 seconds (my
"heartbeat" time) and check for non-socket work that needs to be
done.  Maybe not the most efficient way to do it, but for a smaller
application it runs great.

>   2. Any advice for someone completely new to building a MUD
>   Engine would be great. Good tutorials, groups etc. I am using
>   this as a

I have always learned best by example, but have found a few books
that have been really helpful as well.  An excellent starting point
IMHO would be to search for a program called "SocketMud", it is a
real basic MUD engine written in C.  Understanding its source code
would put you on a solid path to writing your own connection driver.

The MUD-dev archives also have some great information and
discussions, you just have to dig around a while sometimes :)

Jacob Cord

MUD-Dev mailing list
MUD-Dev at kanga.nu

More information about the MUD-Dev mailing list