Free up to 1MM monthly messages. No credit card required.
We’ve updated our SDKs, and this code is now deprecated.
Good news is we’ve written a comprehensive guide to building a multiplayer game. Check it out!
In our Multiplayer Game App Challenge, full stack developer Thomas Hunter built Robot Onslaught, a twin-stick multiplayer robot-shooting game.
Robot Onslaught used a number of different technologies to run entirely serverless, with PubNub sitting as the network transport layer, to ensure reliable and consistent peer-to-peer lockstep for user position. PubNub keeps data synchronized between the two (or any number of) clients.
We say, cool! Robot Onslaught is a great use case for where PubNub sits in multiplayer game development and communications. Let’s get to the action. You can play Robot Onslaught here. Open two browsers and shoot yourself, or force a friend to play with you and shoot your friend. Either way works.
You can also check out the full GitHub repo here, and we recommend also taking a look at Phaser.io, a game engine for HTML5 games.
In the simplest terms, when a user say moves their player on the screen, that player’s movement needs to be reflected in real time across every other user’s screen. So how do we do that?
You need to pass movements back and forth over PubNub through a private channel unique to each game, and animate those moves received from the remote opponent(s). One might think that the best way to do this is to send the entire state of the world to every other user whenever a state changes (ie. a user takes an action).
This is a recipe for lag. Instead, using PubNub, you can simply send an add/remove command to a channel everytime a user carries out an action. We have a multiplayer peer-to-peer lockstep tutorial and demo available here.
A roundtable discussion led by PubNub’s COO, Casey Clegg, exploring the topics of what it means to be human in a virtual world.
PubNub Staff
Dr. Joe Kvedar, Chair of the Board for the American Telemedicine Association, joins our COO, Casey Clegg, to discuss why...
PubNub Staff
Today, we are glad to announce that we are currently in the process of implementing ISO-27001 security standards.
PubNub Staff