PDA

View Full Version : Network Programming Questions


MisterPoppet
05-28-2006, 01:30 AM
Hey, this is for anyone with network programming experience.

Okay, I know that programming network code is a really big thing, but how big are we talking. Is it so big that the need for it would require an entirely separate programmer, or could the person who is working on a game server type of program be able to do it (I'm talking about 300-500 people max, if that)?

As I was working on my design doc, I decided to do a little study on the networking side of things. All the articles act like that it's so ungodly hard that you need a man hooked up to a super computer to do it right. Granted they didn't actually say that, but it seems like they were hinting at that level of difficulty.

Now mind you I understand the fact that it is hard, but would a one person programmer be able to code a game server with the networking stuff and a scripting interpreter for like quests and other content like stuff? Or, could it be that i'm just over thinking this and the networking code is the bulk of the server code?

-Bryan-

P.S. What do you prefer, TCP or UDP? For me it's UDP because I just like to squeeze out that little bit of extra speed. Heh heh...

HopeDagger
05-28-2006, 03:46 AM
Okay, I know that programming network code is a really big thing, but how big are we talking. Is it so big that the need for it would require an entirely separate programmer, or could the person who is working on a game server type of program be able to do it (I'm talking about 300-500 people max, if that)?

Depends on the project. For a game (RPG?) that is supposed to process 300-500 players at a time, the network can very easily grow to a complex level. Efficiency and scalability are absolutely paramount in large-scale online games.

As I was working on my design doc, I decided to do a little study on the networking side of things. All the articles act like that it's so ungodly hard that you need a man hooked up to a super computer to do it right. Granted they didn't actually say that, but it seems like they were hinting at that level of difficulty.

I think "ungodly hard" is an exaggeration. Right now I'm writing Skirmish Online, and I've developed the network code by myself as well as all of the other game code without any massive problems. Granted I had tons of problems with networking along the way, but trial & error, along with getting advice from knowledgable network programmers (the folks on GD.NET's networking section are fantastic!) will help you get there.

Now mind you I understand the fact that it is hard, but would a one person programmer be able to code a game server with the networking stuff and a scripting interpreter for like quests and other content like stuff? Or, could it be that i'm just over thinking this and the networking code is the bulk of the server code?

Definitely. It won't be easy by any means, but it's certainly doable.

What do you prefer, TCP or UDP? For me it's UDP because I just like to squeeze out that little bit of extra speed. Heh heh...

Again, this depends on what sort of game it is. Turn-based games, slow-speed realtime games (RPGs), and RTS's tend to use TCP, while fast-paced action games (Quake 3, Counterstrike, etc) usually use UDP.

Tocs1001
05-28-2006, 12:41 PM
I wouldnt say that creating network code is too hard, I havent tested mine yet under extreme conditions with like 500 people connected, but that time is almost here =).

I basically have (client side) 3 threads for my MMORPG. One in , one out thread, one graphics and sound thread, one client side predictions thread.


all messages have a Start Character (one for server one for client) so the other end knows its a real message, then a message ID, then a Message Length. I send binary messages to save some space, so I have to use length to find the end of the message in the stream of characters.

The In and Out threads do there job like this.

Out has a que of messages, Message packager classes take what the client needs to send to the server puts it into a string with minimal compression (like using characters for numbers 1-255) and attaches it to the out threads send que.

In thread has a list of message handler classes with their message's ID it reads the first couple characters to fill the header, finds the length, reads the rest, and passes it to the appropriate Message Handler class to be parsed and use on the client side database moving people's characters or changing the clients character in some way.

The Graphics thread runs in a circle just rendering what the client database has. The client side predictions thread handles moving characters client side along their know paths to hide the latency.

This whole process allows me to simply create a new class for a message and not have to edit the actual network code! But its also for an RPG...

PS. I use TCP

MisterPoppet
05-28-2006, 03:03 PM
Cool. Thanks, all! This is a big step in the right direction for me.

-Bryan-