Skip to content

Commit 65ef814

Browse files
Second pass on documentation
1 parent 8da46a8 commit 65ef814

7 files changed

Lines changed: 237 additions & 217 deletions

File tree

docs/docs/unreal/index.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ This tutorial assumes that you have a basic understanding of the Unreal Engine,
1414

1515
We’ll keep things intentionally simple: a single “Game Manager” class, minimal error handling, and hardcoded settings where convenient. This makes the SDK flow easy to see. For production, prefer Unreal’s Subsystems, move secrets out of code, follow best practices, and add proper logging/retry.
1616

17-
SpacetimeDB supports Unreal Engine version `5.6` or later, and this tutorial has been tested with the following Unreal versions:
18-
- `5.6`
19-
> REVIEW: We should be able to support 5.3+ as C++20 became the default + minimum; however current build has been on 5.6; do we want to look into earlier versions of UE, not everyone jumps on the latest for stability reasons?
17+
SpacetimeDB supports Unreal Engine version `5.6`. This tutorial has been tested only with that version.
2018

2119
This tutorial is written for C++, but the SpacetimeDB Unreal client SDK also supports Blueprints! Stay tuned for a Blueprint-based tutorial.
2220

docs/docs/unreal/part-1.md

Lines changed: 51 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,16 @@ In this section, we will guide you through the process of setting up a Unreal Pr
2828

2929
### Step 1: Create a Blank Unreal Project
3030

31-
SpacetimeDB supports Unreal version `5.6` or later. See [the overview](.) for more information on specific supported versions.
31+
SpacetimeDB supports Unreal version `5.6`. See [the overview](.) for more information on specific supported versions.
3232

3333
Launch Unreal 5.6 and create a new project by selecting Games from the Unreal Project Browser.
3434

35-
> ⚠️ Important: Select the **Blank** template and in **Project Defaults** select **C++**.
35+
> ⚠️ Important: Select the **Blank** template and in **Project Defaults** select **C++**.
3636
37-
For `Project Name` use `client_unreal`. For Project Location make sure that you use your `blackholio` directory. This is the directory that we created in a previous step.
37+
For **Project Name** use `client_unreal`.
38+
For **Project Location**, use your `blackholio` directory (created in the previous step).
3839

39-
Click "Create" to generate the blank project.
40+
Click **Create** to generate the blank project.
4041

4142
![Create Blank Project](./part-1-01-create-project.png)
4243

@@ -48,8 +49,6 @@ While the SpacetimeDB Unreal client SDK is in preview releases, it can only be i
4849
4950
Once the SDK is stabilized, we'll find a more ergonomic way to distribute it.
5051

51-
> REVIEW: We need to decide how we'll share the SDK (eventually we should host with Fab.com and they can add it like any normal Unreal plugin)
52-
5352
Before beginning make sure to close the Unreal project and IDE.
5453

5554
Add the SpacetimeDB Unreal SDK by first adding a new plugin folder:
@@ -59,75 +58,74 @@ md Plugins
5958
```
6059
Copy the SpacetimeDbSdk to the new Plugins folder. This should create `/client_unreal/Plugins/SpacetimeDbSdk`.
6160

62-
In the root of the Unreal project, right click the client_unreal.uproject and select **Generate Visual Studio project files**.
61+
In the root of the Unreal project, right click the client_unreal.uproject and select **Generate Visual Studio project files**.
6362

6463
![Generate project files](./part-1-02-generate-project.png)
6564

6665
### Create the GameManager Actor
6766

68-
1. Open the `client_unreal` project. Unreal will prompt you to build the `SpacetimeDbSdk` module. Do so.
69-
2. Open **Tools > New C++ Class** in the top menu, select **Actor** as the parent and click **Next**
67+
1. Open the `client_unreal` project. Unreal will prompt you to build the `SpacetimeDbSdk` plugin. Do so.
68+
2. Open **Tools -> New C++ Class** in the top menu, select **Actor** as the parent and click **Next**
7069
3. Select **Public** Class Type
71-
4. Name the script `GameManager`.
72-
73-
The `GameManager` script will be where we will put the high level initialization and coordination logic for our game.
70+
4. Name the class `GameManager`.
7471

75-
> Typically with Unreal you would use a Subsystem for this but to keep the tutorial simple we'll stick with a singleton actor.
72+
The `GameManager` class will be where we will put the high level initialization and coordination logic for our game.
7673

77-
### Setup the Level
74+
> Note: In a production Unreal project, you would typically implement this logic in a Subsystem. For simplicity, this tutorial uses a singleton actor.
7875
79-
Let's set up the basic level, add our new GameManager to the level and a little lighting cleanup for our 2D setup.
76+
### Set Up the Level
8077

81-
1. **Create a new Level**:
82-
- Open `File > New Level` in the top menu, and select Empty Level and click **Create**.
83-
- Save the level and name it `Blackholio`
78+
Set up the basic level, add the new `GameManager` to the level, and add lighting.
8479

85-
2. **Create GameManager Blueprint**:
86-
- In the **Content Drawer**, click **Add**, select `Blueprint > Blueprint Class`
87-
- Expand **All Classes**, search for `GameManager`, highlight it, and click **Select**
88-
- Name the blueprint `BP_GameManager`
80+
1. **Create a new level**
81+
- Open **File -> New Level** in the top menu, select **Empty Level**, and click **Create**.
82+
- Save the level and name it `Blackholio`.
8983

90-
3. **Update Maps & Modes**:
91-
- Open `Edit > Project Settings` in the top menu, select `Project > Maps & Modes` on the left.
92-
- Update **Editor Startup Map** to the new `Blackholio` map
93-
- Update **Game Default Map** to the new `Blackholio` map
84+
2. **Create a GameManager Blueprint**
85+
- In the **Content Drawer**, click **Add**, then select **Blueprint -> Blueprint Class**.
86+
- Expand **All Classes**, search for **GameManager**, highlight it, and click **Select**.
87+
- Name the blueprint `BP_GameManager`.
9488

95-
![Pick Parent Class](./part-1-03-create-blueprint.png)
89+
3. **Update Maps & Modes**
90+
- Open **Edit -> Project Settings** in the top menu, then select **Project -> Maps & Modes** on the left.
91+
- Set **Editor Startup Map** to `Blackholio`.
92+
- Set **Game Default Map** to `Blackholio`.
93+
![Pick Parent Class](./part-1-03-create-blueprint.png)
9694

97-
4. **Add to the Level**:
98-
- Drag and drop the `BP_GameManager` blueprint from the **Content Drawer** window into the scene view.
95+
4. **Add to the Level**
96+
- Drag the `BP_GameManager` blueprint from the **Content Drawer** into the scene view.
9997

100-
5. **Add a Directional Light**:
101-
- Click the **Add** button in the top toolbar, and select `Lights > Directional Light`
102-
- Update `Rotation` to -105.0, -31.0, -14.0
98+
5. **Add a Directional Light**
99+
- Click **Add** in the top toolbar, then select **Lights -> Directional Light**.
100+
- Set **Rotation** to -105.0, -31.0, -14.0.
103101

104-
6. **Add a PostProcessVolume**:
105-
- Click the **Add** button in the top toolbar, and select `Volumes > Post Process Volume`
106-
- Enable and update `Exposure > Exposure Compensation` to 0.0
107-
- Enable and update `Exposure > Min EV100` to 1.0
108-
- Enable and update `Exposure > Max EV100` to 1.0
109-
- Enable `Post Process Volume Settings > Infinite Extend (Unbounded)`
102+
6. **Add a Post Process Volume**
103+
- Click **Add** in the top toolbar, then select **Volumes -> Post Process Volume**.
104+
- Enable and set **Exposure -> Exposure Compensation** to 0.0.
105+
- Enable and set **Exposure -> Min EV100** to 1.0.
106+
- Enable and set **Exposure -> Max EV100** to 1.0.
107+
- Enable **Post Process Volume Settings -> Infinite Extend (Unbounded)**.
110108

111-
### Add simple GameMode
109+
### Add a Simple GameMode
112110

113-
We'll need a very simple GameMode to tweak the start up settings. Let's add that now and wire it in for the World Settings.
111+
Create a simple GameMode to tweak the startup settings and connect it to the World Settings.
114112

115-
1. **Create the C++ Class**:
116-
- Open `Tools > New C++ Class` in the top menu, select **GameModeBase** as the parent and click **Next**
117-
- Select **Public** Class Type
118-
- Name the script `BlackholioGameMode`
113+
1. **Create the C++ class**
114+
- Open **Tools -> New C++ Class** in the top menu, select **GameModeBase** as the parent, and click **Next**.
115+
- Select **Public** as the class type.
116+
- Name the class `BlackholioGameMode`.
119117

120-
2. **Create GameMode Blueprint**:
121-
- In the **Content Drawer**, click **Add**, select `Blueprint > Blueprint Class`
122-
- Expand **All Classes**, search for `BlackholioGameMode`, highlight it, and click **Select**
123-
- Name the blueprint `BP_BlackholioGameMode`
118+
2. **Create a GameMode Blueprint**
119+
- In the **Content Drawer**, click **Add**, then select **Blueprint -> Blueprint Class**.
120+
- Expand **All Classes**, search for `BlackholioGameMode`, highlight it, and click **Select**.
121+
- Name the blueprint `BP_BlackholioGameMode`.
124122

125-
3. **Update WorldSettings**:
126-
- Open `Window > World Settings` in the top menu
127-
- Update GameMode Override from **None** to **BP_BlackholioGameMode**
128-
- Save the level
123+
3. **Update World Settings**
124+
- Open **Window -> World Settings** in the top menu.
125+
- Change **GameMode Override** from **None** to `BP_BlackholioGameMode`.
126+
- Save the level.
129127

130-
The foundation for our Unreal 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!
128+
At this point, the foundation of the Unreal project is set up. Pressing Play will show a blank screen, but the game should start without errors. Next, we’ll create the SpacetimeDB server module so we have something to connect to.
131129

132130
### Create the Server Module
133131

docs/docs/unreal/part-2.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ This will also generate a file in the `client_unreal/Source/client_unreal/Privat
467467

468468
### Connecting to the Database
469469

470-
To make sure building the Unreal project will work, let's make sure to update the `client_unreal.Build.cs` to include the SpacetimeDbSdk. Update the PublicDependencyModuleNames, and PrivateDependencyModuleNames as following for current and future needs:
470+
Update `client_unreal.Build.cs` to include the `SpacetimeDbSdk`. Add `SpacetimeDbSdk` to `PublicDependencyModuleNames`, and confirm that `PrivateDependencyModuleNames` includes the following modules for current and future needs:
471471

472472
```cpp
473473
PublicDependencyModuleNames.AddRange(new string[]
@@ -489,7 +489,8 @@ To make sure building the Unreal project will work, let's make sure to update th
489489
});
490490
```
491491
492-
At this point we can set up Unreal to connect your Unreal client to the server. We'll need to update the `GameManager.h` to the following:
492+
Update `GameManager.h` as follows to set up the Unreal client connection to the server:
493+
493494
```cpp
494495
#pragma once
495496
@@ -505,7 +506,7 @@ class CLIENT_UNREAL_API AGameManager : public AActor
505506
{
506507
GENERATED_BODY()
507508
508-
public:
509+
public:
509510
AGameManager();
510511
static AGameManager* Instance;
511512
@@ -553,11 +554,11 @@ private:
553554
UFUNCTION()
554555
void HandleDisconnect(UDbConnection* InConn, const FString& Error);
555556
UFUNCTION()
556-
void HandleSubscriptionApplied(FSubscriptionEventContext& Context);
557+
void HandleSubscriptionApplied(FSubscriptionEventContext& Context);
557558
};
558559
```
559560

560-
Next up let's update the `GameManager.cpp` to finalize the setup:
561+
Next, update GameManager.cpp to finalize the setup:
561562

562563
```cpp
563564
#include "GameManager.h"

0 commit comments

Comments
 (0)