Server side animation for multiplayer game installation

We are building some installation of a multiplayer game. Our computer (running a node.js server) projects the game on a large screen and the players connect with their mobiles through websockets (html5). We already figured out the client side (no need for animation there, only some buttons inputs), the question is how to connect the game visualization on the server side (either in processing or processing.js) with the clients. In particular:

  • can the server side javascript, which runs outside of a browser (from the terminal, using node.js) supports canvas-like graphics (eg., using raphael or processing.js) ?

  • alternatively, how can a processing sketch running on the server machine connect with nodejs?

any other solutions are welcome - thanks! jonathan

You need three parts here.

  1. clients with buttons, which you already have
  2. a node.js server, which you already have
  3. client with your game running in a browser on your wall.

Both (1) and (3) set up a websocket connection to node.js, and then you have node.js accept player input from (1), which it then sends to (3). The page at (3) should have the sketch running with a JS binding, and have a socket data handling function, so that when the handler function sees data coming from node, it can pass that on into your sketch, which can then update itself according to the input.

You don't need to run the game server-side, just run it client side using Processing.js (I assume your game is in Processing because of the tags you used for the question)