Broadcasting In-Game Notifications for Multiplayer Games
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.
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.
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.