Online Multiplayer game-Direct Play, TCP, or UDP?

Started by
12 comments, last by CoolProgrammer 13 years, 11 months ago
Hi! I am hoping to create an online-only multiplayer FPS army game. I am planning to have a main server that everybody connects to to join the game. Basically, my idea for the game is: -to have it be like the army, you start out as a private and have to work your way up -you get weekly wages(+extra for completing certain goals) to buy new weapons, gear, and to take training -have 2 or more armies to battle against each other I want one massive online multiplayer FPS. By that, I mean at least a few hundred people playing at once. I would create a server that would hold everybodies info; their rank, gear, amount of money, etc. Would a single computer be able to handle hundreds of people connected to it? Everything in the game would go through the server. I think my speed would be fine, maybe not enough bandwidth though... 8Mbps down, 1Mbps Up Finally, what protocol should I use? For now, I am creating the game in Blitz3D, which supports DirectPlay(directX), TCP, and UDP. I would maybe port it to BlitzMax for multiplatform support, but I couldn't use DirectPlay then. You could see the commands you can use for each here: http://www.blitzbasic.com/b3ddocs/command_list_2d_cat.php You can see that the Network, TCP, UDP, and DirectPlay command references are in a row. I think I remember reading that TCP at least can only handle 64 connections at once, which won't work. Thanks! Oh, and as a side thought, what port should I use? Since a lot of people have routers, are there certain ports that are open by default? -CoolProgrammer
Advertisement
You may want to do some research - there's quite a few articles on this subject. I've found Networking for game programmers to be a good starting place.

Either way, this sounds like a difficult thing to pull off, especially if this is your first multiplayer game. You may want to scale down the number of players to a more realistic number.
Create-ivity - a game development blog Mouseover for more information.
DirectPlay is deprecated and nobody has used it for ages. Forget about that. You'll want UDP for this type of game. However, you may want to aim for a bit less than "hundreds" of players. The game you are describing borders to MMOFPS, which you, frankly, won't be able to make right now. Start out on a smaller scale (32-64 players, perhaps) and work your way from there.

A good read is the description of the Quake III networking architecture, also known as the Book of Hook.
He could mean simple hundreds of players use the server, not that each plays in one large session. UDP is the best choice for player movement, bullet vectors, just about anything that could lose a packet or two and still work. Things like character stats (health, ammo, etc) would maybe want to TCP so that is guaranteed to arrive in order so that you health doesn't jump around.
I think for now, I will create a very basic network program/game to figure out how to use UDP. After that, I will create a very basic multiplayer FPS. I actully already have one made that has one level. I will just modify that...

Quote:Original post by Windryder
DirectPlay is deprecated and nobody has used it for ages. Forget about that. You'll want UDP for this type of game. However, you may want to aim for a bit less than "hundreds" of players. The game you are describing borders to MMOFPS, which you, frankly, won't be able to make right now. Start out on a smaller scale (32-64 players, perhaps) and work your way from there.


Why wouldn't I be able to make one right now? Because UDP can't handle that many people, or I dn't know enought right now to make one?

Thanks for the links!
Oh yes UDP is capable, that's not the problem.

The complicated part comes with designing, implementing and maintaining an infrastructure that scales up to more players than from what a single machine can handle. That's in part what distinguishes a MMOG from a MOG, and what makes the former a lot harder to make.

Quote:I think my speed would be fine, maybe not enough bandwidth though... 8Mbps down, 1Mbps Up


Haha you make people lag like hell with such low upload in a conventional 10 player FPS server. :)
Alot of games use both UDP (unreliable) and TCP (Reliable) for transport.

TCP is good for stuff which is not time sensitive -- since TCP packets are guaranteed to arrive (barring a timeout/loss of connectivity) and to arrive in order -- so they're practically fire-and-forget. Things like in-game chat text, event text, etc are good candidates for TCP.

UDP is usually used to impliment a lighter-weight and faster protocol than TCP that provides reliability and ordering in software -- so, for example, when the game notices that its missing a packet, it has to request that the information be resent. Alternatively, UDP packets might contain a 'sample-in-time' of the gameworld, that the client then uses to interpret events between packets with its best-guess. This is usually called 'dead-reakoning'

throw table_exception("(? ???)? ? ???");

K thanks for the replies. I did some research on TCP and UDP and am trying to get a few computers(clients) to connect to my best computer(server) and send stuff back and forth for now. Then I will try to make a little more progress.

Just wondering, what service would I need to host a server that had around 100 people connected to it at once? Would a T1(1.5Mbps up/down) be good enough? I know the speed isn't that great, it's the bandwidth, which is what would need a lot of, right?
-CoolProgrammer
Quote:Original post by CoolProgrammer

Just wondering, what service would I need to host a server that had around 100 people connected to it at once?


100 people doing what?

The problem with this many people in a setting like FPS is quadratic load. Player 1 fires a bullet, and that info needs to be replicated to 99 other players. Now if 100 players fire a bullet, then each of the other 99 needs to be told about it.

This is the real problem why such things are hard to scale. There is MAG, but it's doing some really funky stuff, and apparently it causes quite some issues, such as person getting killed without opponent ever loading on their screen.

WoW gets away with it since each player can send one action per second or less and response can lag by a second or two. In FPS the update rate needs to be 10-30Hz.

Quote:8Mbps down, 1Mbps Up
Quote:Would a T1(1.5Mbps up/down) be good enough? I know the speed isn't that great, it's the bandwidth, which is what would need a lot of, right?

100 people moving, and each seeing each other at 10 Hz = ~(50 bytes per update * 10 * 100)^2 = 2.3 GIGABYTES per second. T1 is 16000 times too narrow for this. And this doesn't even take into consideration anything but movement, such as hit and damage information, various actions, and anything else interesting.

This is where things get complicated, since area of interest algorithms come into play, delta compression, etc... FPS is still limited to 64 players for this reason. Most of the time, it won't matter. It's the worst-case scenario that really ruins the day. This is why maps tend to be fairly spread or consist of in-door rooms, so that the chance of all 64 players coming into view of each other is minimized. But each of these compromises causes other problems, mostly with consistency.
Quote:Original post by CoolProgrammer
K thanks for the replies. I did some research on TCP and UDP and am trying to get a few computers(clients) to connect to my best computer(server) and send stuff back and forth for now. Then I will try to make a little more progress.

Just wondering, what service would I need to host a server that had around 100 people connected to it at once? Would a T1(1.5Mbps up/down) be good enough? I know the speed isn't that great, it's the bandwidth, which is what would need a lot of, right?
-CoolProgrammer


no, 1.5Mbps up is not enough for a 100 players fps server, a game like BF2 recommends atleast 8Mbps upload for a 64 player server, for a hundred players or more i'd recommed looking at T3 or OC-1 connections, or any consumer 100/100 Ethernet based connection You generally aren't guaranteed to be able to use all the bandwidth on these since ISPs tend to sell more bandwidth than they actually have but they're fairly cheap (around 15-40 euro / month in sweden) and you almost never drop below 80Mbps upload anyway, just make sure that the connection is unmetered and that the ISP allows you to run bandwidth consuming servers on it. (and you'd still have to work fairly hard to keep bandwidth usage at an acceptable level, no matter what kind of connection you get on the server you should avoid using more than than 0.5Mbps per player since using more would greatly reduce your potential playerbase)

[Edited by - SimonForsman on May 1, 2010 9:34:46 PM]
[size="1"]I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!

This topic is closed to new replies.

Advertisement