O'Reilly logo

Pro HTML5 Games by Aditya Ravi Shankar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CHAPTER 11

image

Multiplayer with WebSockets

No matter how challenging we make a single-player game, it will always lack the challenge of competing against another human being. Multiplayer games allow players to either compete against each other or work cooperatively toward a common goal.

Now that we have a working single-player campaign, we will look at how we can add multiplayer support to our RTS game by using the HTML5 WebSocket API.

Before we start adding multiplayer to our game, let’s first take a look at some networking basics using the WebSocket API with Node.js.

Using the WebSocket API with Node.js

The heart of our multiplayer game is the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required