Installation

The first step to using W4 Cloud services in your project is to add the W4GD GDScript SDK Godot addon. You can find the latest release at https://gitlab.com/W4Games/sdk/w4gd/-/releases.

Requirements

The W4GD GDScript SDK requires the following to access most features:

  • Godot Engine 4.0+

  • Network access to W4 backend servers

  • The Anonymous API key provided in the project dashboard (under DOCS > API in the menu)

Copy W4GD into your project

The quick and easy way is to download W4GD from the repository:

  1. Browse to the release you want to install (e.g. the latest one)

  2. Locate the w4gd.zip download link at the bottom (latest w4gd.zip)

  3. Download and unzip it

  4. Move the contained folder to Godot's addons/ folder (you may need to create the addons/ folder in your project root folder if you haven't installed any addons yet)

  5. The addon should now live at addons/wg4d/, you may want to rename the folder to w4gd if it was named w4gd-<version> or similar in the download

Alternatively, you can add the W4GD addon as a Git Submodule.

Either way, you may want to make note of the W4GD version you are now using. If you run into issues, checking whether an updated SDK containing bugfixes is available can be helpful.

Consider committing your addons to version control software to easily track them (also known as vendoring dependencies).

Enable W4GD addon

After you copied addons/wg4d/ into your project as described above, start the Godot Editor. Open Project > Project Settings and locate the Plugins tab. You should see the W4GD addon listed. Set it to Enabled.

Screenshot of the Project Manager with the W4GD addon enabled

Note

As of Godot 4.2, you may see errors such as Parse Error: Identifier "W4GD" not declared in the current scope. the first time you open the project after copying the addons/w4gd/ folder. This is a known Godot issue. Restarting the editor should fix it.

Set URL and key in W4 dock

Once the W4GD addon is enabled, you will see the W4 Cloud panel in the list of the screens at the top of the editor:

../_images/install-w4-cloud-screen.png

Navigate to the W4 Cloud screen. To the left, you will see your workspace settings:

Screenshot of the W4 dock

The W4 screen allows you to manage various settings like API keys or which servers and databases to connect to in multiple profiles. Different profiles allow you to set different settings for example for live or production servers and test or development servers, so your project connects to different backend systems depending on the profile.

For now, you want to edit the Default profile and add the URL and API key to your backend. Note that the settings are locked by default and can only be edited after unlocking them by clicking on the lock icon.

  1. Unlock the default settings by clicking on the lock icon (it should switch to an unlocked lock icon and the settings should become editable)

  2. Enter the URL to your backend (in the form of https://<project>.w4games.cloud/)

  3. Enter the Anonymous API key for your backend (you can find the API keys under DOCS > API in your dashboard, or browse directly to https://<project>.w4games.cloud/dashboard/docs/api/, see also About API keys below)

  4. Re-lock the settings by clicking the lock once again and save your project.

Screenshot of the W4 dock with filled in URL and API key

About API keys

You generally want to use the Anonymous API key. This API key is intended to have the least privileges. The intention is for users to use it to then authenticate and be granted a more privileged personal key that is allowed to access (and change) more data.

The Service API key is privileged and should only be used for administrative tasks.

Warning

Make sure to never distribute your Service API key. Do not include it in your distributed project's code, avoid putting in in your version control system.

Handle the Service API key like an admin password or secret, because it is.