FOUR SDK / V1.0.0

Unreal Engine Integration

The repository includes an Unreal Engine 5 runtime plugin in integrations/unreal/FourBTD. It provides Blueprint functions for loading a character, retrieving recent memories, and saving a new memory.

Install the plugin

  1. Copy the FourBTD directory into your Unreal project's Plugins directory.
  2. Regenerate project files and rebuild the project.
  3. Open Four Studio → Settings → Unreal Engine and generate an integration key.
  4. Configure the FourBTDSubsystem from a trusted dedicated server.
cpp
UFourBTDSubsystem* Four = GetGameInstance()->GetSubsystem<UFourBTDSubsystem>();
Four->Configure(
  TEXT("https://www.4btd.xyz/api/v1/unreal"),
  ServerOnlyApiKey
);
Four->GetCharacter(CharacterId);
Four->GetMemories(CharacterId, 20);
Four->AddMemory(
  CharacterId,
  TEXT("episodic"),
  TEXT("The player returned the lost compass."),
  0.75f
);

The same operations are available as Blueprint nodes. Bind to the subsystem's response events before calling them.

Never embed an integration key in a packaged game client, Blueprint asset, repository, log, or crash report. Use it from a dedicated game server or trusted backend. The key is displayed once and only its SHA-256 hash is stored by Four Studio.

HTTP contract

All requests use Authorization: Bearer four_unreal_....

text
GET  /api/v1/unreal/characters/{characterId}
GET  /api/v1/unreal/characters/{characterId}/memories?limit=20
POST /api/v1/unreal/characters/{characterId}/memories

Memory writes accept:

json
{
  "id": "b18735a2-e4bb-4ea8-bedd-c54ea63a3333",
  "type": "episodic",
  "content": "The player returned the lost compass.",
  "salience": 0.75
}

Use a new UUID for each memory event and reuse that UUID when retrying the same request. This makes writes idempotent when a game server loses the HTTP response.

Keys are workspace-scoped, requests enforce character ownership, and the initial integration limit is 120 requests per minute per workspace. Rotate or revoke a key from Studio Settings at any time.