Play
Dynamically assemble and match players
Dynamically assemble and match players
Connect cross-platform accounts & identity management
Grow and commercialize your game
Build a vibrant community
Track player progression and game state across platforms
Track, engage, and retain players
Visualize game metrics
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.
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.
If you want to see the code applied to a real Unity game, take a look at our example Light Fantastic.
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.
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.
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.
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.
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:
And from the game code itself, we handle the user authentication by:
Since both platforms are OAuth2 compatible, the authentication UX will be roughly the same:
Therefore, adding more platforms to link to will use a similar process.
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):
Party (full logic code):
Chat (full logic code):
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.
Matchmaking (full logic code):
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!
Reach out to the AccelByte team to learn more.