Ballistica Logo

bacommon package

Subpackages

Submodules

bacommon.app module

Common high level values/functionality related to apps.

class bacommon.app.AppArchitecture(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Processor architecture the App is running on.

ARM = 'arm'
ARM64 = 'arm64'
X86 = 'x86'
X86_64 = 'x86_64'
class bacommon.app.AppExperience(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

A particular experience that can be provided by a Ballistica app.

This is one metric used to isolate different playerbases from each other where there might be no technical barriers doing so. For example, a casual one-hand-playable phone game and an augmented reality tabletop game may both use the same scene-versions and networking-protocols and whatnot, but it would make no sense to allow players of one to join servers of the other. AppExperience can be used to keep these player bases separate.

Generally a single Ballistica app targets a single AppExperience. This is not a technical requirement, however. A single app may support multiple experiences, or there may be multiple apps targeting one experience. Cloud components such as leagues are generally associated with an AppExperience so that they are only visible to client apps designed for that play style.

EMPTY = 'empty'
MELEE = 'melee'
REMOTE = 'remote'
class bacommon.app.AppInstanceInfo(interface_idiom: ~typing.Annotated[~bacommon.app.AppInterfaceIdiom, <efro.dataclassio.IOAttrs object at 0x7fd6437c54c0>], locale: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7fd6437c5820>], device: ~typing.Annotated[str | None, <efro.dataclassio.IOAttrs object at 0x7fd6437c5c70>])[source]

Bases: object

General info about an individual running app.

architecture

alias of Annotated[AppArchitecture, <efro.dataclassio.IOAttrs object at 0x7fd644ddb470>]

device: IOAttrs object at 0x7fd6437c43b0>]
engine_build

alias of Annotated[int, <efro.dataclassio.IOAttrs object at 0x7fd644dd8770>]

engine_version

alias of Annotated[str, <efro.dataclassio.IOAttrs object at 0x7fd644dda540>]

interface_idiom: IOAttrs object at 0x7fd6437c8b00>]
locale: IOAttrs object at 0x7fd6437cb9b0>]
name

alias of Annotated[str, <efro.dataclassio.IOAttrs object at 0x7fd644ddb230>]

os_version

alias of Annotated[str | None, <efro.dataclassio.IOAttrs object at 0x7fd644ddb5c0>]

platform

alias of Annotated[AppPlatform, <efro.dataclassio.IOAttrs object at 0x7fd644dda300>]

variant

alias of Annotated[AppVariant, <efro.dataclassio.IOAttrs object at 0x7fd644ddb380>]

class bacommon.app.AppInterfaceIdiom(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

A general form-factor or method of experiencing a Ballistica app.

Note that it is possible for a running app to switch idioms (for instance if a mobile device or computer is connected to a TV).

DESKTOP = 'desktop'
PHONE = 'phone'
TABLET = 'tablet'
TV = 'tv'
XR = 'xr'
class bacommon.app.AppPlatform(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Overall platform a Ballistica build is targeting.

Each distinct flavor of an app has a unique combination of AppPlatform and AppVariant. Generally platform describes a set of hardware, while variant describes a destination or purpose for the build.

ANDROID = 'android'
IOS = 'ios'
LINUX = 'linux'
MAC = 'mac'
TVOS = 'tvos'
WINDOWS = 'windows'
class bacommon.app.AppVariant(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

A unique Ballistica build type within a single platform.

Each distinct flavor of an app has a unique combination of AppPlatform and AppVariant. Generally platform describes a set of hardware, while variant describes a destination or purpose for the build.

AMAZON_APPSTORE = 'amazon_appstore'
APP_STORE = 'app_store'
ARCADE = 'arcade'
DEMO = 'demo'
EPIC_GAMES_STORE = 'epic_games_store'
GENERIC = 'generic'
GOOGLE_PLAY = 'google_play'
META = 'meta'
STEAM = 'steam'
TEST = 'test'
WINDOWS_STORE = 'windows_store'

bacommon.assets module

Functionality related to cloud based assets.

class bacommon.assets.AssetPackageBuildState(in_progress_builds: ~typing.Annotated[list[str], <efro.dataclassio.IOAttrs object at 0x7fd6436a1430>] = <factory>, initial_build_count: ~typing.Annotated[int, <efro.dataclassio.IOAttrs object at 0x7fd6436a1520>] = 0, error: ~typing.Annotated[str | None, <efro.dataclassio.IOAttrs object at 0x7fd6436a1670>] = None)[source]

Bases: object

Contains info about an in-progress asset cloud build.

error: IOAttrs object at 0x7fd6436a27b0>] = None
in_progress_builds: IOAttrs object at 0x7fd6436a2f90>]
initial_build_count: IOAttrs object at 0x7fd6436a3680>] = 0
class bacommon.assets.AssetPackageFlavor(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Flavors for asset package outputs for different platforms/etc.

DESKTOP = 'desktop'
MOBILE = 'mobile'
class bacommon.assets.AssetPackageFlavorManifest(cloudfiles: ~typing.Annotated[dict[str, str], <efro.dataclassio.IOAttrs object at 0x7fd6436a3e60>] = <factory>)[source]

Bases: object

A manifest of asset info for a specific flavor of an asset package.

cloudfiles: IOAttrs object at 0x7fd6436e0a70>]
class bacommon.assets.AssetType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Types for individual assets within a package.

COLLISION_MESH = 'collision_mesh'
CUBE_TEXTURE = 'cube_texture'
DATA = 'data'
MESH = 'mesh'
SOUND = 'sound'
TEXTURE = 'texture'

bacommon.bacloud module

Functionality related to the bacloud tool.

class bacommon.bacloud.RequestData(command: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7fd6436e3980>], token: ~typing.Annotated[str | None, <efro.dataclassio.IOAttrs object at 0x7fd6436e38c0>], payload: ~typing.Annotated[dict, <efro.dataclassio.IOAttrs object at 0x7fd6436e3740>], tzoffset: ~typing.Annotated[float, <efro.dataclassio.IOAttrs object at 0x7fd6436e36e0>], isatty: ~typing.Annotated[bool, <efro.dataclassio.IOAttrs object at 0x7fd6436e0950>])[source]

Bases: object

Request sent to bacloud server.

command: IOAttrs object at 0x7fd6434028d0>]
isatty: IOAttrs object at 0x7fd643400e00>]
payload: IOAttrs object at 0x7fd643445520>]
token: IOAttrs object at 0x7fd6436e3170>]
tzoffset: IOAttrs object at 0x7fd6437c9370>]
class bacommon.bacloud.ResponseData(message: Annotated[str | None, IOAttrs('m', store_default=False)] = None, message_end: Annotated[str, IOAttrs('m_end', store_default=False)] = '\n', error: Annotated[str | None, IOAttrs('e', store_default=False)] = None, delay_seconds: Annotated[float, IOAttrs('d', store_default=False)] = 0.0, login: Annotated[str | None, IOAttrs('l', store_default=False)] = None, logout: Annotated[bool, IOAttrs('lo', store_default=False)] = False, dir_manifest: Annotated[str | None, IOAttrs('man', store_default=False)] = None, uploads: Annotated[tuple[list[str], str, dict] | None, IOAttrs('u', store_default=False)] = None, uploads_inline: Annotated[list[str] | None, IOAttrs('uinl', store_default=False)] = None, deletes: Annotated[list[str] | None, IOAttrs('dlt', store_default=False)] = None, downloads: Annotated[Downloads | None, IOAttrs('dl', store_default=False)] = None, downloads_inline: Annotated[dict[str, bytes] | None, IOAttrs('dinl', store_default=False)] = None, dir_prune_empty: Annotated[str | None, IOAttrs('dpe', store_default=False)] = None, open_url: Annotated[str | None, IOAttrs('url', store_default=False)] = None, input_prompt: Annotated[tuple[str, bool] | None, IOAttrs('inp', store_default=False)] = None, end_message: Annotated[str | None, IOAttrs('em', store_default=False)] = None, end_message_end: Annotated[str, IOAttrs('eme', store_default=False)] = '\n', end_command: Annotated[tuple[str, dict] | None, IOAttrs('ec', store_default=False)] = None)[source]

Bases: object

Response sent from the bacloud server to the client.

message

If present, client should print this message before any other response processing (including error handling) occurs.

Type:

Annotated[str | None, IOAttrs(‘m’, store_default=False)]

message_end

end arg for message print() call.

Type:

Annotated[str, IOAttrs(‘m_end’, store_default=False)]

error

If present, client should abort with this error message.

Type:

Annotated[str | None, IOAttrs(‘e’, store_default=False)]

delay_seconds

How long to wait before proceeding with remaining response (can be useful when waiting for server progress in a loop).

Type:

Annotated[float, IOAttrs(‘d’, store_default=False)]

login

If present, a token that should be stored client-side and passed with subsequent commands.

Type:

Annotated[str | None, IOAttrs(‘l’, store_default=False)]

logout

If True, any existing client-side token should be discarded.

Type:

Annotated[bool, IOAttrs(‘lo’, store_default=False)]

dir_manifest

If present, client should generate a manifest of this dir. It should be added to end_command args as ‘manifest’.

Type:

Annotated[str | None, IOAttrs(‘man’, store_default=False)]

uploads

If present, client should upload the requested files (arg1) individually to a server command (arg2) with provided args (arg3).

Type:

Annotated[tuple[list[str], str, dict] | None, IOAttrs(‘u’, store_default=False)]

uploads_inline

If present, a list of pathnames that should be gzipped and uploaded to an ‘uploads_inline’ bytes dict in end_command args. This should be limited to relatively small files.

Type:

Annotated[list[str] | None, IOAttrs(‘uinl’, store_default=False)]

deletes

If present, file paths that should be deleted on the client.

Type:

Annotated[list[str] | None, IOAttrs(‘dlt’, store_default=False)]

downloads

If present, describes files the client should individually request from the server if not already present on the client.

Type:

Annotated[Downloads | None, IOAttrs(‘dl’, store_default=False)]

downloads_inline

If present, pathnames mapped to gzipped data to be written to the client. This should only be used for relatively small files as they are all included inline as part of the response.

Type:

Annotated[dict[str, bytes] | None, IOAttrs(‘dinl’, store_default=False)]

dir_prune_empty

If present, all empty dirs under this one should be removed.

Type:

Annotated[str | None, IOAttrs(‘dpe’, store_default=False)]

open_url

If present, url to display to the user.

Type:

Annotated[str | None, IOAttrs(‘url’, store_default=False)]

input_prompt

If present, a line of input is read and placed into end_command args as ‘input’. The first value is the prompt printed before reading and the second is whether it should be read as a password (without echoing to the terminal).

Type:

Annotated[tuple[str, bool] | None, IOAttrs(‘inp’, store_default=False)]

end_message

If present, a message that should be printed after all other response processing is done.

Type:

Annotated[str | None, IOAttrs(‘em’, store_default=False)]

end_message_end

end arg for end_message print() call.

Type:

Annotated[str, IOAttrs(‘eme’, store_default=False)]

end_command

If present, this command is run with these args at the end of response processing.

Type:

Annotated[tuple[str, dict] | None, IOAttrs(‘ec’, store_default=False)]

class Downloads(basepath: Annotated[str | None, IOAttrs('p')], cmd: Annotated[str, IOAttrs('c')], baseargs: Annotated[dict[str, str], IOAttrs('a')], entries: Annotated[list[Entry], IOAttrs('e')])[source]

Bases: object

Info about downloads included in a response.

class Entry(path: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7fd643465610>], args: ~typing.Annotated[dict[str, str], <efro.dataclassio.IOAttrs object at 0x7fd6434655b0>])[source]

Bases: object

Individual download.

args: IOAttrs object at 0x7fd6434664b0>]
path: IOAttrs object at 0x7fd643466ab0>]
baseargs: Annotated[dict[str, str], IOAttrs('a')]
basepath: Annotated[str | None, IOAttrs('p')]
cmd: Annotated[str, IOAttrs('c')]
entries: Annotated[list[Entry], IOAttrs('e')]
delay_seconds: Annotated[float, IOAttrs('d', store_default=False)] = 0.0
deletes: Annotated[list[str] | None, IOAttrs('dlt', store_default=False)] = None
dir_manifest: Annotated[str | None, IOAttrs('man', store_default=False)] = None
dir_prune_empty: Annotated[str | None, IOAttrs('dpe', store_default=False)] = None
downloads: Annotated[Downloads | None, IOAttrs('dl', store_default=False)] = None
downloads_inline: Annotated[dict[str, bytes] | None, IOAttrs('dinl', store_default=False)] = None
end_command: Annotated[tuple[str, dict] | None, IOAttrs('ec', store_default=False)] = None
end_message: Annotated[str | None, IOAttrs('em', store_default=False)] = None
end_message_end: Annotated[str, IOAttrs('eme', store_default=False)] = '\n'
error: Annotated[str | None, IOAttrs('e', store_default=False)] = None
input_prompt: Annotated[tuple[str, bool] | None, IOAttrs('inp', store_default=False)] = None
login: Annotated[str | None, IOAttrs('l', store_default=False)] = None
logout: Annotated[bool, IOAttrs('lo', store_default=False)] = False
message: Annotated[str | None, IOAttrs('m', store_default=False)] = None
message_end: Annotated[str, IOAttrs('m_end', store_default=False)] = '\n'
open_url: Annotated[str | None, IOAttrs('url', store_default=False)] = None
uploads: Annotated[tuple[list[str], str, dict] | None, IOAttrs('u', store_default=False)] = None
uploads_inline: Annotated[list[str] | None, IOAttrs('uinl', store_default=False)] = None
bacommon.bacloud.asset_file_cache_path(filehash: str) str[source]

Given a sha256 hex file hash, return a storage path.

bacommon.build module

Functionality related to game builds.

class bacommon.build.BuildInfoSet(builds: Annotated[list[Entry], IOAttrs('builds')] = <factory>)[source]

Bases: object

Set of build infos.

class Entry(filename: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7fd6432c7620>], size: ~typing.Annotated[int, <efro.dataclassio.IOAttrs object at 0x7fd6432c75f0>], version: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7fd64346f0b0>], build_number: ~typing.Annotated[int, <efro.dataclassio.IOAttrs object at 0x7fd6437cbb90>], checksum: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7fd64346f1d0>], createtime: ~typing.Annotated[~datetime.datetime, <efro.dataclassio.IOAttrs object at 0x7fd6437c9400>])[source]

Bases: object

Info about a particular app build.

build_number: IOAttrs object at 0x7fd643446f60>]
checksum: IOAttrs object at 0x7fd643484920>]
createtime: IOAttrs object at 0x7fd643466ab0>]
filename: IOAttrs object at 0x7fd643100260>]
size: IOAttrs object at 0x7fd64346c140>]
version: IOAttrs object at 0x7fd64346e5a0>]
builds: Annotated[list[Entry], IOAttrs('builds')]

bacommon.cloud module

Functionality related to cloud functionality.

class bacommon.cloud.BSPrivatePartyMessage(need_datacode: ~typing.Annotated[bool, <efro.dataclassio.IOAttrs object at 0x7fd643139430>])[source]

Bases: Message

Message asking about info we need for private-party UI.

classmethod get_response_types() list[type[Response] | None][source]

Return all Response types this Message can return when sent.

The default implementation specifies a None return type.

need_datacode: IOAttrs object at 0x7fd643139b20>]
class bacommon.cloud.BSPrivatePartyResponse(success: ~typing.Annotated[bool, <efro.dataclassio.IOAttrs object at 0x7fd643139130>], tokens: ~typing.Annotated[int, <efro.dataclassio.IOAttrs object at 0x7fd643139100>], gold_pass: ~typing.Annotated[bool, <efro.dataclassio.IOAttrs object at 0x7fd643400bc0>], datacode: ~typing.Annotated[str | None, <efro.dataclassio.IOAttrs object at 0x7fd64346d7f0>])[source]

Bases: Response

Here’s that private party UI info you asked for, boss.

datacode: IOAttrs object at 0x7fd64346e030>]
gold_pass: IOAttrs object at 0x7fd6434008f0>]
success: IOAttrs object at 0x7fd6434987a0>]
tokens: IOAttrs object at 0x7fd64313bfe0>]
class bacommon.cloud.CloudSubscriptionRequest[source]

Bases: IOMultiType[CloudSubscriptionRequestTypeID]

Top level class for our multitype.

classmethod get_type(type_id: CloudSubscriptionRequestTypeID) type[CloudSubscriptionRequest][source]

Return the subclass for each of our type-ids.

classmethod get_type_id() CloudSubscriptionRequestTypeID[source]

Return the type-id for this subclass.

class bacommon.cloud.CloudSubscriptionRequestTypeID(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Type ID for each of our subclasses.

TEST = 'test'
class bacommon.cloud.LoginProxyCompleteMessage(proxyid: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7fd64314c590>])[source]

Bases: Message

Just so you know, we’re done with this proxy.

proxyid: IOAttrs object at 0x7fd64314d3d0>]
class bacommon.cloud.LoginProxyRequestMessage[source]

Bases: Message

Request send to the cloud to ask for a login-proxy.

classmethod get_response_types() list[type[Response] | None][source]

Return all Response types this Message can return when sent.

The default implementation specifies a None return type.

class bacommon.cloud.LoginProxyRequestResponse(url: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7fd64314e480>], url_overlay: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7fd64314e2a0>], proxyid: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7fd6437c9400>], proxykey: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7fd6432c7500>])[source]

Bases: Response

Response to a request for a login proxy.

proxyid: IOAttrs object at 0x7fd643446f00>]
proxykey: IOAttrs object at 0x7fd643446990>]
url: IOAttrs object at 0x7fd6436a3140>]
url_overlay: IOAttrs object at 0x7fd643465520>]
class bacommon.cloud.LoginProxyStateQueryMessage(proxyid: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7fd64314ec60>], proxykey: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7fd64314ec30>])[source]

Bases: Message

Soo.. how is that login proxy going?

classmethod get_response_types() list[type[Response] | None][source]

Return all Response types this Message can return when sent.

The default implementation specifies a None return type.

proxyid: IOAttrs object at 0x7fd64314fb90>]
proxykey: IOAttrs object at 0x7fd6434852e0>]
class bacommon.cloud.LoginProxyStateQueryResponse(state: Annotated[State, IOAttrs('s')], credentials: Annotated[str | None, IOAttrs('tk')])[source]

Bases: Response

Here’s the info on that login-proxy you asked about, boss.

class State(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

States a login-proxy can be in.

FAIL = 'fail'
SUCCESS = 'success'
WAITING = 'waiting'
credentials: Annotated[str | None, IOAttrs('tk')]
state: Annotated[State, IOAttrs('s')]
class bacommon.cloud.ManageAccountMessage(weblocation: ~typing.Annotated[~bacommon.cloud.WebLocation, <efro.dataclassio.IOAttrs object at 0x7fd643188290>] = WebLocation.ACCOUNT_EDITOR)[source]

Bases: Message

Message asking for a manage-account url.

classmethod get_response_types() list[type[Response] | None][source]

Return all Response types this Message can return when sent.

The default implementation specifies a None return type.

weblocation: IOAttrs object at 0x7fd6431897f0>] = 'e'
class bacommon.cloud.ManageAccountResponse(url: ~typing.Annotated[str | None, <efro.dataclassio.IOAttrs object at 0x7fd643189b80>])[source]

Bases: Response

Here’s that sign-in result you asked for, boss.

url: IOAttrs object at 0x7fd643139ca0>]
class bacommon.cloud.MerchAvailabilityMessage[source]

Bases: Message

Can we show merch link?

classmethod get_response_types() list[type[Response] | None][source]

Return all Response types this Message can return when sent.

The default implementation specifies a None return type.

class bacommon.cloud.MerchAvailabilityResponse(url: ~typing.Annotated[str | None, <efro.dataclassio.IOAttrs object at 0x7fd6432c41d0>])[source]

Bases: Response

About that merch…

url: IOAttrs object at 0x7fd64318a480>]
class bacommon.cloud.PingMessage[source]

Bases: Message

Standard ping.

classmethod get_response_types() list[type[Response] | None][source]

Return all Response types this Message can return when sent.

The default implementation specifies a None return type.

class bacommon.cloud.PingResponse[source]

Bases: Response

pong.

class bacommon.cloud.SendInfoMessage(description: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7fd64318b590>])[source]

Bases: Message

User is using the send-info function

description: IOAttrs object at 0x7fd64318bfb0>]
classmethod get_response_types() list[type[Response] | None][source]

Return all Response types this Message can return when sent.

The default implementation specifies a None return type.

class bacommon.cloud.SendInfoResponse(handled: ~typing.Annotated[bool, <efro.dataclassio.IOAttrs object at 0x7fd64318b350>], message: ~typing.Annotated[str | None, <efro.dataclassio.IOAttrs object at 0x7fd64318b3e0>] = None, legacy_code: ~typing.Annotated[str | None, <efro.dataclassio.IOAttrs object at 0x7fd643101880>] = None)[source]

Bases: Response

Response to sending into the server.

handled: IOAttrs object at 0x7fd6431b4bf0>]
legacy_code: IOAttrs object at 0x7fd643139490>] = None
message: IOAttrs object at 0x7fd6431b53a0>] = None
class bacommon.cloud.SignInMessage(login_type: ~typing.Annotated[~bacommon.login.LoginType, <efro.dataclassio.IOAttrs object at 0x7fd6431b5880>], sign_in_token: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7fd6431b5850>], description: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7fd643401e50>], apptime: ~typing.Annotated[float, <efro.dataclassio.IOAttrs object at 0x7fd64346c980>])[source]

Bases: Message

Can I sign in please?

apptime: IOAttrs object at 0x7fd64313acc0>]
description: IOAttrs object at 0x7fd64313b0b0>]
classmethod get_response_types() list[type[Response] | None][source]

Return all Response types this Message can return when sent.

The default implementation specifies a None return type.

login_type: IOAttrs object at 0x7fd6431b5fa0>]
sign_in_token: IOAttrs object at 0x7fd64313bfe0>]
class bacommon.cloud.SignInResponse(credentials: ~typing.Annotated[str | None, <efro.dataclassio.IOAttrs object at 0x7fd6431b6390>])[source]

Bases: Response

Here’s that sign-in result you asked for, boss.

credentials: IOAttrs object at 0x7fd6431b6d80>]
class bacommon.cloud.StoreQueryMessage[source]

Bases: Message

Message asking about purchasable stuff and store related state.

classmethod get_response_types() list[type[Response] | None][source]

Return all Response types this Message can return when sent.

The default implementation specifies a None return type.

class bacommon.cloud.StoreQueryResponse(result: Annotated[Result, IOAttrs('r')], tokens: Annotated[int, IOAttrs('t')], gold_pass: Annotated[bool, IOAttrs('g')], available_purchases: Annotated[list[Purchase], IOAttrs('p')], token_info_url: Annotated[str, IOAttrs('tiu')])[source]

Bases: Response

Here’s that store info you asked for, boss.

class Purchase(purchaseid: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7fd6431b7c20>])[source]

Bases: object

Info about a purchasable thing.

purchaseid: IOAttrs object at 0x7fd6431d4650>]
class Result(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Our overall result.

ERROR = 'e'
SUCCESS = 's'
available_purchases: Annotated[list[Purchase], IOAttrs('p')]
gold_pass: Annotated[bool, IOAttrs('g')]
result: Annotated[Result, IOAttrs('r')]
token_info_url: Annotated[str, IOAttrs('tiu')]
tokens: Annotated[int, IOAttrs('t')]
class bacommon.cloud.TestCloudSubscriptionRequest[source]

Bases: CloudSubscriptionRequest

Just a test.

classmethod get_type_id() CloudSubscriptionRequestTypeID[source]

Return the type-id for this subclass.

class bacommon.cloud.TestMessage(testfoo: ~typing.Annotated[int, <efro.dataclassio.IOAttrs object at 0x7fd6431d5b20>])[source]

Bases: Message

Can I get some of that workspace action?

classmethod get_response_types() list[type[Response] | None][source]

Return all Response types this Message can return when sent.

The default implementation specifies a None return type.

testfoo: IOAttrs object at 0x7fd6431d6870>]
class bacommon.cloud.TestResponse(testfoo: ~typing.Annotated[int, <efro.dataclassio.IOAttrs object at 0x7fd6431d6b70>])[source]

Bases: Response

Here’s that workspace you asked for, boss.

testfoo: IOAttrs object at 0x7fd6431d6ed0>]
class bacommon.cloud.WebLocation(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Set of places we can be directed on ballistica.net.

ACCOUNT_DELETE_SECTION = 'd'
ACCOUNT_EDITOR = 'e'
class bacommon.cloud.WorkspaceFetchMessage(workspaceid: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7fd6431d7cb0>], state: ~typing.Annotated[~bacommon.cloud.WorkspaceFetchState, <efro.dataclassio.IOAttrs object at 0x7fd6431d7c50>])[source]

Bases: Message

Can I get some of that workspace action?

classmethod get_response_types() list[type[Response] | None][source]

Return all Response types this Message can return when sent.

The default implementation specifies a None return type.

state: IOAttrs object at 0x7fd64314d610>]
workspaceid: IOAttrs object at 0x7fd643010710>]
class bacommon.cloud.WorkspaceFetchResponse(state: ~typing.Annotated[~bacommon.cloud.WorkspaceFetchState, <efro.dataclassio.IOAttrs object at 0x7fd643010ad0>], deletes: ~typing.Annotated[list[str], <efro.dataclassio.IOAttrs object at 0x7fd643010bc0>] = <factory>, downloads_inline: ~typing.Annotated[dict[str, bytes], <efro.dataclassio.IOAttrs object at 0x7fd64314cd40>] = <factory>, done: ~typing.Annotated[bool, <efro.dataclassio.IOAttrs object at 0x7fd6431009b0>] = False)[source]

Bases: Response

Here’s that workspace you asked for, boss.

deletes: IOAttrs object at 0x7fd643465520>]
done: IOAttrs object at 0x7fd643466a80>] = False
downloads_inline: IOAttrs object at 0x7fd643485c10>]
state: IOAttrs object at 0x7fd6431888c0>]
class bacommon.cloud.WorkspaceFetchState(manifest: ~typing.Annotated[~bacommon.transfer.DirectoryManifest, <efro.dataclassio.IOAttrs object at 0x7fd643012810>], iteration: ~typing.Annotated[int, <efro.dataclassio.IOAttrs object at 0x7fd643188aa0>] = 0, total_deletes: ~typing.Annotated[int, <efro.dataclassio.IOAttrs object at 0x7fd643188b30>] = 0, total_downloads: ~typing.Annotated[int, <efro.dataclassio.IOAttrs object at 0x7fd643189790>] = 0, total_up_to_date: ~typing.Annotated[int | None, <efro.dataclassio.IOAttrs object at 0x7fd64318b5f0>] = None)[source]

Bases: object

Common state data for a workspace fetch.

iteration: IOAttrs object at 0x7fd643011d90>] = 0
manifest: IOAttrs object at 0x7fd643011790>]
total_deletes: IOAttrs object at 0x7fd6431b57c0>] = 0
total_downloads: IOAttrs object at 0x7fd6431391c0>] = 0
total_up_to_date: IOAttrs object at 0x7fd643486d50>] = None

bacommon.loggercontrol module

System for managing loggers.

class bacommon.loggercontrol.LoggerControlConfig(levels: ~typing.Annotated[dict[str, int], <efro.dataclassio.IOAttrs object at 0x7fd642e626f0>] = <factory>)[source]

Bases: object

A logging level configuration that applies to all loggers.

Any loggers not explicitly contained in the configuration will be set to NOTSET.

apply() None[source]

Apply the config to all Python loggers.

apply_diff(diffconfig: LoggerControlConfig) LoggerControlConfig[source]

Apply a diff config to ourself.

diff(baseconfig: LoggerControlConfig) LoggerControlConfig[source]

Return a config containing only changes compared to a base config.

Note that this omits all NOTSET values that resolve to NOTSET in the base config.

This diffed config can later be used with apply_diff() against the base config to recreate the state represented by self.

classmethod from_current_loggers() Self[source]

Build a config from the current set of loggers.

levels: IOAttrs object at 0x7fd642e63080>]
would_make_changes() bool[source]

Return whether calling apply would change anything.

bacommon.logging module

Logging functionality.

bacommon.logging.get_base_logger_control_config_client() LoggerControlConfig[source]

Return the logger-control-config used by the ballistica client.

bacommon.login module

Functionality related to cloud based assets.

class bacommon.login.LoginType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Types of logins available.

EMAIL = 'email'
GAME_CENTER = 'game_center'
GPGS = 'gpgs'
property displayname: str

Human readable name for this value.

property displaynameshort: str

Human readable name for this value.

bacommon.net module

Network related data and functionality.

class bacommon.net.PrivateHostingConfig(session_type: str = 'ffa', playlist_name: str = 'Unknown', randomize: bool = False, tutorial: bool = False, custom_team_names: tuple[str, str] | None = None, custom_team_colors: tuple[tuple[float, float, float], tuple[float, float, float]] | None = None, playlist: list[dict[str, Any]] | None = None, exit_minutes: float = 120.0, exit_minutes_unclean: float = 180.0, exit_minutes_idle: float = 10.0)[source]

Bases: object

Config provided when hosting a private party.

custom_team_colors: tuple[tuple[float, float, float], tuple[float, float, float]] | None = None
custom_team_names: tuple[str, str] | None = None
exit_minutes: float = 120.0
exit_minutes_idle: float = 10.0
exit_minutes_unclean: float = 180.0
playlist: list[dict[str, Any]] | None = None
playlist_name: str = 'Unknown'
randomize: bool = False
session_type: str = 'ffa'
tutorial: bool = False
class bacommon.net.PrivateHostingState(unavailable_error: str | None = None, party_code: str | None = None, tickets_to_host_now: int = 0, tokens_to_host_now: int = 0, minutes_until_free_host: float | None = None, free_host_minutes_remaining: float | None = None)[source]

Bases: object

Combined state of whether we’re hosting, whether we can, etc.

free_host_minutes_remaining: float | None = None
minutes_until_free_host: float | None = None
party_code: str | None = None
tickets_to_host_now: int = 0
tokens_to_host_now: int = 0
unavailable_error: str | None = None
class bacommon.net.PrivatePartyConnectResult(error: str | None = None, address4: ~typing.Annotated[str | None, <efro.dataclassio.IOAttrs object at 0x7fd642d07170>] = None, address6: ~typing.Annotated[str | None, <efro.dataclassio.IOAttrs object at 0x7fd642d07050>] = None, port: int | None = None, password: str | None = None)[source]

Bases: object

Info about a server we get back when connecting.

address4: IOAttrs object at 0x7fd642d07a10>] = None
address6: IOAttrs object at 0x7fd642d06b40>] = None
error: str | None = None
password: str | None = None
port: int | None = None
class bacommon.net.ServerNodeEntry(zone: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7fd642d445c0>], latlong: ~typing.Annotated[tuple[float, float] | None, <efro.dataclassio.IOAttrs object at 0x7fd642d44560>], address: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7fd6431d5b50>], port: ~typing.Annotated[int, <efro.dataclassio.IOAttrs object at 0x7fd6431d5b80>])[source]

Bases: object

Information about a specific server.

address: IOAttrs object at 0x7fd6431d7740>]
latlong: IOAttrs object at 0x7fd6430105f0>]
port: IOAttrs object at 0x7fd6434654c0>]
zone: IOAttrs object at 0x7fd6432c7350>]
class bacommon.net.ServerNodeQueryResponse(time: ~typing.Annotated[~datetime.datetime, <efro.dataclassio.IOAttrs object at 0x7fd642d44da0>], latlong: ~typing.Annotated[tuple[float, float] | None, <efro.dataclassio.IOAttrs object at 0x7fd642d44e60>], ping_per_dist: ~typing.Annotated[float, <efro.dataclassio.IOAttrs object at 0x7fd643012300>], max_dist: ~typing.Annotated[float, <efro.dataclassio.IOAttrs object at 0x7fd643012360>], debug_log_seconds: ~typing.Annotated[float | None, <efro.dataclassio.IOAttrs object at 0x7fd64314fb30>] = None, error: ~typing.Annotated[str | None, <efro.dataclassio.IOAttrs object at 0x7fd6430120c0>] = None, servers: ~typing.Annotated[list[~bacommon.net.ServerNodeEntry], <efro.dataclassio.IOAttrs object at 0x7fd643487620>] = <factory>)[source]

Bases: object

A response to a query about server-nodes.

debug_log_seconds: IOAttrs object at 0x7fd643189be0>] = None
error: IOAttrs object at 0x7fd64318b2f0>] = None
latlong: IOAttrs object at 0x7fd643012ba0>]
max_dist: IOAttrs object at 0x7fd642d47620>]
ping_per_dist: IOAttrs object at 0x7fd642d582f0>]
servers: IOAttrs object at 0x7fd642d59400>]
time: IOAttrs object at 0x7fd642d59520>]

bacommon.servermanager module

Functionality related to the server manager script.

class bacommon.servermanager.ChatMessageCommand(message: str, clients: list[int] | None)[source]

Bases: ServerCommand

Chat message from the server.

clients: list[int] | None
message: str
class bacommon.servermanager.ClientListCommand[source]

Bases: ServerCommand

Print a list of clients.

class bacommon.servermanager.KickCommand(client_id: int, ban_time: int | None)[source]

Bases: ServerCommand

Kick a client.

ban_time: int | None
client_id: int
class bacommon.servermanager.ScreenMessageCommand(message: str, color: tuple[float, float, float] | None, clients: list[int] | None)[source]

Bases: ServerCommand

Screen-message from the server.

clients: list[int] | None
color: tuple[float, float, float] | None
message: str
class bacommon.servermanager.ServerCommand[source]

Bases: object

Base class for commands that can be sent to the server.

class bacommon.servermanager.ServerConfig(party_name: str = 'FFA', party_is_public: bool = True, authenticate_clients: bool = True, admins: list[str] = <factory>, enable_default_kick_voting: bool = True, public_ipv4_address: str | None = None, public_ipv6_address: str | None = None, port: int = 43210, max_party_size: int = 6, session_max_players_override: int | None = None, session_type: str = 'ffa', playlist_code: int | None = None, playlist_inline: list[dict[str, ~typing.Any]] | None = None, playlist_shuffle: bool = True, auto_balance_teams: bool = True, coop_campaign: str = 'Easy', coop_level: str = 'Onslaught Training', enable_telnet: bool = False, teams_series_length: int = 7, ffa_series_length: int = 24, stats_url: str | None = None, clean_exit_minutes: float | None = None, unclean_exit_minutes: float | None = None, idle_exit_minutes: float | None = None, show_tutorial: bool = False, team_names: tuple[str, str] | None = None, team_colors: tuple[tuple[float, float, float], tuple[float, float, float]] | None = None, enable_queue: bool = True, protocol_version: int | None = None, stress_test_players: int | None = None, player_rejoin_cooldown: float = 10.0)[source]

Bases: object

Configuration for the server manager app (<appname>_server).

admins: list[str]
authenticate_clients: bool = True
auto_balance_teams: bool = True
clean_exit_minutes: float | None = None
coop_campaign: str = 'Easy'
coop_level: str = 'Onslaught Training'
enable_default_kick_voting: bool = True
enable_queue: bool = True
enable_telnet: bool = False
ffa_series_length: int = 24
idle_exit_minutes: float | None = None
max_party_size: int = 6
party_is_public: bool = True
party_name: str = 'FFA'
player_rejoin_cooldown: float = 10.0
playlist_code: int | None = None
playlist_inline: list[dict[str, Any]] | None = None
playlist_shuffle: bool = True
port: int = 43210
protocol_version: int | None = None
public_ipv4_address: str | None = None
public_ipv6_address: str | None = None
session_max_players_override: int | None = None
session_type: str = 'ffa'
show_tutorial: bool = False
stats_url: str | None = None
stress_test_players: int | None = None
team_colors: tuple[tuple[float, float, float], tuple[float, float, float]] | None = None
team_names: tuple[str, str] | None = None
teams_series_length: int = 7
unclean_exit_minutes: float | None = None
class bacommon.servermanager.ShutdownCommand(reason: ShutdownReason, immediate: bool)[source]

Bases: ServerCommand

Tells the server to shut down.

immediate: bool
reason: ShutdownReason
class bacommon.servermanager.ShutdownReason(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Reason a server is shutting down.

NONE = 'none'
RESTARTING = 'restarting'
class bacommon.servermanager.StartServerModeCommand(config: ServerConfig)[source]

Bases: ServerCommand

Tells the app to switch into ‘server’ mode.

config: ServerConfig

bacommon.transfer module

Functionality related to transferring files/data.

class bacommon.transfer.DirectoryManifest(files: ~typing.Annotated[dict[str, ~bacommon.transfer.DirectoryManifestFile], <efro.dataclassio.IOAttrs object at 0x7fd642cadac0>], exists: ~typing.Annotated[bool, <efro.dataclassio.IOAttrs object at 0x7fd642cac320>])[source]

Bases: object

Contains a summary of files in a directory.

classmethod create_from_disk(path: Path) DirectoryManifest[source]

Create a manifest from a directory on disk.

exists: IOAttrs object at 0x7fd642d45550>]
files: IOAttrs object at 0x7fd642cacef0>]
validate() None[source]

Log any odd data in the manifest; for debugging.

class bacommon.transfer.DirectoryManifestFile(hash_sha256: ~typing.Annotated[str, <efro.dataclassio.IOAttrs object at 0x7fd642b23650>], size: ~typing.Annotated[int, <efro.dataclassio.IOAttrs object at 0x7fd642b23b30>])[source]

Bases: object

Describes a file in a manifest.

hash_sha256: IOAttrs object at 0x7fd642b21040>]
size: IOAttrs object at 0x7fd642d06210>]

Module contents

Functionality and data common to ballistica client and server components.