Cauldron SDK Reference
castle-web-sdk lets a deck use services provided by the Castle
platform — for example, a deck can save per-player data, post and read
scores on a leaderboard, or get a server-synced time for daily content.
Comes with every deck: the SDK is a file of the base kit each deck
imports (imports/castle.base/sdk/), and the bare specifier resolves
there — nothing to install, and no deck package.json names it. Import
what you need from castle-web-sdk:
import { setup, initCard, Store, Leaderboard } from "castle-web-sdk";
This reference covers castle-web-sdk 0.4.57.
- Setup: Start the deck, check whether it is open in the editor, and save files from custom editors.
- Store: Saved data stored key by key, shared or per player. The storage to use for multiplayer decks.
- LocalCache: Bytes and text kept on the player's device, for things the deck can rebuild.
- Leaderboard: Rank players by score.
- Multiplayer: Connect players to the deck's multiplayer server.
- Rooms: This deck's public multiplayer rooms and how many players are in each.
- User: The signed-in player, and other players' public profiles.
- Social: The signed-in player's mutual follows, and which of them are playing this deck now.
- Party: Create Castle parties, manage their members and chat in them.
- Time: Server-synced time and dates, the same for every player.
- Experiments: A/B tests: give each player one variant of an experiment and read it.
- Analytics: Record the deck's own named events in its creator analytics.
- Pass: Sell players permanent unlocks for Castle bricks.
- Snapshot: Let players collect a picture of the current frame.
- Portal: Send the player to another Castle deck.
- Haptics: Short device vibrations for tactile feedback.
- Lifecycle: Tell Castle when the deck is ready, and keep play state when the player leaves and comes back.
- Display: The deck's preferred display orientation.
- DebugConsole: Show the deck's console output on the device it is running on.
- Clipboard: Copying to the clipboard, which Castle does not always allow.
- Storage: Storage saves data for the current player.
- SharedStorage: SharedStorage saves data that other players can read.
- CastleError: Every error the SDK throws is a CastleError. Check its code to tell the kinds apart.
Next: Local development · Back to Multiplayer