MMORPG, Multithread help

Started by
5 comments, last by Nashoc3 20 years, 8 months ago
Hey everyone, ive been wanting to write my own text based MMORPG using VB. I read awhile ago that in order to do this you have to use multithreading. Ive been reading a little bit into it, but im not sure what i should be multithreading (or how, really). Do i have to multi thread incoming commands (and outgowing) from the client to server? Some advice would be appreciated.
Advertisement
If you don''t know how to do it then you shouldn''t be writing a MMORPG.
____________________________________________________________AAAAA: American Association Against Adobe AcrobatYou know you hate PDFs...
Well do you know anywhere with a user friendly guide to multithreading? anything?
quote:Original post by Raloth
If you don''t know how to do it then you shouldn''t be writing a MMORPG.


And why shouldnt he? Im sick of seeing people on here saying "This is how you should learn to make games. Do this then this..."

So what if he doesnt know how to do it. If he doesnt, let him start, realise HIMSELF it might be to big a task, then work upwards.

And at least he knows what multi threading is, unlike a lot of the "I wanna make a MMORPG game..."
Well, you don''t have multithread the server if you don''t want. In fact, most MUD servers (text based online rpgs) don''t. Just use non-blocking sockets then have a game loop along the lines of:

while ( keep_alive )
{
check_io();
update_game();
next_frame();
}

Or whatever you would need to have happen each frame. All check_io() would do is poll each open socket for data and process it if there is any, and also send out any data that needs to be sent on that socket.
Here''s the multi-threaded method I''ve seen done: have one thread for every 64 connections, and when you are waiting for user input, block with a call to "select()" (this is part of the socket API). The reason you have 64 connections in one thread is that this is the maximum number of connections you can call select() on, iirc.

But personally, I wouldn''t use multithreading at all, because as soon as you start with that, you have to worry about problems like deadlocking, race conditions, synchronization, etc. All of this in addition to all the other programming issues you have to worry about. Because, remember, your goal when writing a server is to make it as stable as it can possibly be. Like a freaking rock.

I have a simple MMORPG engine running, and I am using AP #3''s strategy of polling every connection with a non-blocking recv(). And that works fine. But I don''t think this will handle a lot of connections well. I think the even-better way to do it would be to use signals, which you can find out about in pretty much any guide to sockets.
quote:Original post by Anonymous Poster
And at least he knows what multi threading is, unlike a lot of the "I wanna make a MMORPG game..."

Upon carefully reading the OP, I''m not sure that he does.

This topic is closed to new replies.

Advertisement