#discord #sdk #gamedev

discord_game_sdk

Safe wrapper for the Discord Game SDK

11 releases (4 breaking)

✓ Uses Rust 2018 edition

new 0.5.0-alpha.3 Dec 1, 2019
0.5.0-alpha.2 Nov 25, 2019
0.4.1 Nov 21, 2019
0.3.1 Aug 1, 2019
0.1.0 Mar 27, 2019

#55 in Game development

Download history 1/week @ 2019-08-17 44/week @ 2019-08-24 33/week @ 2019-08-31 8/week @ 2019-09-07 21/week @ 2019-09-14 55/week @ 2019-09-21 12/week @ 2019-09-28 9/week @ 2019-10-05 8/week @ 2019-10-12 7/week @ 2019-10-19 13/week @ 2019-10-26 13/week @ 2019-11-02 4/week @ 2019-11-09 67/week @ 2019-11-16 53/week @ 2019-11-23

98 downloads per month

Apache-2.0 OR MIT

205KB
4K SLoC

Safe wrapper for the Discord Game SDK

This crate is not official, it is not supported by the Discord Game SDK Developers.

This crate provides Rust support to the following Discord features:

  • Activities (Rich Presence)
  • Users, Avatars and Relationships
  • Lobbies, Matchmaking and Voice communication
  • Faux-P2P Networking
  • Cloud Synchronized (or not) Storage
  • Store transactions
  • Achievements
  • ...

https://docs.rs/discord_game_sdk

https://crates.io/crates/discord_game_sdk

Requirements

Usage

Add this to your Cargo.toml:

[dependencies]
discord_game_sdk = "0.5.0-alpha.1"

Set the following environment variable:

export DISCORD_GAME_SDK_PATH=/path/to/discord_game_sdk

Ensure that appropriately named dynamic libraries are available when launching the program:

On Linux and OS X, the dynamic library must be renamed to libdiscord_game_sdk.so or libdiscord_game_sdk.dylib.

(TODO: ^ might be unnecessary, how to set the rpath in the output binary)

Status

This library is currently in early stages but is stabilizing. It is usable. I'm not aware of any good ways to test this crate, there are currently no tests.

Features:

  • link: (enabled by default, delegates to discord_game_sdk_sys/link) Provides the linker with an appropriately named dynamic library. This allows for cargo run to run flawlessly on Linux.

Safety

This crate relies on the SDK to provide correct data and behavior:

  • Non-null pointers to valid memory
  • UTF-8, NUL-terminated strings
  • No mutation of memory it should have no ownership of
  • No use of pointers after destroy is called

Legal

You MUST acquaint yourself with and agree to the official terms of the Discord Game SDK.

The code of the Rust crates discord_game_sdk and discord_game_sdk_sys are licensed under either of:

at your option.

Communication and Support

I can be reached via Discord twiikuu#0047, on the Official Game SDK Server (nicked as ldesgoui (rust wrapper)), as well as twitter and email. I reserve myself no obligation to support you, although I'm generally nice.

Dependencies

~1.2–2.9MB
~60K SLoC