clandrew / wdrp

Discord Rich Presence Winamp plugin
MIT License
106 stars 12 forks source link

Implement Discord Game SDK #15

Closed derekgates closed 4 years ago

derekgates commented 4 years ago

As mentioned in the README.md:

Q: How come the status says "Playing a game" instead of "Listening to" like with Spotify?

A: The Discord RPC library doesn't (at the time of writing this) currently expose a way of changing this UI element. The status for Spotify worked because Discord gave Spotify special treatment. If it comes to be that the RPC library adds flexibility of changing this, I'd be interested in adopting it.

Update (6/28/2019): it looks like Discord is distributing a new SDK called GameSDK, and ultimately the RPC SDK will become deprecated. From a quick glance at the docs, it looks like the new SDK supports the ability to customize this. If so, great! I think it is kind of a hassle I need to move the plugin to a new SDK just to get this small feature, but I suppose they are phasing out the RPC SDK anyway. I can take a look at GameSDK and see how easy or hard it is to make it work and start there.

To implement:

https://discordapp.com/developers/docs/game-sdk/sdk-starter-guide#code-primer-unreal-engine-c

And the relevant "Activity" that this plugin must use:

https://discordapp.com/developers/docs/game-sdk/activities

clandrew commented 4 years ago

This is a nice thought. Sadly, it happens that I prototyped this, and ActivityType did not do what it's purported to. https://github.com/discordapp/discord-api-docs/issues/1002#issuecomment-511146691

I don't feel motivated in doing anything for this. but thanks for getting in touch.

derekgates commented 4 years ago

Well that's a bummer, I was going to experiment in a PR for this. If you don't see a need then perhaps the README could be updated?

I was hoping that the Game SDK would be able to replicate the dynamic popup like Spotify:

image

So, even if we can't set the ActivityType I was thinking the status could be enhanced?

I don't expect you to have to do all of this.. I was just seeing if you had interest and wanted a PR for it...

clandrew commented 4 years ago

The Spotify ism would have been awesome. A hundred percent.

If you're curious, I pushed a quick test here: https://github.com/clandrew/wdrp/blob/gamesdk/DiscordRichPresence_GameSDK/DiscordRichPresence_GameSDK.cpp

The interaction I had with the above linked issue made me lose a lot of confidence in moving to the new SDK. Now, that being said, maybe they fixed it but didn't get the word out. If you happen to find this out please let me know.

derekgates commented 4 years ago

I... just... realized... it was you that opened the Issue on the gamesdk github.

image

Alright, I'll focus on any other items then! hahaha

derekgates commented 4 years ago

I just noticed

Q: Can I send images via the payload rather than uploading them to my Developer Dashboard? Unfortunately, the SDK does not support this feature right now. However, we hear your desires! We know that a lot of games, like customization-heavy RPGs, would benefit greatly from being able to programmatically upload assets. It may be something we tackle in the future.

So even if we wanted some of the spiffy aspects of Spotify presence we would be ham-stringed. All we could achieve is the change of some text, a 'larger logo' and... yeah.

ONE DAY.

clandrew commented 4 years ago

@derekgates EXACTLY. This was another bad episode of expectations v. reality for upgrade to Discord SDK. I thought that surely, they would consider adding this if they were overhauling the SDK anyway, but apparently no.

I had a different idea for how to fix this but it's terrible and icky. Like, really really bad.

derekgates commented 4 years ago

For real. What a let down. It seems to be for the 'big dogs' in the space (Steam games, Spotify, etc). Maybe it is also lack of feedback from devs like me who had no clue Discord could do all of this? hmm.

I had a different idea for how to fix this but it's terrible and icky. Like, really really bad.

hahaha... is it something like sending static images and rotating them in/out as the user plays? :D

clandrew commented 4 years ago

Okay... here goes. What we know is that, how many people are using this plugin concurrently? Not that many, right. The other thing is Discord lets you upload a max of 140 image assets. That's not super high, not super low. So what if we

1) When you play a song, we get the art from Winamp. 2) Upload the art image to some web service 3) The web service can talk to a Discord developer account, and upload the image there as one of the 140. Web service assigns the image a name, like a hash 4) Web service gives the hash back to the plugin 5) Plugin references the hash when talking to Discord

You would want to have the cache be able to re-use images that are already stored, if the same one gets requested more than once. And also delete old images to stay under the 140 limit.

The hardest part here is 3) because guess what. Programmatic upload your image to Discord? Nope. All Discord developer account images last I checked need to be uploaded via their web app. This is not insurmountable, but it does make things pretty hard. Even if hypothetically you create a program that can send the right HTTP POST whatever to do the upload, it's brittle. The minute they change their web site, possibly even in small ways, it would break the system.

So this is an idea. It is not really a good idea. It is also, say, 500 effort points where I am only willing to spend 20

clandrew commented 4 years ago

Related link https://github.com/discordapp/discord-rpc/issues/70

derekgates commented 4 years ago

hahahaha, that is deliciously complicated. Agree on the effort points. Holy moly imagine that 'intro to Winamp Discord Plugin' and all of the setup required to get that working for an individual! :D

If the plugin gets to a state in which there is nothing more to do, I'd love to experiment with this more.

Hell, maybe by then the 'upload by hash' will be implemented. It's a good idea to poke/update https://support-dev.discordapp.com/hc/en-us/community/posts/360043570772-Allowing-upload-of-assets-via-Hash