A Discord Game SDK integration for Godot

Godotcord

A Godot module to integrate the Discord GameSDK into the engine

This integration is not official and is not supported by the Discord GameSDK Developers.

Not every functionality of this module has been thoroughly tested. I advise against using it in production.

Godotcord currently compiles for Windows, Linux and Mac.

Setup

  • Clone the godot repository to a local directory
  • Checkout out at the 3.2.1-stable tag
  • Clone the godotcord repository into the modules folder

The following steps can all be done by running setup.bat (Windows) or setup.sh (Linux/Mac) in the godotcord directory.
If you want to do the setup on your own, here are the steps:

  • Download version 2.5.6 of the Discord Game SDK
  • Unzip the file
  • Copy the files in the cpp into a folder called 'discord-files' in the godotcord directory
  • Rename the x86 dlls to discord_game_sdk.32.dll and discord_game_sdk.32.dll.lib
  • Copy the all dll's and libs into a folder called libpath in the godotcord directory

The second last step is to recompile Godot.

The final step is to copy the following libraries into the same folder as the executable you compiled:

  • On Windows: Copy the .dll files
  • On Linux: Copy the .so file
  • On Mac: Copy the .dylib file and rename it to discord_game_sdk.dylib These files should be in /path/to/godot/modules/godotcord/libpath if setup correctly.

Notes

  • You can find precompiled versions as artifacts of the github actions. These versions are compile with target release_debug and all modules (and the editor) enabled. You will most likely get a warning from windows and macos because the executables are not signed.
    I can not include the shared libraries in the downloads. You have to download the Discord Game SDK yourself and copy the required shared library into the same directory as the executable.

  • On Mac the shared library will not be found automatically. Execute install_name_tool -add_rpath @executable_path GODOT_EXECUTABLE_NAME in the bin directory to fix this issue.

Contribution

If you encounter any problems, feel free to open an issue or join the discord server. You are also welcome to open PRs with improvements.

Documentation

The documentation can be found in the wiki

License

MIT License
The Discord GameSDK is licensed under the Discord Developer Terms of Service

Comments
  • Add a way to get members who're in a lobby.

    Add a way to get members who're in a lobby.

    Right now I'm trying to get the members in the lobby, but I can't find on how to do that, there's no documentation on how to do that or am I just being ignorant?

  • Fix 'copymem' does not exist compiler error

    Fix 'copymem' does not exist compiler error

    Fixes the following error on line 421 of godotcord_network_peer.cpp that causes the compile to fail on MinGW. error C3861: 'copymem': identifier not found

    Replaces copymem(&data[5], p_buffer, p_buffer_size) with memcpy(&data[5], p_buffer, p_buffer_size).

  • Parse Error: The identifier

    Parse Error: The identifier "Godotcord" isn't declared in the current scope

    I have this code in my script:

    func _ready():
    	Godotcord.init(CLIENT_ID, Godotcord.CreateFlags_NO_REQUIRE_DISCORD)
    	var acv = GodotcordActivity.new()
    	acv.state = "just"
    	acv.details = "a test"
    	acv.large_image = "512"
    	acv.large_text = "Left Out"
    	GodotcordActivityManager.set_activity(acv)
    
    func _process(delta):
    	Godotcord.run_callbacks()
    

    When I run the game inside the editor, it works fine, but when I export it, I get this:

    Error :(

    All the dlls are in the same game's directory.

  • Game SDK claims 'std' does not name a type (Godot 3.2.4 beta 4)

    Game SDK claims 'std' does not name a type (Godot 3.2.4 beta 4)

    I'm experiencing errors when trying to compile Godot 3.2.4 with Godotcord on Ubuntu 20.10 image This is with a fresh clone of both Godot and Godotcord, after running setup.sh I built with scons -j6 platform=x11 target=release_debug use_lto=yes tools=yes Could this be an issue with Godotcord or with the Game SDK?

    Does this compile on Linux for you @Drachenfrucht1?

    Specs: Godot 3.2.4 beta 4 Ubuntu 20.10

  • 3.2.4?

    3.2.4?

    What's your expectation for this compiling successfully into Godot 3.2.4 once it comes out? I can do it, just is there anything you foresee being a problem?

    Thanks for this btw. This is going to be a huge time savor for me and my team's project.

  • Use ReadTheDocs to host documentation.

    Use ReadTheDocs to host documentation.

    Hey, why not use ReadTheDocs, it's what Godot uses, and I'd recommend using it. Currently, I know you're using GitHub Pages, but it's better to use ReadTheDocs instead.

  • Error loading shared libraries on Linux

    Error loading shared libraries on Linux

    After removing all parts of the GameSDK that use std:: (for example std::int32_t becomes int32_t) and adding using namespace std; to types.h (to fix #20), the engine compiles successfully. But when I try to run an empty scene in an empty project, I get the following error: image Even though the file structure is correct: image

  • [BUG/HELP] Game exits without any error or message in godot output console.

    [BUG/HELP] Game exits without any error or message in godot output console.

    Problem: When I add the following line to any project with Godotcord and run the project, the game exits without any message or error. peer.create_lobby(port, public)

    Running Machine: ArchLinux

    File Structure:

    res://addons/my_path/plugin.gd

    tool
    extends EditorPlugin
    
    func _enter_tree() -> void:
    	add_custom_type(
    		"MyCustomServerNode",
    		"Node",
    		load('res://addons/my_path/server.gd'),
    		load('res://addons/my_path/assets/server.png')
    	)
    	if (not Engine.is_editor_hint()):
    		Godotcord.init(902336646891069450, Godotcord.CreateFlags_DEFAULT)
    
    func _process(delta: float) -> void:
    	if (not Engine.is_editor_hint()):
    		Godotcord.run_callbacks()
    
    func _exit_tree() -> void:
    	remove_custom_type(
    		"MyCustomServerNode"
    	)
    

    res://addons/my_path/server.gd

    extends Node
    
    export(int)  var port   : int                           = 8000
    export(bool) var public : bool                          = false
    
    var              tree   : SceneTree                     = SceneTree.new()
    var              peer   : NetworkedMultiplayerGodotcord = NetworkedMultiplayerGodotcord.new()
    
    func _ready() -> void:
    	peer.create_lobby(port, public)
    	tree.network_peer = peer
    
    func _exit_tree() -> void:
    	peer.close_connection()
    	tree.network_peer = null
    

    res://server.tscn Includes MyCustomServerNode

    Terminal Console Output:

    Running: /my/custom/godot/path/bin/godot.editor.64 --path /my/project/path --remote-debug 127.0.0.1:6007 --allow_focus_steal_pid 000000 --position 768,420 res://server.tscn
    
    handle_crash: Program crashed with signal 11
    Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
    [1] /usr/lib/libc.so.6(+0x3cda0) [0x7fc8839a2da0] (??:0)
    [2] discord::LobbyManager::GetLobbyCreateTransaction(discord::LobbyTransaction*) (/my/custom/godot/path/modules/godotcord/discord-files/lobby_manager.cpp:131)
    [3] NetworkedMultiplayerGodotcord::create_lobby(int, bool) (/my/custom/godot/path/modules/godotcord/godotcord_network_peer.cpp:38)
    [4] MethodBind2R<Error, int, bool>::call(Object*, Variant const**, int, Variant::CallError&) (/my/custom/godot/path/./core/method_bind.gen.inc:1717 (discriminator 12))
    [5] Object::call(StringName const&, Variant const**, int, Variant::CallError&) (/another/custom/godot/path/core/object.cpp:921 (discriminator 1))
    [6] Variant::call_ptr(StringName const&, Variant const**, int, Variant*, Variant::CallError&) (/another/custom/godot/path/core/variant_call.cpp:1112 (discriminator 1))
    [7] GDScriptFunction::call(GDScriptInstance*, Variant const**, int, Variant::CallError&, GDScriptFunction::CallState*) (/another/custom/godot/path/modules/gdscript/gdscript_function.cpp:1091)
    [8] GDScriptInstance::_ml_call_reversed(GDScript*, StringName const&, Variant const**, int) (/another/custom/godot/path/modules/gdscript/gdscript.cpp:1233)
    [9] GDScriptInstance::call_multilevel_reversed(StringName const&, Variant const**, int) (/another/custom/godot/path/modules/gdscript/gdscript.cpp:1242)
    [10] Node::_notification(int) (/another/custom/godot/path/scene/main/node.cpp:152)
    [11] Node::_notificationv(int, bool) (/another/custom/godot/path/./scene/main/node.h:46 (discriminator 14))
    [12] Object::notification(int, bool) (/another/custom/godot/path/core/object.cpp:933)
    [13] Node::_propagate_ready() (/another/custom/godot/path/scene/main/node.cpp:197)
    [14] Node::_propagate_ready() (/another/custom/godot/path/scene/main/node.cpp:186 (discriminator 3))
    [15] Node::_propagate_ready() (/another/custom/godot/path/scene/main/node.cpp:186 (discriminator 3))
    [16] Node::_set_tree(SceneTree*) (/another/custom/godot/path/scene/main/node.cpp:2565)
    [17] SceneTree::init() (/another/custom/godot/path/scene/main/scene_tree.cpp:464)
    [18] OS_X11::run() (/another/custom/godot/path/platform/x11/os_x11.cpp:3237)
    [19] /my/custom/godot/path/bin/godot.editor.64(main+0x12d) [0x146f6f3] (/another/custom/godot/path/platform/x11/godot_x11.cpp:57)
    [20] /usr/lib/libc.so.6(__libc_start_main+0xd5) [0x7fc88398db25] (??:0)
    [21] /my/custom/godot/path/bin/godot.editor.64(_start+0x2e) [0x146f50e] (??:?)
    

    What I Need: I need either an explanation as to what I am doing wrong, or a patch to fix a possible bug. Thank you.

  • Xml docs

    Xml docs

    This pull request adds xml documentation for the project. The xml docs will automatically be included in the engine and can be displayed in the engine (like the normal godot documentation).

    This pull request also includes a github action to automatically parse the xml docs and upload them to github pages. This way documentation has to only be written once.

  • Test Godotcord for Godot 3.3 release.

    Test Godotcord for Godot 3.3 release.

    As Godot is reaching 3.3, the current release 3.3rc9 went online 3 days ago, I'd recommend checking if Godotcord works with Godot version 3.3rc9 as well.

    Thank you.

  • Add get_connected_peers method to NetworkedMultiplayerPeer

    Add get_connected_peers method to NetworkedMultiplayerPeer

    Converts _peers list to Array and returns. However, I'm not completely sure if this will build, so I'm going to check the PR compile action results.

    Closes #30

  • WIP: Applications manager

    WIP: Applications manager

    Implements the application manager: Current problems:

    • get_ticket doesn't work at all, but I think it is discord's fault (there's an error in the client's dev console).
    • another external dependency is needed. I precompiled it for windows and Linux and a second download, but that is not an optimal solution. I will have to check again if Godot provides the functionality that is needed.
  • Game crashes with error

    Game crashes with error

    Game crashes with this error.

    Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
    [0] <couldn't map PC to fn name>
    [1] <couldn't map PC to fn name>
    [2] DiscordVersion
    [3] DiscordVersion
    [4] DiscordVersion
    [5] DiscordVersion
    [6] <couldn't map PC to fn name>
    [7] <couldn't map PC to fn name>
    [8] <couldn't map PC to fn name>
    [9] <couldn't map PC to fn name>
    [10] <couldn't map PC to fn name>
    [11] <couldn't map PC to fn name>
    [12] <couldn't map PC to fn name>
    [13] <couldn't map PC to fn name>
    [14] <couldn't map PC to fn name>
    [15] <couldn't map PC to fn name>
    [16] <couldn't map PC to fn name>
    [17] <couldn't map PC to fn name>
    [18] <couldn't map PC to fn name>
    [19] <couldn't map PC to fn name>
    [20] <couldn't map PC to fn name>
    [21] <couldn't map PC to fn name>
    [22] BaseThreadInitThunk
    -- END OF BACKTRACE --
    

    Can you please help me out?

    Edit: Only sometimes.

  • Implement User Manager, Overlays, Storage and Voice.

    Implement User Manager, Overlays, Storage and Voice.

    Hello, I need to use this for production purposes, because I can't find any other discord game sdk wrapper, would you like to implement other stuffs as well?

    Thank you very much for your help!

    Stuff needs to be implemented in godotcord:

    • [ ] Applications Manager #42
    • [x] Lobby Manager (WIP)
    • [x] Storage Manager #44
    • [x] Voice Manager #54
Discord-dl: a tool to archive discord channels

discord-dl discord-dl is a tool to archive discord channels. I think it's safe t

May 18, 2022
Discord-notif - Send notifications to discord in Your pipelines or scripts
Discord-notif - Send notifications to discord in Your pipelines or scripts

discord-notif Send notifications to discord in Your pipelines or scripts install

Dec 15, 2022
Discord-finder - The back-end for retrieving information about people on discord
Discord-finder - The back-end for retrieving information about people on discord

About This is the backend application for Discord Finder, it allows you to retrive information about people on discord just like the discord lookup we

Jan 4, 2022
Discord-bot - A Discord bot with golang

JS discord bots Install Clone repo git clone https://github.com/fu-js/discord-bo

Aug 2, 2022
Wipe-discord - TUI application to erase Discord messages
Wipe-discord - TUI application to erase Discord messages

wipe-discord Terminal user interface (TUI) application to delete Discord message

Aug 21, 2022
Discord webhooks dispatcher for the ZUnivers card game (not affiliated)
Discord webhooks dispatcher for the ZUnivers card game (not affiliated)

ZUnivers-Webhooks Discord webhooks dispatcher for the ZUnivers card game. Disclaimer This is project is not affiliated with the ZUnivers's project. It

Sep 28, 2022
A Discord bot for managing ephemeral roles based upon voice channel member presence.
A Discord bot for managing ephemeral roles based upon voice channel member presence.

ephemeral-roles A Discord bot for managing ephemeral roles based upon voice channel member presence. Quickstart Click on the Ephemeral Roles logo head

Dec 19, 2022
Bot used for https://discord.gg/rflutterdev

FlutterDoc A bot offering exactly what we need in The r/FlutterDev Discord Server that Dyno can't offer us. Quick search patterns that can be embedded

Dec 8, 2022
Harmony is a peaceful Go module for interacting with Discord's API

Harmony Harmony is a peaceful Go module for interacting with Discord's API. Although this package is usable, it still is under active development so p

Sep 18, 2022
An easy-to-use discord bot written in go

Discord Bot An easy-to-use discord bot template written in golang using discordgo. This template was written for learning golang. It will be updated a

Jan 23, 2022
discord exploit tools written in golang

The ultimate CLI tool for TiKV

Aug 19, 2021
An extension for discordgo to create a Discord bot quickly using the Builder pattern.

botbuilder An extension for discordgo to create a Discord bot quickly using the Builder pattern. Example usage: package main import ( "log" "os"

Oct 12, 2022
Discordo is a lightweight, secure, and feature-rich Discord terminal client.
Discordo is a lightweight, secure, and feature-rich Discord terminal client.

discordo ยท [WIP] Discordo is a lightweight, secure, and feature-rich Discord terminal client. It is highly configurable and has a minimalistic user in

Jan 5, 2023
Formats discord tokens to different formats.
Formats discord tokens to different formats.

token_formatter Formats discord tokens to different formats. Features Format your current tokens to a new format! Every tool uses a different format f

Nov 3, 2022
Bot para o discord escrito em Golang durante o workshop ministrado na Codecon 2021

Codecon Bot Bot para o discord escrito em Golang durante o workshop ministrado na Codecon 2021 Primeiramente no arquivo main.go coloque o TOKEN do bot

Oct 4, 2021
A discord bot that watches for tiktok URL's and automatically uploads the corresponding video to the channel

TikiTok Bot A Discord bot that watches for TikTok URLs and sends a message to the channel with the corresponding video attached Click to invite the bo

Jul 28, 2022
morko discord bot with go

Commands Command Description commands Lists commands google Fetches a Google image help Describes the usage of the command. ping Ping

Oct 19, 2021
An easy to use relay for cftools webhook events piped to Discord when filter rules match.

CFTools Relay CFTools Relay is an easy-to-use, still in development, tool that allows you to subscribe to CFTools Cloud Webhook events and forward the

Nov 22, 2022
Discord rich presence for MPRIS music players.
Discord rich presence for MPRIS music players.

Clematis Discord rich presence for MPRIS music players. Clematis provides a rich presence for MPRIS-supported music players. It will take information

Dec 20, 2022