client-flow
Typical runtime flow (client)
- Discover the lobby: demo reads
~/.celte.yamland builds a lobby URL. - Ask the lobby to connect: POST
/connectwith a JSON body containing theclientIdkey — the lobby returns an object with keysclusterHost,clusterPortandSessionId. - Call the runtime API to connect to the cluster and join the session:
# inside a CPeer-derived script (see demo-tek Scenes/Main/c_peer.gd)
func on_connected_to_lobby(responseJSON: Dictionary) -> void:
var clusterHost = responseJSON["clusterHost"]
var clusterPort = int(responseJSON["clusterPort"])
var sessionId = responseJSON["SessionId"]
print("Client connecting to session " + sessionId)
Celte.api.ClientConnect(clusterHost, clusterPort, sessionId)
- When the runtime signals a successful Pulsar/cluster connection (demo shows
_on_celte_connection_success), the client asks the lobby to link it to a server node: POST/link— lobby returns quickly or the lobby calls the Master to performclient/link. - When the Master/lobby accepts the client, your server-mode code (on the target spawner) will receive an accept callback. In demo-tek the server side implements
_on_mode_server_celte_accept_new_client(client_id, spawner_id)and callsTeamManager.spawn(client_id, spawner_id)which in turn usesCMultiplayerInstantiator.SpawnEntity(...).