Central client

Usage guide of central.client: sign up and sign in, the directory of rooms servers, launch() into net.rooms with a signed ticket, settings, events and named errors.

Source: module-kits:kits/central_client/usage/en.mdView Markdown source

Also read offline — CLI: grip-forge docs central-clientMCP tool: gripforge_docs { "topic": "central-client" }

Accounts and launch through the central server (central.client) #

What it is for #

central.client is the game side of the studio's central server (gripforge create central-server): player accounts (sign up, sign in, sign out, resume a kept session), the directory of rooms servers, and launch(): central picks a rooms server and hands a short signed ticket, then net.rooms connects to that server with it. The accounts and tickets belong to central; the kit only asks.

Turn it on #

gripforge_gamekit_install   { project_id: "gkp_…", id: "central.client" }
gripforge_gamekit_configure { project_id: "gkp_…", id: "central.client",
                              config: { "url": "https://central.example.com" } }

Install net.rooms (with net.transport) too: launch() needs it.

First example #

<!-- test: kits/game_engine/host/tests/net_kits.rs::central_client_signs_in_reads_the_directory_and_launches_net_rooms_with_the_ticket --> Calls answer at once and the outcome arrives as events and in view():

central.client.signUp("Ann", "secret")   -> central.signed_in { account: { id, name } }
central.client.directory()               -> the known list; view().directory fills when central answers
central.client.launch({})                -> central.launched { rooms, url }; net.rooms is connected as Ann
central.client.signOut()                 -> central.signed_out

view() answers { signedIn, account, busy, error, directory, rooms }. Central's own codes (bad_credentials, name_taken...) pass through in error.

Settings and defaults #

SettingDefaultMeaning
url""address of the central server (http(s)://host:port); empty: every call ends with central_unavailable
viewtrueshow the ready-made account view (sign in, create an account, directory, Play online); off: draw your own menu from view()

Services, events, variables #

  • central.client (service): signUp(name, password), signIn(name, password), signOut(), resume(session), session(), view(), directory(), launch({ rooms?, server? }).
  • Events: central.signed_in, central.signed_out, central.launched, central.error (payload code: central_unavailable, rooms_unavailable, rooms_module_missing, not_signed_in or central's own code).

Hooks and modding #

None: it is a pure service. No hook, no setting open to mods.

Limits #

Native engines talk to central over http:// only (no TLS yet); the web uses fetch. One central server per game.

Versions #

Kit 1.0.0, service central.client 1.0.0 (exclusive).