|
|
View previous topic - View next topic |
Author |
Message |
Gardon Scholar
Joined: 05 Feb 2006 Posts: 157
|
Posted: Mon Nov 06, 2006 5:35 am Post subject: Network programming for MMO |
[quote] |
|
Hello everyone. I've been programming for a while now and wish to start with some network programming, preferrably towards the end MMO goal.
Realize that I'm not naive and wish to create the next wow, but do wish to create some sort of chat/login system that allows me to grow from there.
I've been talking with people regarding sockets, multiple threads, servers, udp, and client to server verification procedures, but don't know where to start learning.
If anyone has any tips, tricks, links, or tutorials they can recommend, all would be helpful.
Thanks a bunch,
Gardon
|
|
Back to top |
|
|
RedSlash Mage
Joined: 12 May 2005 Posts: 331
|
Posted: Mon Nov 06, 2006 6:01 am Post subject: |
[quote] |
|
First of all, what language do you program in?
This tutorial:
http://beej.us/guide/bgnet/output/htmlsingle/bgnet.html
should provide you with everything you need to know about how to send data over the network.
Once you have that down, then the rest is really up to your head.
Normally, clients can communicate with the server by sending it instructions on what to do. So, to initiate a private chat between you and person X, the client would have to send a command to the server instructing it to tell person X, the message "Hello". The server receives this command, then relays the command to the client X, where that person will receive a message.
|
|
Back to top |
|
|
Gardon Scholar
Joined: 05 Feb 2006 Posts: 157
|
Posted: Mon Nov 06, 2006 6:25 am Post subject: |
[quote] |
|
Ya, sorry, c++
I have messed with java as well, and could easily learn python if needed (is it good for this stuff?)
|
|
Back to top |
|
|
Gardon Scholar
Joined: 05 Feb 2006 Posts: 157
|
Posted: Mon Nov 06, 2006 6:26 am Post subject: |
[quote] |
|
but ya, thanks for the link!
|
|
Back to top |
|
|
Gardon Scholar
Joined: 05 Feb 2006 Posts: 157
|
Posted: Mon Nov 06, 2006 4:31 pm Post subject: |
[quote] |
|
I feel like I'm reading a lamothe book... what's with the comments?
|
|
Back to top |
|
|
LeoDraco Demon Hunter
Joined: 24 Jun 2003 Posts: 584 Location: Riverside, South Cali
|
Posted: Mon Nov 06, 2006 6:34 pm Post subject: |
[quote] |
|
You will probably find things easier for you, if you were to approach things from a much higher level than basic POSIX sockets; in most cases, you will be more interested in the messages you send, more so than how you send them. Then, too, you need to consider the difference between protocol --- e.g. the syntax and semantics of your transmissions --- and the data that is transfered by that protocol.
Beej's guide is a fairly good primer on basic socket level stuff in C, but for the OO developer in each of us, you can do a lot better to make your utilization of your network code be far more succinct and intuitive. For example, sockets send out information as a stream of bytes; code that you write which interfaces with your socket implementation need not know this (indeed: it would go against the principle of Don't Repeat Yourself, if it did).
While I have yet to come across a network library I was not, to some extent, annoyed with using, the TCP Client/Listener setup in .NET is fairly nice, especially as you never touch things at the socket level. While it will not be of much use to you, given your language and (probable) platform, it might orient you to read up on its [url=http://msdn2.microsoft.com/en-gb/library/system.net.sockets.tcpclient(VS.80).aspx]documentation[/url]. (Unfortunately, that stuff is still too low level for my tastes.)
To throw some contrast out, you could also read on on sockets as they are approached in Ruby; I have not used them, nor have I given that more than the briefest of perusals, but it looks to be slightly less work than other stuff I have played with. _________________ "...LeoDraco is a pompus git..." -- Mandrake
|
|
Back to top |
|
|
Gardon Scholar
Joined: 05 Feb 2006 Posts: 157
|
Posted: Mon Nov 06, 2006 7:57 pm Post subject: |
[quote] |
|
Thanks LeoDraco, I'll get looking into those links immediately.
I do have a question for you though. Since I have never used networking before, I'm totally clueless to how much work goes into sending data.
Is it worth programming my own way of sending data, or just say screw it and mess with a library? I know you talked about high level stuff, but how "high" is it?
|
|
Back to top |
|
|
RedSlash Mage
Joined: 12 May 2005 Posts: 331
|
Posted: Tue Nov 07, 2006 1:25 am Post subject: |
[quote] |
|
Yes, the tutorial I provided is quite low level. But it does give you everything you need to send data from one end to another. It's actually not too difficult to use once you've familiar yourself with it. For example, using the TCP protocol, what ever data you write() to a socket, you can read() the same data on the server end and vice versa. You can think of it as a extension to reading and writing to files.
eg. TCP, client
Code: |
char buf[1024]; // suppose this contains data you wish to send
int socket; // this is the socket
// .. setup connection stuff ....
write(socket,buf,1024); // this sends 1024 bytes of the data to the server
|
eg. TCP, server
Code: |
char buf[1024]; // suppose this contains data you wish to recv
int socket; // this is the socket
// .. setup connection stuff ....
read(socket,buf,1024); // this receives up to 1024 bytes from client
|
Ofcourse, there is more to it, but thats the basic idea with TCP.
However, when programming for MMORPGs, you will need to use the UDP protocol, which is more tricky. What you send over a socket does not necessarily arrive at the server in the same order it was sent, nor does it guarantee that the data will arrive at all. Any late packets must be dropped, out of order packets must be reordered and any missed packets must be estimated. For MMORPGS, this is very important to handle at low level to ensure that you can minimize the latency of all your users.
For starters, I would start using TCP because it is very simple and easy to use, even at low level. For the long run, you would probably want to start building a high level API which would work over handling UDP sockets.
|
|
Back to top |
|
|
Adam Mage
Joined: 30 Dec 2002 Posts: 416 Location: Australia
|
Posted: Mon Dec 04, 2006 1:05 pm Post subject: |
[quote] |
|
In the realm of libraries i like the looks of RakNet which if free for non commercial apps (and cheaper than doing it yourself for commercial apps).
There is also the Torque Network Library, TNL that comes in GPL and commercial flavours. And the other lib the kids talk about is Hawk NL. _________________ https://numbatlogic.com
|
|
Back to top |
|
|
|
Page 1 of 1 |
All times are GMT
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|