Game Development Reference
In-Depth Information
Figure 9-3. The offline game client created in this section
The game server
To set up the game server, you will need access to some computer running node.js ( www.nodejs.org ). This
can be your own computer (there is a Windows port of node.js) or some remote server. We are going to
run a WebSocket server on node.js. A WebSocket server can be written in a number of different
languages, but using node.js is the most convenient for us because we can share our JavaScript game
logic, with no modifications whatsoever, between the client and the server.
At the time of this writing, there are a few node.js add-on modules for creating WebSocket servers, but the
one we will use is called WebSocket-Node ( https://github.com/Worlize/WebSocket-Node ). First install
npm , the node.js package manager, and then issue the command npm install websocket to get the
module just mentioned. More explicit instructions for getting node.js up and running are found in this
chapter's appendix.
 
Search WWH ::




Custom Search