Getting Started
Welcome to the official documentation for the GD-Sync Plugin! GD-Sync is an easy to use all-in-one multiplayer plugin for Godot. Our goal is to make multiplayer development as easy and accessible as possible, so that developers from all levels of experience can create awesome multiplayer experiences.
Before you dive in, we want to emphasize that multiplayer development is no small feat. If you're inexperienced in this field, be prepared for a steep learning curve. Although our plugin eases some of the most difficult aspects, it doesn't make the inherent challenges disappear.
YouTube
GD-Sync has an official tutorial series. We highly recommend watching it, as it explain the basics of the plugin. It is a great starting point for making your awesome multiplayer game!
Discord
GD-Sync has an official Discord server, which we highly recommend joining. It’s the best place to connect with the community, ask quick questions, share feedback, and get support directly from other developers and the GD-Sync team.
Installation
The GD-Sync plugin can be installed using only a few clicks. Inside Godot, navigate to the Godot Asset Library and search for "GD-Sync". Once you have found the plugin, click on install.
Once the plugin has been installed, you have to enable it. To enable a plugin in Godot, you need to open the project settings. Head over to Project -> Project Settings -> Plugins. Once there, click the checkmark to enable GD-Sync.
Configuration
GD-Sync makes use of API keys to authenticate developers and their players. API Keys can be generated on our website. Once logged in, you can see an API Keys section on the navigation menu.
We highly recommend using a separate API key for each of your games. Lobbies are separated for each API key, using the same key for two different games means you will mix their lobbies together. Using separate keys also makes viewing statistics on the dashboard easier, since data is logged for each key.
In order to use an API Key, you can navigate to the GD-Sync configuration menu. The configuration menu can be found under Project > Tools > GD-Sync. The configuration menu contains two fields where you can enter both your public and private key. Once you have entered these correctly, you will be able to connect to our servers.
Basics
GD-Sync is a peer-to-peer plugin, which means clients connect to each other and gameplay logic is executed locally and/or on a host client. This is different from server-client setups, where gameplay logic is executed on a main authoritative server.
GD-Sync allows you to create and join lobbies, in which players can play together. Once in a lobby, clients can remotely call functions on other clients, synchronize variables, and use other useful features.
When developing your multiplayer game you will most likely follow this basic pattern:
- Execute gameplay logic as normal on all clients as if you were making a singleplayer game.
- Synchronize variables such as your player position to other clients using PropertySynchronizers.
- Call functions remotely on other clients in order to synchronize interactions or events, such when one player opens a door.
- Execute important logic such as NPC AI only on the host and use PropertySynchronizers and remote function calls to synchronize to other clients.
With GD-Sync installed you gain access to the GDSync singleton, which contains all functionality you might need to implement your multiplayer game. GD-Sync also comes with many custom types such as the PropertySynchronizer and NodeInstantiator, which are all explained right here in the documentation.
Make sure to watch our YouTube toturials in order to grasp the basics of the plugin!
Peer-to-peer is vulnerable to cheaters as gameplay logic is executed locally. For most co-op, party and casual PvP games this is not an issue. If you are planning to make a highly competitive PvP game, peer-to-peer is not recommended
Connecting
Connecting and going online using GD-Sync can be done with only a single function, GDSync.start_multiplayer() . Make sure to connect relevant signals so you will be notified if the connection handshake has succeeded or not. If the connection is successfully established the GDSync.connected() signal is emitted, if it fails the GDSync.connection_failed() signal is emitted.
You can check whether you are connected or not using GDSync.is_active(). If the client disconnects for any reason (server outage, poor internet connection, etc), the GDSync.disconnected() signal is emitted. The plugin does not automatically try to reconnect if the connection fails completely.