-
Notifications
You must be signed in to change notification settings - Fork 7
Discord Rich Presence
This feature adds the ability for Discord to display the activity of a user playing Gardens of the Galaxy.
As Discord's own library, Discord Game SDK, uses C, C++, or C# and they do not provide any other way to enable this functionality, it was necessary to implement this featuring using an external wrapper library. The implementation used was to use discord-rpc by Vatuu. This library and the library it is a wrapper for Discord RPC are both depreciated, but there is no way to implement this functionality without using these library, thus, it was chosen to do so.
Within the current implementation, the Rich Presence is set through GDXGame
, as this Class is the game itself. This allows it so that activity can be updated as the screen changes such as between MAIN_MENU
, MAIN_GAME
, and SETTINGS
updating the state of activity between Perusing the Main Menu
, Planting Crops
, and Changing Settings
respectively. Additionally, any time a state is updated, startTimer()
is called to show how long a user has been active on one task.
Within the image below, an annotated description of each of the aspects of the rich presence is outlined. Through the Discord Activity Class the majority of this can be updated - excluding the Discord Application Name which is set through the Discord Developer Portal and is linked to its unique ID. The state, timer, small image, and large image can be updated by calling updateDiscordStatus()
, startTimer()
or stopTimer()
, updateSmallImage()
, and updateLargeImage()
.
Currently, the implementation was chosen to be only use the necessary sections, specifically, it was chosen to show no detail or small image. This was because these were redundant, took up more space while not conveying any important information as well as extending the text beyond the new icon designed by Team 2. This can be easily changed by updating the DiscordActivity
class.
Testing of this feature was not possible as it as it would require the ability to determine a users discord activity (which is not possible) or testing the library itself (which is not feasible or within the scope of this issue).
One issue that was not directly apparent from the offset was that discord-rpc does not support ARM based processors such as M1, or M2. Hence, when members of the studio attempted to build the project they ran into issue. Through the assistance of Team 1, a solution was implement that just simply does not run this functionality when a user is on MacOS. Whilst this may not be the most effective solution (as the user misses out on functionality), it was the only feasible solution to complete within the timeline of the sprint as otherwise it would have been necessary to re implement the feature in another manner.