Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Turn based Multi-player Game: WCF or Socket?

I would like to have an advice regarding my problem.

We are creating a multi-player internet chess game having these features:

  1. Game will support a very huge amount of concurrent users
  2. We will be saving each game move physically on disk (e.g. using SQL Server Database)
  3. We will utilize the same SQL Server for Sessions too
  4. Multiple Game Servers will be utilized for load balancing / scalability
  5. All the Game Servers will be connected to each other
  6. All the Game Servers will also be connection to that SQL Server
  7. Since this is a chess game therefore only 2 users can play game but
  8. Unlimited number of users can view this game in real-time as audience (broadcasting)
  9. Audience / Game Users will have an option to send and receive chat messages, privately or publicly.
  10. We will maintain our own User List in Database. Therefore we will be requiring a custom authentication system.

The client will be a desktop windows forms / wpf application. We are also thinking for an online browser based version too but we have put it for future, currently we are focusing on desktop version.

Now my questions are?

  1. Which technology we should use, Sockets or WCF?
  2. What is the preferred way of serialization, XML or Binary or Custom Binary?

Any other advice/suggestion/direction is also welcome.

Thanks

like image 266
sallushan Avatar asked Aug 17 '11 09:08

sallushan


1 Answers

Here my opinion.

Sockets

  • (+++) faster than WCF(especially if you use UDP)
  • (+) you will spend less on hardware in the future, since app with sockets will have better scalability
  • (-) you will spend more time on development
  • (-) you will spend more money on development
  • (-) you will need to design your own protocol or use close enough suitable protocol
  • (-) difficult to exted API
  • (-) it will be difficult for third-party developers

WCF

  • (+) avoid any issues with transport level
  • (+) easy to extend API
  • (+) it will save you time on development
  • (+) easy to provide third-party API
  • (+) you will spend less money on development
  • (-) it's slower than sockets
  • (-) you will spend more money on hardware, since app with WCF will have worse scalability

Doesn't matter what kind of serialization you're going to use, WCF will be slower than sockets.

Anyway you're not going to use "HipHop for PHP". I think, the answer is, create simplified client and server applications using WCF. Load it on maximum(as you suppose it will) using different bindings, serializations, etc. If WCF can handle the load and has a good reserve, then I assume, you can use it. If it's not - use sockets.

Maybe the best way to use the both technology. Sockets where performance is critical(e.g. connect game servers to each other), WCF for other parts(e.g. send and receive chat messages).

I believe there's a lot of other arguments for both technologies. But I think the question is: Do you want get it faster or get it easier to maintain. Is it an application where features are being added often, or is it an application where the load will grow in geometric progression. etc. etc.

like image 96
Daniil Novikov Avatar answered Oct 07 '22 00:10

Daniil Novikov