Discord's new Embedded App SDK - How Colyseus fits in?
Create immersive, instant multiplayer experiences without downloads within the Discord App
Discord & The Embedded App SDK
Discord has long been the go-to platform for communication and community building among game developers & players. It provides the social layer where people hang out before, during, and after games.
Now, with the introduction of the Embedded App SDK, Discord has the potential to become a viable publishing platform for your HTML5 multiplayer games. This SDK enables developers to seamlessly integrate their experiences directly within the Discord app via an iframe.
Example: React Colyseus
The “React Colyseus Example” project made by the Discord team showcases how Colyseus can be used to power multiplayer games within a Discord Activity.
In this demo, the Embedded App SDK is used to detect whether the user starts or stops talking, and the game state is updated accordingly.
See the React Colyseus Example Project
In short, in this demo, Colyseus make it seamless to:
- Group players together in a game room, based on the
channelId
they are in. - Synchronize the game state between all players in real-time
Example: Webgame Template
The Colyseus Webgame Template has been updated to support the Embedded App SDK.
When launched via a Discord Activity, this demo will sign-in the user with Discord to identify its username and be able to store their score in the leaderboard.
Users that join directly from the website are matched together in the same game room.
Colyseus Webgame Template project
iframes, Content Security Policies and URL Mappings
One of the key highlights of the Discord Activities is its sandboxed environment - your app resides within a designated “discordsays.com” URL and is loaded via an iframe.
If your game requires access to external URLs or services, configuring “URL Mappings” via the app’s developer portal is a must:
Discord will act as a proxy for all requests made from your app, ensuring that the Content Security Policy (CSP) is enforced and that your app is secure.
The Embedded App SDK is currently in developer preview and has a few limitations. Soon Discord is going to introduce Discovery and Monetization options as well.