Archived

This topic is now archived and is closed to further replies.

AsciiFish

Multi-threaded Mud

Recommended Posts

AsciiFish    122
Hello, I''m trying to write a multi-threaded MUD server for a linux server and using pthreads. Anyway, I was trying to figure out what exactly I should have threads for. I figure that a thread for each connected player is too much overhead. I''m thinking of using a thread for each of the following: Monitoring Listenning socket monitoring player connections(one thread for the all the players) timer NPCs(one thread for all of them) Handling player commands Any ideas/suggestions/advice?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
One thread per npc, ahahah good luck because on my last mud (which I was the owner/coder), you would have threads by the thousands.

If I would include threads in a mud that would be strictly for writing/reading from files. Like this I could make the mud save every 15 minutes without annoying the players too much. Otherwize I don''t see the point of having threads in a mud... unless maybe you got some sort of huge wilderness with AI creating towns and such in which case i''d try to allocate a thread for that too since it would require quite a lot of work.

Muds simply don''t need to be multithreaded. You will get in more troubles than it is worth implementing them.

Good Luck.

Share this post


Link to post
Share on other sites
AsciiFish    122
I wasn''t planning one thread per NPC, I was planning one to handle all of them. I know that muds don''t need to be multithreaded, but I want to write one anyway(it''s between semesters, I need something to do) Anyway, the saving thread is an excellent idea! Interesting wilderness idea too. Thanks

Share this post


Link to post
Share on other sites