baplus package¶
Module contents¶
Closed-source bits of ballistica.
This code concerns sensitive things like accounts and master-server communication so the native C++ parts of it remain closed. Native precompiled static libraries of this portion are provided for those who want to compile the rest of the engine, and a fully open-source engine can also be built by removing this ‘plus’ feature-set.
- class baplus.CloudSubsystem[source]¶
Bases:
AppSubsystem
Manages communication with cloud components.
- property connected: bool¶
Property equivalent of CloudSubsystem.is_connected().
- is_connected() bool [source]¶
Return whether a connection to the cloud is present.
This is a good indicator (though not for certain) that sending messages will succeed.
- on_connectivity_changed(connected: bool) None [source]¶
Called when cloud connectivity state changes.
- send_message(msg: bacommon.cloud.WorkspaceFetchMessage) bacommon.cloud.WorkspaceFetchResponse [source]¶
- send_message(msg: bacommon.cloud.MerchAvailabilityMessage) bacommon.cloud.MerchAvailabilityResponse
- send_message(msg: bacommon.cloud.TestMessage) bacommon.cloud.TestResponse
Synchronously send a message to the cloud.
Must be called from a background thread.
- async send_message_async(msg: bacommon.cloud.SendInfoMessage) bacommon.cloud.SendInfoResponse [source]¶
- async send_message_async(msg: bacommon.cloud.TestMessage) bacommon.cloud.TestResponse
Synchronously send a message to the cloud.
Must be called from the logic thread.
- send_message_cb(msg: bacommon.cloud.LoginProxyRequestMessage, on_response: Callable[[bacommon.cloud.LoginProxyRequestResponse | Exception], None]) None [source]¶
- send_message_cb(msg: bacommon.cloud.LoginProxyStateQueryMessage, on_response: Callable[[bacommon.cloud.LoginProxyStateQueryResponse | Exception], None]) None
- send_message_cb(msg: bacommon.cloud.LoginProxyCompleteMessage, on_response: Callable[[None | Exception], None]) None
- send_message_cb(msg: bacommon.cloud.PingMessage, on_response: Callable[[bacommon.cloud.PingResponse | Exception], None]) None
- send_message_cb(msg: bacommon.cloud.SignInMessage, on_response: Callable[[bacommon.cloud.SignInResponse | Exception], None]) None
- send_message_cb(msg: bacommon.cloud.ManageAccountMessage, on_response: Callable[[bacommon.cloud.ManageAccountResponse | Exception], None]) None
Asynchronously send a message to the cloud from the logic thread.
The provided on_response call will be run in the logic thread and passed either the response or the error that occurred.
- class baplus.PlusSubsystem[source]¶
Bases:
AppSubsystem
Subsystem for plus functionality in the app.
The single shared instance of this app can be accessed at babase.app.plus. Note that it is possible for this to be None if the plus package is not present, and code should handle that case gracefully.
- accounts: AccountV2Subsystem¶
- static add_v1_account_transaction(transaction: dict, callback: Callable | None = None) None [source]¶
(internal)
- cloud: CloudSubsystem¶
- static game_service_has_leaderboard(game: str, config: str) bool [source]¶
(internal)
Given a game and config string, returns whether there is a leaderboard for it on the game service.
- static get_master_server_address(source: int = -1, version: int = 1) str [source]¶
(internal)
Return the address of the master server.
- static get_v1_account_ticket_count() int [source]¶
(internal)
Returns the number of tickets for the current account.
- on_app_loading() None [source]¶
Called when the app reaches the loading state.
Note that subsystems created after the app switches to the loading state will not receive this callback. Subsystems created by plugins are an example of this.
- static show_ad(purpose: str, on_completion_call: Callable[[], None] | None = None) None [source]¶
Show an ad.
- static show_ad_2(purpose: str, on_completion_call: Callable[[bool], None] | None = None) None [source]¶
Show an ad.
- static show_game_service_ui(show: str = 'general', game: str | None = None, game_version: str | None = None) None [source]¶
Show game-service provided UI.
- static sign_out_v1(v2_embedded: bool = False) None [source]¶
(internal)
Category: General Utility Functions
- static submit_score(game: str, config: str, name: Any, score: int | None, callback: Callable, order: str = 'increasing', tournament_id: str | None = None, score_type: str = 'points', campaign: str | None = None, level: str | None = None) None [source]¶
(internal)
Submit a score to the server; callback will be called with the results. As a courtesy, please don’t send fake scores to the server. I’d prefer to devote my time to improving the game instead of trying to make the score server more mischief-proof.