I am developing a multipalyer web Application for Anti-Chess. It would be hosted on Google App Engine.

I have a few questions:

How do I get two different users who have opened the webapp on their browser to communicate moves with each other. P2P or through the server. If through the server, can I store some moves on it (specifically talking about GAE), to test bots later?

How to implement this P2P/Server connection. As a developer I know jack about Networking. But I hav heard of things like Socket programming, HTTP request etc, what can/should I use. And where can I read up on that!

If I don't go for GAE, would it cost me too much to get some server space and hosting capabilities? And people tell me that then deploying the application is tougher than on GAE. Is that so. Where can I read up on deploying the web Application on Servers.

Where does the code for networking go? I will be using Django with python as the web framework, front-end would be HTML, CSS, and JavaScript. Should I make a separate module for the networking methods and then introduce a method calls wherever needed in the game play?

Someone suggested me on using Unity software for developing. Is it good, Does it make it simple to do work? Will it cover all the parts of the development, the front end and the back end and the deployment?

Note: I am a first timer in web Application, I have coded games before, but always without GUI. And also with no multiplayer over the network capabilities!

3 Answers 3


If you want to communicate state between two participants in a game, one relatively simple way to do it would be to have a web service which allows each player to PUT the resource that represents the shared game state, with verification to make sure that they don't make illegal moves (or modify the other player's moves). This is an example of the logical flow:

  1. Assign each player a token, after they've authenticated (using an email, for example).
  2. Allow a player to invite another to play a game. This could take the form of sending a message to the other player, to which the other player could respond.
  3. If the invitee accepts, create a shared resource to which those two users have permissions, and communicate the URL to both player resources.
  4. Allow the web app to PUT representations of the game state to the shared resource. In the case of chess, a simple example would be to have a shared PGN file to which both users could write.

If you're interested in this approach, which would be an example of "SOA," or "service-oriented architecture," you might try SOA with REST or RESTful Web Services. This architecture is server-client oriented, not peer-to-peer; that has the advantage of being much simpler to implement.

You could implement your web services as separate routes within your Django project, and have AJAX calls from your Javascript front end which actually perform the actions related to the game state. I think Unity would be overkill for what you're trying to do; it's more about graphical games.

  • The logical flow I was going for is: 1. same 2. Just click to start playing game, and the application hooks you up with a random online player. ( I don't know how to achieve this, maybe 'create a shared resource to which those two users have permissions, and communicate the URL to both player resources.') 3. I would be communicating a string, representing a move, which is checked for legality, nothing else. That way I can also store it on my server to test a bot, if needed. Unity is overkill - ok! Then How do I develop these and integrate them with each other?
    – tmj
    Commented Apr 7, 2013 at 6:53
  • You can present the front end using Javascript. Using the Javascript graphics you're showing (they're really irrelevant to the logical flow...), communicate a move via an AJAX call to a web service. The web service can be implemented in Django or another web framework.
    – asthasr
    Commented Apr 7, 2013 at 21:28

As it's a web application, you can't communicate directly between clients, you must involve the server (in fact, to prevent cheating through hacked clients, I'd never implement anything like this as a p2p system, unless no state is ever sent to the server at all).
A REST or JSON call is probably easiest to achieve, each client sending its state to the server at regular intervals and getting validation and updated state of other clients in reply.


Well Time is a great "answerer"! Please bear with me as it is the first time I am answering my own question, and I am not much sure of First/Second/third person!

What can be done is: (I will answer to the specific questions I posted in the same order as asked)

  1. Through Server: One first has to understand, that the web browser only loads the HTML,CSS and JavaScript. With the help of HTML and CSS you can make the UI look like whatever you want it to be. The JavaScript enables you to add the dynamic part to it (the part which changes). Using AJAX would be better! Learn HTML, CSS, JavaScript, JSON for dummies here. Through P2P: It wouldn't be so great! For this, one would have to write all the game functions in JavaScript (something I would not chose over Death). And as I didn't read up much on it, I don't have much idea. GAE supports storing data, but you can only write it to a database (upto 1 GB of data) and not to files. I still have to study about exporting the moves database from GAE to my hard Disk (as in downloading) and reset the database so that I can reuse that space by periodically downloading the database contents.

  2. To learn the client side of HTTP requests after learning HTML, CSS, and JavaScript one can learn this here (in the first lecture itself, of the udacity course). I will list the server side of networking in point 4.

  3. Yes, hosting is costly, as compared to free, it is too costly, especially for a student like me, who doesn't intend to generate revenue of ads/sign ups!

  4. The server side can be dealt with the Django framework, which can be learnt on djangoproject.org or various other web resources (preferably crash courses, for small webapps like mine). Other than that, I can really not comment about the learning curve and ease, as I haven't yet got to that point.

  5. Unity is! OverKill!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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