# Description of Changes - Updated Unreal codegen to work with ::Result to match how ::Option works to create a new struct for each type pair identified - Added new integration tests to confirm Ok state for all new types added to sdk-tests - Added new UE_SPACETIMEDB_RESULT macro to capture de/serialization for the new structs # API and ABI breaking changes N/A # Expected complexity level and risk 2 - Added new type generated from Result which creates new structs for each one identified # Testing - [x] Updated the integration tests to include the new Result types --------- Co-authored-by: Mario Alejandro Montoya Cortes <mamcx@elmalabarista.com>
SpacetimeDB Unreal SDK
This folder contains the Unreal Engine plugin that allows games to talk to a SpacetimeDB server. The design mirrors the official Rust SDK and borrows ideas from the C# SDK so that projects can share a common workflow across languages.
Overview
The plugin exposes a high level API for establishing connections, invoking reducers and keeping a synchronized cache of database tables. Communication happens over WebSockets using the BSATN binary format. Most of the message and type headers are generated by the SpacetimeDB CLI so that Unreal games can send and receive the same structures as other SDKs.
Feature Highlights
- Connect to a SpacetimeDB server and authenticate with identity tokens
- Call reducers and receive their results via Blueprint exposed delegates
- Subscribe to queries and maintain a local table cache updated by server diffs
- Serialize common Unreal types to BSATN, including arrays
- Auto-generated table types keep the API in sync with your database
- Pure C++ implementation with Blueprint wrappers for easy gameplay scripting
Directory Layout
crates/sdk-unreal/
├── DEVELOP.md # Notes on integrating the plugin into a project
├── SpacetimeDbSdk/ # The Unreal plugin sources
│ ├── Resources/ # Plugin icons and metadata
│ └── Source/
│ └── SpacetimeDbSdk/
│ ├── Public/ # Headers used by gameplay code
│ │ ├── BSATN/ # BSATN serializer
│ │ ├── Connection/ # Connection and subscription classes
│ │ ├── DBCache/ # Client side table cache utilities
│ │ ├── Tables/ # Base class for generated table wrappers
│ │ ├── Types/ # Generated message and type headers
│ │ └── tests/ # Unit test helpers for BSATN
│ ├── Private/ # Implementation files
│ └── SpacetimeDbSdk.Build.cs
See the README files in each subfolder for more details on the available classes and helpers.
Getting Started
- Copy
SpacetimeDbSdkinto your project'sPluginsdirectory or use theAdditionalPluginDirectoriesoption described inDEVELOP.md. - Regenerate the headers under
Public/Typesby running the SpacetimeDB CLI against your module schema. - Include
SpacetimeDbSdkin your game's build files and start a connection usingUDbConnectionBuilder.
With the connection established you can call reducers, subscribe to queries and drive gameplay logic using incoming table data.