Skip to main content
Version: 2.0.0

1 - Setup

Unity Tutorial Hero Image

Need help with the tutorial? Join our Discord server!

A completed version of the game we'll create in this tutorial is available at:

https://github.com/clockworklabs/SpacetimeDB/tree/master/demo/Blackholio

Setting up the Tutorial Godot Project

In this section, we will guide you through the process of setting up a Godot Project that will serve as the starting point for our tutorial. By the end of this section, you will have a basic Godot project and be ready to implement the server functionality.

Step 1: Create a Blank Godot Project

SpacetimeDB supports Godot version 4.6.2 or later. See the overview for more information on specific supported versions.

Open Godot and create a new project by selecting "+ Create" from the Project Manager.

// TODO: THIS IMAGE MUST BE UPDATED Godot Project Manager

For Project Name use blackholio. For Project Location select a directory that you can navigate to via the CLI because we will need to do so in part 2.

Create Project

Any Renderer will work.

Click "Create" to generate the blank project.

Import the SpacetimeDB Godot SDK

We will add the SpacetimeDB SDK using NuGet. Godot does not initialize a C# Project when creating a new Godot project, so we need to create a C# Script first to initialize our Godot C# Project.

  1. Right-click in the FileSystem dock, then select New Script.
  2. Select C# in Lanugage and name it GameManager. We will use this script later to put the high level initialization and coordination logic for our game.

Create GameManager Script

  1. Add the SpacetimeDB.ClientSDK NuGet package using Visual Studio or Rider NuGet Package Manager or via the .NET CLI:
dotnet add package SpacetimeDB.ClientSDK.Godot

The SpacetimeDB Godot SDK provides helpful tools for integrating SpacetimeDB into Godot, including a connection update manager which will synchronize your Godot client's state with your SpacetimeDB database in accordance with your subscription queries.

Create a new Scene

  1. Create a 2D Scene:
    • In the Scene Dock (usually on the top left), click on Create Root Node: -> 2D Scene.
    • Alternatively, you can click the + button to add a child node and select a Node 2D.

Create 2D Scene

  1. Rename the Node:

    • In the Scene dock, double-click on the newly created node (or right-click -> rename) and rename it to Main.
  2. Attach the GameManager Script:

    • Drag and drop the GameManager script from the Scene dock onto the Main Node in the Scene window.

You will see a warning saying This inspector might be out of date. Please build the C# project.. This is because Godot doesn't automatically compile our C# project and we need to run the game for the compilation to take place. Let's do that.

  1. Save current Scene:

    • Press Ctrl + S (or Cmd + S on Mac) to save the current scene. Name it main.tscn.
    • Alternatively, go to Scene -> Save Scene As.
  2. Run Project and build C# Project:

    • Press F5 (or Cmd + B on Mac) to run the project, click on Select Current to select the current scene as the main one.
    • Alternatively, you can click on the play button in the top menu.

Our Godot project is all set up! If you press play, it will show a blank screen, but it should start the game without any errors. Now we're ready to get started on our SpacetimeDB server module, so we have something to connect to!

Create the Server Module

We've now got the very basics set up. In part 2 you'll learn the basics of how to create a SpacetimeDB server module and how to connect to it from your client.