Skip to content
Blog

How to Implement Cross-Platform Multiplayer in Your Online Game

Multiplayer, the feature that will extend your game’s lifetime and give players endless possibilities. If you’ve designed your game for multiplayer play, that’s great! Even if you haven’t, adding online features will only benefit your game.

With the rise of countless game platforms and storefronts, you can embrace the diversity of platforms by implementing cross-platform multiplayer features. Doing so will enable you to reach as many player bases as possible. As long as you are committed, there are many ways you can accomplish this goal without redesigning your game from scratch, nor maintaining different builds and online services for each platform.

This article will show how you can implement cross-platform multiplayer in a Unity game by leveraging AccelByte’s platform. AccelByte’s backend services will be the centralized place where the game’s online features live, therefore freeing game developers from platform-specific restrictions.

Let’s get into it.

Overview

When people talk about cross-platform they’re usually referring to crossing the wall between consoles and PC, but in this article we specifically give examples of enabling cross-platform between a game publisher’s own platform (let’s call this AccelByte) and Steam. However, the same techniques can also be used to enable cross-platform play between consoles.

building steam backend services connection
AccelByte and Steam builds connecting to same AB Services

If you want to see the code applied to a real Unity game, take a look at our example Light Fantastic.

Account

First we have to know who the player is, meaning that we need to authenticate them. Each platform will have their own account system, but cross-platform means your game needs to recognize a user wherever she plays your game.

linking steam account to your user management service
AccelByte and Steam account linking

Users from Steam will play the game from Steam’s launcher, therefore using a Steam account, while others will play the game from the AccelByte Launcher by using an AccelByte account.

linking game on your platform to Steam
LightFantastic on Steam
linking game on steam to your platform
LightFantastic on AccelByte Launcher

Using the Account Management feature in AccelByte’s platform, we can unify different platform accounts into a single account, so that users can come from different platforms, or even multiple platforms, and the game can recognize them all. This is what we call account linking.

In the AccelByte platform configuration, we support account linking for many different platforms. In this example, we’ve already set up integration with Steam.

Steam account linking configuration
Steam integration on AccelByte admin dashboard

Doing so enables us to recognize when a user authenticates using a Steam or AccelByte account. A user can even have both accounts linked so that she can play from either platform.

linking game player account to steam account
Linked user account (Steam) on user interface

By integrating the AccelByte Unity SDK in the game client, there’s no difference between the Steam and AccelByte platform builds. The only difference is that we use an additional runtime parameter when launching the game from Steam’s launcher.

The AccelByte Unity SDK is integrated by dropping it into the game project, like so:

Unity Sample Project - Unity SDK integration
AccelByte SDK in LightFantastic project structure

And from the game code itself, we handle the user authentication by:

user authentication logic in the game code
Full logic code can be accessed on this GitHub page.

Since both platforms are OAuth2 compatible, the authentication UX will be roughly the same:

game launcher login flow - game development
steam launcher login flow - game development

Therefore, adding more platforms to link to will use a similar process.

Multiplayer

Now that we have a game that can recognize its users properly, we can leverage the unified accounts to let them play together, cross-platform.

It doesn’t matter if your game is P2P or using an authoritative server, you will need a way to get players together. AccelByte’s sample game uses an authoritative server per match managed by AccelByte’s platform.

Chatting and forming parties are two of the most basic multiplayer features. So we enable players to chat and create parties by connecting to AccelByte’s social services.

Lobby (full logic code):

building multiplayer game - matchmaking lobby

Party (full logic code):

building multiplayer game - matchmaking party

Chat (full logic code):

building muliplayer game - chat system
enabling party, guild, server, and player-to-player chat in your game
Party chat example in LightFantastic
building game players party in matchmaking system - game development - game backend
Party match example in LightFantastic 

The meat of a multiplayer game is of course playing together with (or against) others. By enabling matchmaking from AccelByte’s admin interface, we can let game clients request their users to be matched together.

easy and convenient game match configuration
Matchmaking configuration in AccelByte admin dashboard

Matchmaking (full logic code):

cross platform game match configuration
The match look in LightFantastic sample game

If you’re interested in bringing your multiplayer game cross-platform, send us an email at hello@accelbyte.io or reach out to us for a demo. We’d love to hear about your unique game!

Find a Backend Solution for Your Game!

Reach out to the AccelByte team to learn more.