Did you know that you can add Discord Rich Presence functionality to your own game? Thanks to BloxstrapRPC, you can do just that!
Some of you may already know what Bloxstrap is, some of you may not. One of its main standout features is the ability for it to show what game you’re playing through Discord Rich Presence. However, on top of this, it also provides the ability for games to control and customize what the Rich Presence looks like - but how?
Bloxstrap features BloxstrapRPC, a general-purpose one-way RPC mechanism for Roblox games to send data to external applications running on your computer. It’s intended to be more than just for Rich Presence, but right now that’s its only feature.
Here are some examples of developers who have integrated it into their games:
- Quantum Science Energy Research Facility, by Quantum Science Inc.
- Kit Battle Beta Testing, by @NobleReign
I’ll just clarify that you need to have a BloxstrapRPC-compatible application running on your computer for this to work. As of right now, there are three that exist: Bloxstrap (Windows only), Vinegar, and Applejuice (both Linux only). Though, anyone is free to make their own implementation of BloxstrapRPC. So, I’d say it’s worth looking into adding, even if you don’t or can’t use it.
Getting started
I’d recommend that you read up on the documentation for BloxstrapRPC, but I’ll briefly cover on how to get started with it here.
The BloxstrapRPC SDK provides you with everything that you’ll need, so go ahead and add that to your game. You can get it via the Roblox marketplace, roblox-ts, Wally, or GitHub.
Once you’ve done that, in any LocalScript, you can import it and call its methods. See the documentation for all the methods and types it makes available.
Here’s an example script that sets the user’s rich presence as soon as they join the game.
local BloxstrapRPC = require(game.ReplicatedStorage.BloxstrapRPC)
local timestamp = os.time()
BloxstrapRPC.SetRichPresence({
details = "Example details value",
state = "Example state value",
timeStart = timestamp,
timeEnd = timestamp + 60,
largeImage = {
assetId = 10630555127,
hoverText = "Example hover text"
},
smallImage = {
assetId = 13409122839,
hoverText = "Example hover text"
}
})
To test this out, publish the game to Roblox, and join it with Bloxstrap installed, and you should see this show up on your Discord profile.
It’s that easy! There is behaviour for persisting or resetting fields, so that you don’t need to re-specify all of the fields just for updating one thing. All of that is detailed in the documentation, of course.
Let me know how well it works for you, what you’d like to see be added, or if you have any problems using it.
Special thanks to @ElusiveEpix for suggesting this idea, and helping me out with this.