Skip to main content

Crate arcane_sdk

Crate arcane_sdk 

Source
Expand description

Arcane game SDK core.

Games build one ArcaneClient at launch, and pass it nothing: Arcane Powered hands the game process the id of the title in ARCANE_GAME_ID and the signed-in account in ARCANE_USER_ID. The client verifies ownership once and then holds the result in memory — that user_id, that game_id, the ownership status and the device fingerprint — so nothing downstream needs the id again.

use arcane_sdk::ArcaneClient;

let client = ArcaneClient::init()?;
println!("user={:?} owned={}", client.user_id(), client.is_owned());

Ownership is checked against a locally cached ticket when possible. If the ticket is missing or expired, the SDK asks the Arcane desktop app (loopback 127.0.0.1:39284) to refresh online, opening the app via deep link when needed.

init also opens a play session: one background thread reports playtime to the Arcane desktop app once a minute, and — while the player allows it — samples the frame rate in short windows if the game calls ArcaneClient::frame. It never blocks or fails init. See SessionSnapshot.

Achievements are opt-in and cost nothing until used: one line unlocks one, and it is idempotent, so a game can call it every time its condition holds.

client.achievements().unlock("first_blood")?;

Friends are the same shape: one call gives the list with online and in_game for this title, read straight from the Arcane desktop app.

client.friends().list()?;

P2P lobbies are another opt-in surface: Arcane hosts the lobby, the join code and the invitations, and carries each member’s opaque connection blob. The game keeps its own netcode, or uses the coop network below.

let lobby = client.p2p().create_lobby(4, Visibility::FriendsAndCode, my_endpoint)?;
for event in client.p2p().poll_events() { /* … */ }

The coop network carries the game’s own messages between the members of a lobby, with no port to open: the Arcane desktop app connects the players directly, or through Arcane’s relay when it has to.

client.net().open(lobby_id, NetOptions::default())?;
client.net().send(Peer::Host, Channel::Reliable, b"ready")?;

Failures are SdkError, carrying a stable code, a player-facing message, a developer-facing hint and a context key/value list.

Modules§

ffi
Minimal C ABI for Unity / Unreal / native engines.

Structs§

Achievement
One achievement as the Arcane portal defines it, plus this player’s state.
Achievements
The achievements accessor, borrowed from the client for one or two calls.
ArcaneClient
The handle a game holds for its whole session.
Friend
One friend of the signed-in Arcane account, with their presence.
FriendList
What the Arcane desktop app knows about this player’s friends.
Friends
The friends accessor, borrowed from the client for one call.
Lobby
A lobby as Arcane knows it, right after a create or a join.
LobbyMember
One player in a lobby, with the blob they published.
LobbyOptions
What P2p::create opens.
LobbyQuery
What P2p::search looks for among the open Visibility::Public lobbies of this game.
LobbySummary
One lobby P2p::search found. Join it with P2p::join and its lobby_id.
Net
The coop network of this game. Get it from ArcaneClient::net.
NetMessage
One message received from a peer.
NetOptions
How to open the coop network.
P2p
The lobby accessor, borrowed from the client.
SdkError
A single SDK failure.
SessionSnapshot
What the session looks like right now — for logs, overlays and QA screens.
Unlock
The result of an Achievements::unlock call.

Enums§

Channel
Which of the two channels a message travels on.
ErrorCode
LobbyEvent
Something that happened in a lobby this player is in, or an invitation.
LobbyPollingState
Whether the session thread is polling Arcane for lobby events.
NetEvent
What happened to the network since the last Net::poll_events.
OwnershipStatus
Peer
Who a message is sent to.
Route
How a link reaches the other player.
TrackingState
Whether the SDK is tracking this play session.
Visibility
Who can join a lobby.

Constants§

JOIN_CODE_LEN
Number of characters in a join code.
MAX_ACHIEVEMENT_KEY_LEN
Longest achievement key the SDK will accept, in bytes.
MAX_GAME_ID_LEN
Longest game id the SDK will accept, in bytes.
MAX_LOBBY_METADATA_BYTES
Largest lobby metadata set, in bytes of its JSON object.
MAX_LOBBY_METADATA_KEY_LEN
Longest metadata key, in bytes: lowercase ASCII letters, digits and _.
MAX_LOBBY_METADATA_PAIRS
Most key / value pairs a lobby carries in its metadata.
MAX_LOBBY_METADATA_VALUE_LEN
Longest metadata value, in characters.
MAX_LOBBY_PAYLOAD_LEN
Longest payload the SDK will carry for one member, in bytes.
MAX_LOBBY_SEARCH_RESULTS
Most lobbies one P2p::search returns.
MAX_RELIABLE_MESSAGE
Largest message on Channel::Reliable, in bytes.
MAX_UNRELIABLE_MESSAGE
Largest message on Channel::Unreliable, in bytes. Bigger ones are refused before they leave the game.