I am working on a Turn-based Game (Chess)

I have done the client part and single player mode so AI is no problem here. But the only problem is now I want to make my project multiplayer. I have done the part to setting and retrieving high-scores and other Informations. Now I am stuck on server structure since I got no idea on which server to use:

My game Multiplayer structure:

  • User logs in
  • Can choose between 3 rooms
  • each room got 10 levels (rooms) inside
  • game will automatically send each player to a curtain room based on their rank
  • players will be assigned to each other and start the game
  • each player got 30 secs to make a move otherwise they will lose their turn
  • At the end scores will be sent to the DB

Options suggested by friends:

  • SmartFox
  • Google App Engine

Why not using mentioned servers:

  • some many functions which I will not need (Performance)
  • MY project is a small project (self study no need ready servers)
  • Need to do it by myself for educational purposes

Program Languages used:

  • Clint-> C#
  • Server -> php, SQL


  • is HTTP good enough to handle 500-1000 users at a time?
  • can handle this kind of games with WWW and WWWFORM in Unity2D?
  • if no any options?


  • 2
    \$\begingroup\$ Why not write server in C# using TCP/IP protocol? Simply create own message syntax like [type][body] and send plain data. \$\endgroup\$ – wondra Jul 28 '14 at 9:29
  • \$\begingroup\$ I do not have enough information about TCP/IP protocols and writing code for it... if you could send me any reference, I would appreciate it... Thank Wondra \$\endgroup\$ – Pourya Da Jul 28 '14 at 15:57
  • \$\begingroup\$ I studied about TCP/IP and some questions I have... Since I will have 3 parts to setup a TCP/IP server for a Unity Game which are TCP/IP Client DLL Code(DLL), TCP/IP Server Code(EXE), TCP/IP Unity Code(Script). -Can I run my TCP/IP Server (EXE) on a Godaddy Web Hosting Plan (since I have one)? or I need a dedicated server or a VPS? \$\endgroup\$ – Pourya Da Jul 28 '14 at 16:48
  • \$\begingroup\$ About webhosting, you should search for answers on related site. And about TCP/IP - in C# it is quite high level actually, ever worked with streams (for example file stream?)? In practise TCP/IP is very similar to any other stream, you just send data to it and process in on the other side of connection. Simple own server can have as few as 100 lines of code. \$\endgroup\$ – wondra Jul 28 '14 at 17:44

It is possible to achieve this using an HTTP server since the application won't require frequent messaging. However, the problem with the HTTP is that it cannot send messages to the client unless it requests something. Therefore, you need to send regular requests to receive state updates (such as 'is it my turn', 'piece positions changed?' etc.). Also, you should make sure that the server(computer) will be able to handle 1000 simultaneous requests.

  • \$\begingroup\$ Thanks Alican for your information I was just writing my code and faced exactly the problem which you just stated here... HTTP only sends data when the client request for it... is there any way to make my PHP code on Server to update client side once a change has occurred on the game state? \$\endgroup\$ – Pourya Da Jul 28 '14 at 15:52
  • \$\begingroup\$ I don't think so. But you may utilize from a hybrid networking architecture. You can use HTTP for non-game related parts such as logging in, requesting lobby information, sending stats etc. However, game play part can be done at the Unity level. Have you checked out NetworkViews? There are RPC methods which are able to send messages to other Unity clients. When a new game is created, make one of two clients the Unity server. So that, it can send stats to server and handle gaming activities such as 'it's your turn' or 'piece X has moved to B5 etc.'. \$\endgroup\$ – Alican Jul 28 '14 at 18:33
  • \$\begingroup\$ You could keep the HTTP connection alive, and have the PHP script run for a long time, waiting for the other player to make a move. For instance by querying the database periodically, or using some other inter-process communication. Then you respond to the client. I'm not sure how long you can keep a connection open with WWW in Unity, though. \$\endgroup\$ – Sergio Jul 30 '14 at 10:55

Not the answer you're looking for? Browse other questions tagged or ask your own question.