Jason Larabie f8d6d76ee4
Update Unreal SDK to websocket 2.0 (#4497)
# Description of Changes

- Updated the Unreal SDK and generated Unreal bindings for the websocket
2.0 protocol/model
  - Reworked DbConnectionBase to handle the updated message shapes
- Switched subscription handling over to new message types and
QuerySetId
- Updated reducer to ReducerResult, removal of callbacks, and set
reducer flags
  - Added event table support
- Baked in multi-module support replacing [the old
PR](<https://github.com/clockworklabs/SpacetimeDB/pull/3417>)
- Added functionality to generate module support for multiple folders in
the Unreal project (add <module>.Build.cs, <module>.h, <module>.cpp)
using the --module-name
- Add new configuration option for spacetime generate to handle module
prefix
 - Regenerated Unreal Blackholio/TestClient/QuickstartChat bindings
   - Rebuilt Unreal Blackholio's consume entity to use event tables 
 - Updated migration documentation
 - Updated the version bump tool to impact C++

# API and ABI breaking changes

- Unreal websocket/message handling updated to the new protocol
- Unreal generation now expects a real .uproject target and will stop
immediately if project
    metadata is invalid instead of continuing past setup issues.

# Expected complexity level and risk

3 - A large set of changes to update the websocket/message handling
along with heavy codegen changes to handle multi-module support

# Testing

Test coverage of the Unreal SDK will need expansion in a future ticket
once our issues with flakiness on CI is resolved.

- [x] Updated Unreal Blackholio 
- [x] Ran full Unreal SDK test suite
- [x] Built new test project using the new `--module-prefix` 
- [x] Run through Unreal Blackholio (C++ and Blueprint)
- [x] Rebuilt Unreal Blackholio with multi-module, and duplicate
generated module testing side-by-side modules that would overlap

# Review Question(s)
- [x] Updates to `spacetime init` have made the tutorial a little
confusing with pathing for the Unreal Blackholio tutorial. To fix though
we'd have to update all the commands to be more explicit, or update the
tutorial `spacetime init` to use `--project-path .` to keep pathing
simpler, thoughts?

---------

Signed-off-by: Jason Larabie <jason@clockworklabs.io>
Co-authored-by: Ryan <r.ekhoff@clockworklabs.io>
2026-03-18 21:14:06 +00:00
..
2026-02-07 04:26:45 +00:00
2026-02-07 04:26:45 +00:00
2026-02-07 04:26:45 +00:00

sdk-test-view-cpp

C++ implementation of the SpacetimeDB view test module. This mirrors the Rust sdk-test-view module to ensure feature parity between the C++ and Rust SDKs.

Overview

This module tests the C++ bindings' view functionality including:

  • ViewContext views - Views with caller identity
  • AnonymousViewContext views - Views without caller identity
  • Optional return types - std::optional<T>
  • Vector return types - std::vector<T>
  • Table joins - Combining data from multiple tables
  • Filtering - Using indexed fields for efficient queries
  • Complex queries - Multi-table joins with filtering logic

Tables

  • player - Player entities with unique identities
  • player_level - Player levels indexed for filtering
  • player_location - Player positions with active status

Views

my_player

Returns the caller's player record.

  • Context: ViewContext (requires sender)
  • Returns: std::optional<Player>

my_player_and_level

Returns the caller's player joined with their level.

  • Context: ViewContext (requires sender)
  • Returns: std::optional<PlayerAndLevel>

players_at_level_0

Returns all players at level 0.

  • Context: AnonymousViewContext (no sender needed)
  • Returns: std::vector<Player>

nearby_players

Returns all active players within 5 units of the caller.

  • Context: ViewContext (requires sender)
  • Returns: std::vector<PlayerLocation>

Building

emcmake cmake -B build
cmake --build build

The output will be build/lib.wasm.