Joe Hanson
Senior Content Strategist, PubNub

    Subscribe to Our Newsletter

    Stay updated with the latest on web, mobile, and IoT, delivered weekly.
    Thanks for subscribing!

    Thanks for subscribing!

    Get ready for some great content.

    Ensuring a synced, realtime 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, realtime 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 realtime 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 realtime 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.