Ballistica Logo

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)

static can_show_ad() bool[source]

Can we show an ad?

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_news_show() str[source]

(internal)

static get_price(item: str) str | None[source]

(internal)

static get_purchased(item: str) bool[source]

(internal)

static get_purchases_state() int[source]

(internal)

static get_v1_account_display_string(full: bool = True) str[source]

(internal)

static get_v1_account_misc_read_val(name: str, default_value: Any) Any[source]

(internal)

static get_v1_account_misc_read_val_2(name: str, default_value: Any) Any[source]

(internal)

static get_v1_account_misc_val(name: str, default_value: Any) Any[source]

(internal)

static get_v1_account_name() str[source]

(internal)

static get_v1_account_public_login_id() str | None[source]

(internal)

static get_v1_account_state() str[source]

(internal)

static get_v1_account_state_num() int[source]

(internal)

static get_v1_account_ticket_count() int[source]

(internal)

Returns the number of tickets for the current account.

static get_v1_account_type() str[source]

(internal)

static get_v2_fleet() str[source]

(internal)

static has_video_ads() bool[source]

Are video ads available?

static have_incentivized_ad() bool[source]

Is an incentivized ad available?

static have_outstanding_v1_account_transactions() bool[source]

(internal)

static in_game_purchase(item: str, price: int) None[source]

(internal)

static is_blessed() bool[source]

(internal)

static mark_config_dirty() None[source]

(internal)

Category: General Utility Functions

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 power_ranking_query(callback: Callable, season: Any = None) None[source]

(internal)

static purchase(item: str) None[source]

(internal)

static report_achievement(achievement: str, pass_to_account: bool = True) None[source]

(internal)

static reset_achievements() None[source]

(internal)

static restore_purchases() None[source]

(internal)

static run_v1_account_transactions() None[source]

(internal)

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_in_v1(account_type: str) None[source]

(internal)

Category: General Utility Functions

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.

static tournament_query(callback: Callable[[dict | None], None], args: dict) None[source]

(internal)