Sign in to follow this  
Gaffer

Incoming hilarity: abaraba is back, and this time he's fixated on P2P networking!

Recommended Posts

Gagyi    192
Quote:
Original post by hplus0603
What happens when 100 players all congretate in the same spot?


You're always priority-connected to the closest 10 people and simply-connected to the closest 50 and low priority-connected (less than 1 update per sec) to the others. So you don't actauuly see the other 100 or you see the lagging horribly, of course. But this is the problem with C/S too (see Orgrimmar in WoW).

And, of course, EVERY solution used for P2P can be used for C/S. Too bad the opposite is not true.

Lastly, C/S is a much better way to spread all the information between all the people. Think of 10 students trying to share their homework solutions with the others. with P2P, 90 letters are sent, with C/S (one of the 10 would be the "server"), only 18 letters are needed to be sent.

P.S.: But cloud computing is the trendy way to do stuff these days, so running the game logic on client side is quite reasonable if you're not concerned about cheating.

EDIT: By letters, I meant the envelopes. Whatever, too late, sorry.

[Edited by - Gagyi on September 10, 2009 3:42:28 PM]

Share this post


Link to post
Share on other sites
Ma-we-Te    100
Quote:
Original post by Gagyi
Quote:
Original post by hplus0603
What happens when 100 players all congretate in the same spot?


You're always priority-connected to the closest 10 people and simply-connected to the closest 50 and low priority-connected (less than 1 update per sec) to the others. So you don't actauuly see the other 100 or you see the lagging horribly, of course. But this is the problem with C/S too (see Orgrimmar in WoW).

And, of course, EVERY solution used for P2P can be used for C/S. Too bad the opposite is not true.

Lastly, C/S is a much better way to spread all the information between all the people. Think of 10 students trying to share their homework solutions with the others. with P2P, 90 letters are sent, with C/S (one of the 10 would be the "server"), only 18 letters are needed to be sent.

P.S.: But cloud computing is the trendy way to do stuff these days, so running the game logic on client side is quite reasonable if you're not concerned about cheating.


P2P, Step 1:
Each student sends 9 letters, 10*9 = 90 letters


C/S, Step 1:
Each student sends 1 letter to server (10th student), 1*9 = 9 letters
C/S, Step 2:
Server (has all letters) sends back 9 letters to 9 students, 9*9= 81 letters


90 letters need to be sent in either case. However, if maximum allowed bandwidth for all students was 1 letter per second, then P2P could share their homework in 9 seconds, while C/S would need 1 second for the 1st step and 81 seconds for the 2nd step. C/S model also exhibits additional latency due to longer packet trip, extra routing and information processing done by the server. P2P is very good for sharing and communication, file sharing, chat, signaling, distribution of tasks and resources, such as CPU load and bandwidth.


Run AI algorithm for all low-priority (far away) players and you will get "Donnybrook Stickman", handling even hundreds of players without any lag. This, of course, will not apply to any type of game, but for a frenetic FPS it should mostly pass unnoticed.


Any two peers have a server-client type of connection and this should make possible to apply solutions from C/S to any two peer in P2P independently. What C/S tricks you have found do not apply to P2P?


Your game is pretty cool. It works much better for me than Quake Live, or to be more precise Quake Live doesn't work for me at all, I get "disconnected" messages flashing every 5 seconds, game stops for a while then all players warp around while animation is trying to catch up with something that looks like super-fast forward.

I'm connected via Wi-Fi network and my bandwidth is pretty low - 200/50kbps. Does anyone know if this could be the reason for lag, and how much bandwidth a Quake game with 16 players need per client, both upload and download? Though, I'm lagging badly even on 1on1 duel.


Mark

Share this post


Link to post
Share on other sites
Hodgman    51220
Quote:
Original post by Ma-we-Te
It works much better for me than Quake Live, or to be more precise Quake Live doesn't work for me at all, I get "disconnected" messages flashing every 5 seconds, game stops for a while then all players warp around while animation is trying to catch up with something that looks like super-fast forward.

I'm connected via Wi-Fi network and my bandwidth is pretty low - 200/50kbps. Does anyone know if this could be the reason for lag, and how much bandwidth a Quake game with 16 players need per client, both upload and download? Though, I'm lagging badly even on 1on1 duel.
Quake 3's network model (which I assume is the same as Quake Live's) doesn't deal very well with high levels of packet loss. It deals with lost information by re-attaching it to the next packet, which means extended periods of packet loss can cause the next packets to become larger, which also might inrcease the chance they will be lost in transit...

IIRC quake doesn't need much bandwidth in ideal conditions - ~5kb/s combined up/down on the client I think (if you experience large amounts of loss, you may need more bandwidth to compensate though). Your problem is probably latency and packet loss related.

Share this post


Link to post
Share on other sites
Sirisian    2263
Quote:
Original post by Ma-we-Te
Quote:
Original post by Gagyi
Quote:
Original post by hplus0603
What happens when 100 players all congretate in the same spot?


You're always priority-connected to the closest 10 people and simply-connected to the closest 50 and low priority-connected (less than 1 update per sec) to the others. So you don't actauuly see the other 100 or you see the lagging horribly, of course. But this is the problem with C/S too (see Orgrimmar in WoW).

And, of course, EVERY solution used for P2P can be used for C/S. Too bad the opposite is not true.

Lastly, C/S is a much better way to spread all the information between all the people. Think of 10 students trying to share their homework solutions with the others. with P2P, 90 letters are sent, with C/S (one of the 10 would be the "server"), only 18 letters are needed to be sent.

P.S.: But cloud computing is the trendy way to do stuff these days, so running the game logic on client side is quite reasonable if you're not concerned about cheating.


P2P, Step 1:
Each student sends 9 letters, 10*9 = 90 letters


C/S, Step 1:
Each student sends 1 letter to server (10th student), 1*9 = 9 letters
C/S, Step 2:
Server (has all letters) sends back 9 letters to 9 students, 9*9= 81 letters


90 letters need to be sent in either case. However, if maximum allowed bandwidth for all students was 1 letter per second, then P2P could share their homework in 9 seconds, while C/S would need 1 second for the 1st step and 81 seconds for the 2nd step. C/S model also exhibits additional latency due to longer packet trip, extra routing and information processing done by the server.

That's a big if. The way your treating "letters" is a bit odd. The server would batch send them, but given your interesting restriction of 1 letter then P2P appears better for that situation.

Quote:
Original post by Ma-we-Te
P2P is very good for sharing and communication, file sharing, chat, signaling, distribution of tasks and resources, such as CPU load and bandwidth.

Sure, file sharing with a middle man would be awkward. Communication (I assume you don't mean chat since you listed that?) might not work as well. There's something special that happens in VOIP. The server can take in all the data and merge the voices and such into 1 signal thus the server is only sending out 1 signal per person. (Or so I imagine). Chat like IRC is handled via a server. It's very low bandwidth, but yeah P2P could work especially for just 2 people.

Share this post


Link to post
Share on other sites
Antheus    2409
Quote:
Original post by Ma-we-Te
C/S, Step 2:
Server (has all letters) sends back 9 letters to 9 students, 9*9= 81 letters


In C/S model, the server takes 9 letters intended for the user, and rewrites just the summary into a single letter. So instead of sending 9, it sends only 1, which might be twice as long as any individual letter.

This is trivial and completely straightforward to do with C/S model. Similar is possible with P2P, but is much more difficult to get right.

Even without rewriting, server would open all 9 letters, and put them in single envelope. So instead of sending 9 envelopes and 9 letters, it's just 1 envelope and 9 letters, cutting postage costs in half.

Quote:
P2P is very good for sharing and communication, file sharing, chat, signaling, distribution of tasks and resources, such as CPU load and bandwidth


P2P is more awesome than Chuck Norris....

Why don't chat and IM apps use P2P then?
Signalling around here is done with traffic lights, not sure where P2P applies.
File sharing are one-to-one transfers, not one-to-many or many-to-many.
Distributing of tasks uses many different concepts, but most of them rely on some form of scheduler or task coordinator (possibly more than one), which is basically a server.

Share this post


Link to post
Share on other sites
Sirisian    2263
Quote:
Original post by Ma-we-Te
Telephone exchange is to Client-Server what Walkie-talkie is to Peer-to-Peer, so applications, especially games, should be doing at least voice chat via P2P, they don't? -- Signaling, as in neural networks, kind of like binary search tree for pattern recognition. File sharing can also be one-to-many, many-to-one, and many-to-many. Wikipedia article says Instant Messaging and Online Chat apps, as well as Skype and VoIP all use P2P. Conference type of calls, or similar large-number interaction, like voice chat in multiplayer games, therefore seem ideal candidate for this architecture.
Skype is generally one-to-one. Okay imagine you have 40 people in a voice chat and don't say it doesn't happen since I've done it while playing Planetside :P. Okay so lets say Everyone is talking and such randomly and sometimes they're talking at the same time. In P2P you'd be getting multiple streams of sound and that can be a little intensive for some people's bandwidth. As you might know you can put the sounds together as layers since that's what happens when they come out of your speakers. Now imagine 40 people start talking into their mics or maybe they keep their mic open 24/7 and you can hear them all breathing :\. Now in a C/S with a dedicated server you'd be getting all of these streams and simply merging them together and sending out one stream to all players. This scales perfectly for clients. No matter how many users there are talking and such the clients are getting one stream of sound with all of the voices so the bandwidth is constant. (If no one is talking then the download cost for a client is none. If everyone is talking it's the same bandwidth as if one person was talking).

Instead of skype look at TeamSpeak or Ventrillo which are conferencing applications

Share this post


Link to post
Share on other sites
hplus0603    11347
Skype still uses a central server for things like buddy lists and matchmaking. How else would you find the other person you'll want to talk to?

I think we've all done the math, talked about pros and cons, and beaten this dead horse into smoked sandwich meat by now. I'll probably close this thread unless someone posts some previously unseen links to some P2P code library that works amazingly well for internet games ;-)

Share this post


Link to post
Share on other sites
eq    654
I didn't bother to read through all posts but it seems like it's only the performance that is discussed.
P2P is a BIG show stopper for me since P2P means that I expose my IP to everyone I play with.
This could mean that they could easily cheat by launching a DOS attack or spamming game data at me (probably needs a lot of work making this fail safe).
Further the game code need to take more responsibilities i.e determining that I killed player X.
Running these responsible tasks in an hostile environment isn't a good idea IMO.
No fun getting good at a game if you know that every kid on the block can beat you by cheating...
I think that hardcore gamers wouldn't even consider playing a P2P game...let alone pay for it.
That said, a casual free game (cheap?) game might probably work ok.

Just my 2 drunken cents...


Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this