Publishing /Discord Activities

Publishing

Discord Activities

Run your Codetoy game as a Discord Activity so you and your friends can play together in a voice call or DM.

Discord Activities are games and apps that run inside Discord, launched from a voice channel or DM. Any AssemblyScript codetoy can become one: Discord loads your build URL, and the game runs without any changes to your code.

Single player for now

Everyone in the call can launch the Activity, but each player runs their own copy of the game. Multiplayer, with a way to send messages between players, is planned. Join the Discord to hear when it ships.

#Before you start

You need:

  • An AssemblyScript codetoy. Builds and Activities don't support other languages yet.
  • A build of it and its URL, like https://3f9c2a1e-….codetoy.dev/.
  • A Discord account. Setup is easiest in the Discord desktop app; Activities also run on mobile.

#Set up your Activity

#Create a build

In the editor, open the Publish panel, press ▶ Play, then New Build → Capture & Save. Right-click the new build's address and copy the link. The Builds guide has the details.

#Turn on Developer Mode in Discord

In Discord, open User Settings → Advanced and turn on Developer Mode. This lets you launch Activities that aren't published yet.

#Create a Discord application

Go to the Discord Developer Portal and create a new application. The name you choose is what shows up in Discord's Activity list.

#Point the URL mapping at your build

In your application, open Activities → URL Mappings. Under Root Mapping, set the Target to your build's host, without https:// or a trailing slash:

Text
3f9c2a1e-7b4d-4c1a-9e8f-2d6b5a0c4e71.codetoy.dev

Save your changes.

#Enable Activities

Open Activities → Settings, turn on Enable Activities, and save.

#Launch it

Restart Discord so it picks up the new app. Then, in a DM or a server with fewer than 25 members, open the Activities launcher (the rocket button in a voice call or DM), find your app, and click Launch.

#Shipping updates

A build never changes, so when you update your game:

  1. Capture a new build in Codetoy.
  2. In the Developer Portal, replace the Root Mapping target with the new build's host.

Players get the new version the next time they launch the Activity.

#Inviting testers and going public

Until your app is published, only you (and testers you add) can launch it. Discord's Activities documentation covers adding test users, setting your app's icon and cover art, and making the Activity available to everyone.

#Tips for Activity-friendly games

  • Size to the window. Activities run at many sizes, from a tiny picture-in-picture tile to fullscreen on desktop and portrait on phones. Always read screen.width()Screen.Widthwidth() and screen.height()Screen.Heightheight(); never assume a fixed canvas.
  • Support touch. Lots of people play on their phones. Handle export function onTouchStart()Input.OnTouchStart()def touchStart() as well as clicks. See Handling Input.
  • Ask for a click first. Keyboard input needs focus, so a "Tap to start" screen helps.
  • Keep it light. Discord runs alongside your game, so a steady frame rate matters more than detail.

#Troubleshooting

My app doesn't show up in the Activities launcher. Check that Developer Mode is on, Activities are enabled for the app, and you've restarted Discord. The server must have fewer than 25 members.

The Activity opens to a blank or error screen. Check the URL mapping target: just the host (<build-id>.codetoy.dev), no https://, no path. Open https://<build-id>.codetoy.dev/ in a browser to confirm the build loads.

It's still showing an old version. Builds are immutable, so update the mapping to the new build's host, then relaunch the Activity.

My C# or Python game doesn't work. Activities need a build, and builds are AssemblyScript-only for now. See Choosing a Language.

Esc