Giter Site home page Giter Site logo

discord-game-sdk4j's Introduction

discord-game-sdk4j

This project provides Java bindings for the Discord GameSDK.

To be honest I'm not sure if people even need this, because Discord apparently discarded its game store idea.

But maybe the activity, overlay, user, and relationship features could be useful to some people.

Rich Presence

If you are just looking for an alternative to the deprecated Discord Rich Presence SDK, head over to the ActivityExample.java!

Features of the SDK

Feature State Example
Achievements ❌ not implemented
Activities ✔️ implemented ActivityExample.java
Applications ❌ not implemented
Voice ✔️ implemented VoiceExample.java
Images ✔️ implemented none yet 😢 (see imageTest() for now)
Lobbies ✔️ implemented LobbyExample.java
Networking ✔️ implemented NetworkExample.java
Overlay ✔️ implemented none yet 😢 (see overlayTest() for now)
Relationships ✔️ implemented RelationshipExample.java, FriendNotificationExample.java
Storage ❌ not implemented
Store ❌ not implemented
Users ✔️ implemented none yet 😢 (see userTest() for now)

I will try to work on features that are not implemented yet soon, but the remaining ones are quite difficult to test, so I don't know how much progress I can make on them.

Installation

Pre-compiled

Maven, Gradle and other build tools

There are pre-compiled builds on JitPack together with instructions how to use them for all common build tools.

Manual installation

For projects not using any build tools, download a pre-compiled JAR-file (discord-game-sdk4j-<version>.jar) from the releases page.

If you want, you can also download the JavaDocs (discord-game-sdk4j-<version>-javadoc.jar) or the sources (discord-game-sdk4j-<version>-sources.jar).

You do not need to download the .dll or .so files! They are packed in the JAR and will be automatically extracted.

After downloading those JARs, just add the main JAR to your project's classpath and optionally attach sources or JavaDocs.

Building from source

To install the library from source first of all clone the repository:

git clone https://github.com/JnCrMx/discord-game-sdk4j.git

To obtain the native libraries you can build them from source too (see below) or just download them:

sh jitpack-download-natives.sh

Finally build (and install) the library with Maven:

mvn install -Dmaven.antrun.skip=true

If you want to skip the tests (sometimes they fail for really weird reasons), add -DskipTests to the command arguments.

Building the native library from source

To build the native libraries from source make sure you have CMake, a compiler that works with CMake (e.g. gcc) and a JDK11 installed and properly set up.

Then download Discord's native library and extract it to ./discord_game_sdk/.

The CMake build system is integrated in Maven, so just execute to following command to build and install the Java and native library:

mvn install

Usage

To use the library, you first need to download Discord's native library. Extract the ZIP file and remember where you put it.

In code the first step is initializing the Core. To do this you need to pass the path to Discord's native library as an argument. You can find this library in the directory you just extracted the ZIP file at lib/x86_64/discord_game_sdk.dll (for 64-bit Windows) and lib/x86_64/discord_game_sdk.so (for 64-bit Linux):

Core.init(new File("<path to the native library>"));

Now you are ready to use the library!

try(CreateParams params = new CreateParams())
{
    params.setClientID(<your application ID as a long>);
    params.setFlags(CreateParams.getDefaultFlags());

    try(Core core = new Core(params))
    {
        // do something with your Core
    }
}

For real examples see the examples/ directory in this repository.

discord-game-sdk4j's People

Contributors

chrislo27 avatar gamer153 avatar jncrmx avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.