Skip to content

Godot SDK

The OnlyWorlds SDK for Godot is a GDScript addon that brings a world into a Godot game: read at run time over the onlyworlds.com API, or shipped with the game as a folder. It runs on the standard Godot build, with no .NET. For what a world gives a game, see Games.

It is at its first releases (0.1.1). Before 1.0 a minor version may change a call’s name, and its changelog says so when it does. The repository is OnlyWorlds/godot-sdk; every call, with what it answers and what it refuses, is in its reference.

Godot 4.7, the standard build. Earlier 4.x versions are untested, and so are exports other than Windows desktop, the web and mobile among them.

  • Godot’s Asset Library: OnlyWorlds SDK, or the editor’s AssetLib tab, searching for OnlyWorlds. Install with the installer’s defaults and it lands at addons/onlyworlds/. The Library carries a release, so it can be a step behind the repository.
  • The release zip, from the repository’s Releases page: unpack it into your project folder, where its addons/onlyworlds/ joins your project’s addons/.

Then open the project in the editor once, so Godot registers the OW… classes. Enabling the plugin under Project Settings → Plugins is optional: the classes work without it.

This reads Moppetopia, a public sample world, with its demo key. No account is needed.

extends Node
func _ready() -> void:
var client := OWClient.new({"api_key": "0000000001"}) # demo key: Moppetopia, read-only
var world := await client.get_world()
if not world.ok:
print(world.error) # no connection, or the server said why
return
print(world.value["name"])
var found := await client.list("character", {"name_contains": "fluffington"})
print(found.value.data[0].name)

Attach it to any node and run the scene. The Output panel shows Moppetopia, then Admiral Fluffington. await client.list_all("character") pages through every Character.

A world’s keys are on its page on onlyworlds.com (Keys and PINs).

  • A read key (ow_r_) reads, with no PIN. This is the key to ship in a game.
  • A write key (ow_w_) reads and writes, and a write also sends your PIN, as api_pin.
var client := OWClient.new({"api_key": world_key, "api_pin": pin}) # ow_w_…, your PIN
var made := await client.create("character", {"name": "The Brine Cartographer"})
await client.patch("character", made.value.id, {"description": "Maps the tide lines."})

patch sends only the fields you pass, and delete("character", id) removes one. Every call answers a reply with value on success, else error, an OWApiError that says why.

Keep write keys out of a game you ship. A key written in a script, a scene or an exported variable is packed into the export, where anyone with the build can read it, so read write credentials at run time. An AI agent that writes to your world takes an agent seat of its own.

OWWorld.read_folder(path) reads a world folder and OWWorldArchive.read_file(path) an .owworld file, with no server at all, and both give the same typed elements. A world you never edited is written back byte for byte.

A pack (OWWorldArchive.pack, OWWorld.pack) is a copy: it carries every element, hidden ones included. The addon has no share yet, so make a file to hand on with a tool that leaves hidden elements out, such as the TypeScript SDK or the Python package.

A player link (https://www.onlyworlds.com/join#ow_j_…, made by a world’s owner for one Character) needs no account. Redeem it once for that player’s read key; the server then shows the key only what that Character may see.

var code := OWJoin.parse_link(pasted) # "" when the text holds no code
var joined := await OWJoin.redeem(code) # the code is spent: keep joined.value.key
var client := OWClient.new({"api_key": joined.value.key})

OWJoin.preview(code) says who invites, to which world, without spending the code.

Part Classes What it does
Client OWClient, OWJoin The API: read a world, list and page through its elements, the change feed, writes (create, upsert, patch, delete, link edits, bulk), joining by invite link.
Models OWCharacter, OWLocation and the rest, OWElement One class per element type, generated from the schema; OWTypes.make(type, body) builds the right one.
On disk OWWorld, OWWorldArchive, OWJson World folders and .owworld files, read and written in the folder format’s own bytes.
Readers OWLens, OWGraph, OWLanding, OWMapSpace, OWCharter, OWStrand, OWRecord, OWReport, OWMessage, OWNames, OWViews Answers worked out from elements you already hold, with no request of their own: what one reader may see of a world, the world as nodes and edges, its maps as points and outlines, a Character’s record of game runs, in-world messages and reports.
Helpers OWCalendar, OWAddress, OWOpeners, OWTools, OWId, OWUnicode A world’s own calendar, ow:// links, an Open with menu of OnlyWorlds tools, ids, name comparison.

The 22 classes are generated from one pinned release of schema-dist, the standard’s published form, and OWSchemaPin names it at run time. By the repository’s own account, each reader gives the same answers as the TypeScript, Python and Unity SDKs on a shared set of test cases, and every request the client makes is checked against the API’s own description of itself.

AI agents: start from llms.txt, this site's index, which links the whole documentation as plain text.