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

Implementing a multiplayer game

The objective of this section is to implement what we have learned in the previous sections. We simply want to implement a spectator player, a player who simply launches our game can only view it. This simple implementation is a good start for the complete multiplayer game implementation.

Let's first understand the data that we need to communicate to our spectator client. In our game, currently we have nearly all static assets, except camera, bullets, and grenade. Also, the location/direction of bullet and grenade are derived from the camera location. So, all we need to communicate to the other client is:

  • Camera position, direction, left and up vectors
  • The bullet fire event and the bullet index that was fired
  • The grenade ...

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