O'Reilly logo

WebGL Game Development by Sumeet Arora

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 10. 2D Canvas and Multiplayer Games

In all our previous chapters, we have discussed 3D rendering in-depth but have not discussed 2D rendering. In this chapter, we will discuss the canvas 2D context, which is a very important aspect of game development. The canvas 2D context offers a very powerful drawing API.

We will also discuss the concepts of HTML-based multiplayer games. We will then discuss Node.js and the Socket.IO API to implement a spectator player who can see what is happening in the game. In this chapter, we will cover:

  • Canvas 2D basics and the drawing API
  • 2D sprites for model labels and game scores
  • Real-time communication: HTTP long polling and WebSockets
  • Node.js: Socket.IO
  • Sample implementation of the multiplayer game: a spectator ...

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