Need advice on best tech for very simple P2P

Started by
6 comments, last by Core2Duo 15 years, 4 months ago
Think about a multi-player card game (no! I'm not writing another poker game ... smile) Now think about the kids card game WAR. Players each toss down a card and the highest card wins. Assume each player starts with a full 52 card deck shuffled. Ok, communication between WAR players is REAL SIMPLE. I am PlayerA and I drop a JACK. I am PlayerB and I drop a FOUR. I am PlayerC and I drop a NINE. The application on each player's PC needs to send-OUT their dropped card and receive all the CARDs dropped by the other players. As I said ...... real simply communications. ---------- Let's assume we start with a WebService which can match players-to-players and send connection information (IP address?) to each other player. TCP, UDP, HTTP tunneling, something else? I downloaded a trial version of SocketWrench which looks promising, but I'm not confident it's the SIMPLEST to implement. Your advice? What's the best approach for such simplistic game communications?
Advertisement
Peer-to-peer doesn't typcially use a server.

Simplest is to use a client/server set-up, similar to a simple chat server, which any network library should come with an example of. Use the chat example, just send game commands instead of chat through that channel.

enum Bool { True, False, FileNotFound };
Quote:Original post by hplus0603
Peer-to-peer doesn't typcially use a server.

Simplest is to use a client/server set-up, similar to a simple chat server, which any network library should come with an example of. Use the chat example, just send game commands instead of chat through that channel.


Not sure chat will work for me. If my game gets lucky (smile) there may be thousands of players playing simultaneously. But, lucky-or-not, I'd rather use a tech that will scale-up gently.

But thanks for the advice.


Hi volking,

like hplus advice, you need some sort of chat client/server architecture, where creating private room is equivalent to creating game session to your specific game, chat client-server application can scale high, E.g: yahoo/live messenger it's support thousands to millions of clients.

More specifically, this sounds like you need to implement a lobby type client-server architecture, that can support multiple games and multiple game sessions, for scaling-up gently, add additional lobby server as numbers of client grow and with a centralize database that communicate to your private server farm(computer cluster) to give an illusion to every client that all players are playing on same channel.

I'm currently working on similar project, tho, it's still on the early stage, and my basis is also a simple chat client/server architecture, until I come up with a simple lobby server type design like this one , that can handle multiple games and multiple game sessions simultaneously.

Cheers.

______________________________________
My .Net Game communicator project
Quote:Original post by Core2Duo
a simple lobby server type design like this one
______________________________________
My .Net Game communicator project


OMG! That's exactly what I need, too.
Are you building that?
Can I buy a copy when you're done?

Quote:Not sure chat will work for me. If my game gets lucky (smile) there may be thousands of players playing simultaneously.


Why would a chat server scale any poorer than anything else? How many users do you think there are on AIM these days? :-)
enum Bool { True, False, FileNotFound };
Quote:Original post by hplus0603

Why would a chat server scale any poorer than anything else?


Chat server is almost without exception the second project anyone encounters in networking (first being echo server). Since those tutorials leave it at tutorial level, most never try to go beyond that blocking design, which might not be the most scalable option. Especially, since the next chapter which covers non-blocking sockets and implements such server again is likely to be considered "same as the thing I wrote yesterday".

Another reason is that a lot of what is freely available as chat server has piss-poor performance. Breaks down with 50 users and similar. It mostly has to do with the most basic mistakes, such as doing O(n) or O(n^2) lookups where O(1) would be trivial, and even most natural. Or copying things all over the place.


There is no technical reason, but there's too many chat server operators which cheer when they get 200 users into a chat room without that dual core box crashing in most horrible ways.

I don't really remember how it's possible to do that much work in chat server, but I remember very well that this is what really happened (and likely still is happening).

That whole quality of implementation problem. Personally, I'd be incredibly wary of any third-party chat server library for this very reason, but it would likely be faster to write my own, than to verify other one doesn't do silly mistakes.

Quote:Are you building that?


Yes, just a hobby of mine ;))

Quote:Can I buy a copy when you're done?


No! Hehe ;)) since this is just a non-commercial hobby project of mine, probably I'll just release the library for FREE, including the game when it's up and running, for others to find bugs that I am not aware of, kiddin. =)).

_____________________________________
My .Net Game communicator project





This topic is closed to new replies.

Advertisement