Real-Time Gaming Blog

Broadcasting In-Game Notifications for Multiplayer Games

2 min readJoe Hanson on Jan 13, 2015
Try PubNub Today

Free up to 1MM monthly messages. No credit card required.

Subscribe to our newsletter

By submitting this form, you are agreeing to our Terms and Conditions and Privacy Policy.

This blog post/tutorial features Rect Rangle is a browser-based game using HTML5 and JavaScript, that uses PubNub for in-game notifications.

Ensuring a synced, real-time gaming experience in a multiplayer game is what truly puts the ‘multi’ in multiplayer. Sluggish movements, lag, and delayed connectivity ensure the opposite. As a result, real-time interaction between players is essential.

To showcase how PubNub Data Streams can power a multiplayer game, we proposed a Multiplayer Game App Challenge, where game developers built multiplayer games with PubNub. This blog looks at a submission from Erik Hazzard, who built Rect Rangle, a browser-based game using HTML5, JavaScript, Entity Component System, and real-time with PubNub of course!

in-game notifications

Rect Rangle is a simple game of eating white squares and avoiding black squares. You get points when you eat any square, and the goal of the game is to last as long as you can to get as high of a score as you can. Eating white scores replenishes your health; black squares lower your health.

Play the live working Rect Rangle demo here! And all the source code is available here.

PubNub powers all in-game notifications for Rect Rangle. Using PubNub, when you die, all other players will get your ghost (your position, name, and score are broadcasted) and players will receive a bonus upon eating your ghost.

PubNub = Powering Endless Multiplayer Features

Hazzard has a great blog post on ECS and game development that we strongly recommend checking out. You’ll see that with PubNub, you can do more than just ensure real-time lockstepping for player position. Like with Rect Rangle, in-game communication can run 100% over the PubNub Data Stream Network, like in-game notifications and chat, as well as statistics, game servers and even matchmaking based on skill or at random.

More from PubNub

Can Empathy Exist in the Metaverse
News May 16, 20221 min read

Can Empathy Exist in the Metaverse

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

PubNub Staff

How to Advance Telehealth and Virtual Care Technologies
News May 2, 20221 min read

How to Advance Telehealth and Virtual Care Technologies

Dr. Joe Kvedar, Chair of the Board for the American Telemedicine Association, joins our COO, Casey Clegg, to discuss why...

PubNub Staff

PubNub Staff

Another Step Towards Data Security: ISO-27001 Implementation
BuildMay 2, 20221 min read

Another Step Towards Data Security: ISO-27001 Implementation

Today, we are glad to announce that we are currently in the process of implementing ISO-27001 security standards.

PubNub Staff

PubNub Staff