bacommon.app

Common high level values/functionality related to apps.

  1# Released under the MIT License. See LICENSE for details.
  2#
  3"""Common high level values/functionality related to apps."""
  4
  5from __future__ import annotations
  6
  7from enum import Enum
  8from dataclasses import dataclass
  9from typing import TYPE_CHECKING, Annotated
 10
 11from efro.dataclassio import ioprepped, IOAttrs
 12
 13if TYPE_CHECKING:
 14    pass
 15
 16
 17class AppInterfaceIdiom(Enum):
 18    """A general form-factor or way of experiencing a Ballistica app.
 19
 20    Note that it is possible for a running app to switch idioms (for
 21    instance if a mobile device or computer is connected to a TV).
 22    """
 23
 24    PHONE = 'phone'
 25    TABLET = 'tablet'
 26    DESKTOP = 'desktop'
 27    TV = 'tv'
 28    XR = 'xr'
 29
 30
 31class AppExperience(Enum):
 32    """A particular experience that can be provided by a Ballistica app.
 33
 34    This is one metric used to isolate different playerbases from
 35    eachother where there might be no technical barriers doing so.
 36    For example, a casual one-hand-playable phone game and an augmented
 37    reality tabletop game may both use the same scene-versions and
 38    networking-protocols and whatnot, but it would make no sense to
 39    allow players of one join servers for the other. AppExperience can
 40    be used to keep these player bases separate.
 41
 42    Generally a single Ballistica app targets a single AppExperience.
 43    This is not a technical requirement, however. A single app may
 44    support multiple experiences, or there may be multiple apps
 45    targeting one experience. Cloud components such as leagues are
 46    generally associated with an AppExperience so that they are only
 47    visible to client apps designed for that play style.
 48    """
 49
 50    # An experience that is supported everywhere. Used
 51    # for the default empty AppMode when starting the app, etc.
 52    EMPTY = 'empty'
 53
 54    # The traditional BombSquad experience: multiple players using
 55    # controllers in a single arena small enough for all action to be
 56    # viewed on a single screen.
 57    MELEE = 'melee'
 58
 59    # The traditional BombSquad Remote experience; buttons on a
 60    # touch-screen allowing a mobile device to be used as a game
 61    # controller.
 62    REMOTE = 'remote'
 63
 64
 65class AppArchitecture(Enum):
 66    """Processor architecture the App is running on."""
 67
 68    ARM = 'arm'
 69    ARM64 = 'arm64'
 70    X86 = 'x86'
 71    X86_64 = 'x86_64'
 72
 73
 74class AppPlatform(Enum):
 75    """Overall platform a Ballistica build can be targeting.
 76
 77    Each distinct flavor of an app has a unique combination
 78    of AppPlatform and AppVariant. Generally platform describes
 79    a set of hardware, while variant describes a destination or
 80    purpose for the build.
 81    """
 82
 83    MAC = 'mac'
 84    WINDOWS = 'windows'
 85    LINUX = 'linux'
 86    ANDROID = 'android'
 87    IOS = 'ios'
 88    TVOS = 'tvos'
 89
 90
 91class AppVariant(Enum):
 92    """A unique Ballistica build type within a single platform.
 93
 94    Each distinct flavor of an app has a unique combination
 95    of AppPlatform and AppVariant. Generally platform describes
 96    a set of hardware, while variant describes a destination or
 97    purpose for the build.
 98    """
 99
100    # Default builds.
101    GENERIC = 'generic'
102
103    # Builds intended for public testing (may have some extra checks
104    # or logging enabled).
105    TEST = 'test'
106
107    # Various stores.
108    AMAZON_APPSTORE = 'amazon_appstore'
109    GOOGLE_PLAY = 'google_play'
110    APP_STORE = 'app_store'
111    WINDOWS_STORE = 'windows_store'
112    STEAM = 'steam'
113    META = 'meta'
114    EPIC_GAMES_STORE = 'epic_games_store'
115
116    # Other.
117    ARCADE = 'arcade'
118    DEMO = 'demo'
119
120
121@ioprepped
122@dataclass
123class AppInstanceInfo:
124    """General info about an individual running app."""
125
126    name = Annotated[str, IOAttrs('n')]
127    version = Annotated[str, IOAttrs('v')]
128    build = Annotated[int, IOAttrs('b')]
129
130    platform = Annotated[AppPlatform, IOAttrs('p')]
131    variant = Annotated[AppVariant, IOAttrs('va')]
132    architecture = Annotated[AppArchitecture, IOAttrs('a')]
133    os_version = Annotated[str | None, IOAttrs('o')]
134
135    interface_idiom: Annotated[AppInterfaceIdiom, IOAttrs('i')]
136    locale: Annotated[str, IOAttrs('l')]
137
138    device: Annotated[str | None, IOAttrs('d')]
class AppInterfaceIdiom(enum.Enum):
18class AppInterfaceIdiom(Enum):
19    """A general form-factor or way of experiencing a Ballistica app.
20
21    Note that it is possible for a running app to switch idioms (for
22    instance if a mobile device or computer is connected to a TV).
23    """
24
25    PHONE = 'phone'
26    TABLET = 'tablet'
27    DESKTOP = 'desktop'
28    TV = 'tv'
29    XR = 'xr'

A general form-factor or way 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).

PHONE = <AppInterfaceIdiom.PHONE: 'phone'>
TABLET = <AppInterfaceIdiom.TABLET: 'tablet'>
DESKTOP = <AppInterfaceIdiom.DESKTOP: 'desktop'>
TV = <AppInterfaceIdiom.TV: 'tv'>
XR = <AppInterfaceIdiom.XR: 'xr'>
Inherited Members
enum.Enum
name
value
class AppExperience(enum.Enum):
32class AppExperience(Enum):
33    """A particular experience that can be provided by a Ballistica app.
34
35    This is one metric used to isolate different playerbases from
36    eachother where there might be no technical barriers doing so.
37    For example, a casual one-hand-playable phone game and an augmented
38    reality tabletop game may both use the same scene-versions and
39    networking-protocols and whatnot, but it would make no sense to
40    allow players of one join servers for the other. AppExperience can
41    be used to keep these player bases separate.
42
43    Generally a single Ballistica app targets a single AppExperience.
44    This is not a technical requirement, however. A single app may
45    support multiple experiences, or there may be multiple apps
46    targeting one experience. Cloud components such as leagues are
47    generally associated with an AppExperience so that they are only
48    visible to client apps designed for that play style.
49    """
50
51    # An experience that is supported everywhere. Used
52    # for the default empty AppMode when starting the app, etc.
53    EMPTY = 'empty'
54
55    # The traditional BombSquad experience: multiple players using
56    # controllers in a single arena small enough for all action to be
57    # viewed on a single screen.
58    MELEE = 'melee'
59
60    # The traditional BombSquad Remote experience; buttons on a
61    # touch-screen allowing a mobile device to be used as a game
62    # controller.
63    REMOTE = 'remote'

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

This is one metric used to isolate different playerbases from eachother 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 join servers for 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 = <AppExperience.EMPTY: 'empty'>
MELEE = <AppExperience.MELEE: 'melee'>
REMOTE = <AppExperience.REMOTE: 'remote'>
Inherited Members
enum.Enum
name
value
class AppArchitecture(enum.Enum):
66class AppArchitecture(Enum):
67    """Processor architecture the App is running on."""
68
69    ARM = 'arm'
70    ARM64 = 'arm64'
71    X86 = 'x86'
72    X86_64 = 'x86_64'

Processor architecture the App is running on.

ARM = <AppArchitecture.ARM: 'arm'>
ARM64 = <AppArchitecture.ARM64: 'arm64'>
X86 = <AppArchitecture.X86: 'x86'>
X86_64 = <AppArchitecture.X86_64: 'x86_64'>
Inherited Members
enum.Enum
name
value
class AppPlatform(enum.Enum):
75class AppPlatform(Enum):
76    """Overall platform a Ballistica build can be targeting.
77
78    Each distinct flavor of an app has a unique combination
79    of AppPlatform and AppVariant. Generally platform describes
80    a set of hardware, while variant describes a destination or
81    purpose for the build.
82    """
83
84    MAC = 'mac'
85    WINDOWS = 'windows'
86    LINUX = 'linux'
87    ANDROID = 'android'
88    IOS = 'ios'
89    TVOS = 'tvos'

Overall platform a Ballistica build can be 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.

MAC = <AppPlatform.MAC: 'mac'>
WINDOWS = <AppPlatform.WINDOWS: 'windows'>
LINUX = <AppPlatform.LINUX: 'linux'>
ANDROID = <AppPlatform.ANDROID: 'android'>
IOS = <AppPlatform.IOS: 'ios'>
TVOS = <AppPlatform.TVOS: 'tvos'>
Inherited Members
enum.Enum
name
value
class AppVariant(enum.Enum):
 92class AppVariant(Enum):
 93    """A unique Ballistica build type within a single platform.
 94
 95    Each distinct flavor of an app has a unique combination
 96    of AppPlatform and AppVariant. Generally platform describes
 97    a set of hardware, while variant describes a destination or
 98    purpose for the build.
 99    """
100
101    # Default builds.
102    GENERIC = 'generic'
103
104    # Builds intended for public testing (may have some extra checks
105    # or logging enabled).
106    TEST = 'test'
107
108    # Various stores.
109    AMAZON_APPSTORE = 'amazon_appstore'
110    GOOGLE_PLAY = 'google_play'
111    APP_STORE = 'app_store'
112    WINDOWS_STORE = 'windows_store'
113    STEAM = 'steam'
114    META = 'meta'
115    EPIC_GAMES_STORE = 'epic_games_store'
116
117    # Other.
118    ARCADE = 'arcade'
119    DEMO = 'demo'

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.

GENERIC = <AppVariant.GENERIC: 'generic'>
TEST = <AppVariant.TEST: 'test'>
AMAZON_APPSTORE = <AppVariant.AMAZON_APPSTORE: 'amazon_appstore'>
GOOGLE_PLAY = <AppVariant.GOOGLE_PLAY: 'google_play'>
APP_STORE = <AppVariant.APP_STORE: 'app_store'>
WINDOWS_STORE = <AppVariant.WINDOWS_STORE: 'windows_store'>
STEAM = <AppVariant.STEAM: 'steam'>
META = <AppVariant.META: 'meta'>
EPIC_GAMES_STORE = <AppVariant.EPIC_GAMES_STORE: 'epic_games_store'>
ARCADE = <AppVariant.ARCADE: 'arcade'>
DEMO = <AppVariant.DEMO: 'demo'>
Inherited Members
enum.Enum
name
value
@ioprepped
@dataclass
class AppInstanceInfo:
122@ioprepped
123@dataclass
124class AppInstanceInfo:
125    """General info about an individual running app."""
126
127    name = Annotated[str, IOAttrs('n')]
128    version = Annotated[str, IOAttrs('v')]
129    build = Annotated[int, IOAttrs('b')]
130
131    platform = Annotated[AppPlatform, IOAttrs('p')]
132    variant = Annotated[AppVariant, IOAttrs('va')]
133    architecture = Annotated[AppArchitecture, IOAttrs('a')]
134    os_version = Annotated[str | None, IOAttrs('o')]
135
136    interface_idiom: Annotated[AppInterfaceIdiom, IOAttrs('i')]
137    locale: Annotated[str, IOAttrs('l')]
138
139    device: Annotated[str | None, IOAttrs('d')]

General info about an individual running app.

AppInstanceInfo( interface_idiom: Annotated[AppInterfaceIdiom, <efro.dataclassio._base.IOAttrs object>], locale: Annotated[str, <efro.dataclassio._base.IOAttrs object>], device: Annotated[str | None, <efro.dataclassio._base.IOAttrs object>])
name = typing.Annotated[str, <efro.dataclassio._base.IOAttrs object>]
version = typing.Annotated[str, <efro.dataclassio._base.IOAttrs object>]
build = typing.Annotated[int, <efro.dataclassio._base.IOAttrs object>]
platform = typing.Annotated[AppPlatform, <efro.dataclassio._base.IOAttrs object>]
variant = typing.Annotated[AppVariant, <efro.dataclassio._base.IOAttrs object>]
architecture = typing.Annotated[AppArchitecture, <efro.dataclassio._base.IOAttrs object>]
os_version = typing.Annotated[str | None, <efro.dataclassio._base.IOAttrs object>]
interface_idiom: Annotated[AppInterfaceIdiom, <efro.dataclassio._base.IOAttrs object at 0x1063a5c10>]
locale: Annotated[str, <efro.dataclassio._base.IOAttrs object at 0x106438e90>]
device: Annotated[str | None, <efro.dataclassio._base.IOAttrs object at 0x106438f80>]