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 method 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 each
 35    other where there might be no technical barriers doing so. For
 36    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 to join servers of 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 for the default
 51    # empty AppMode when starting the app, etc.
 52    EMPTY = 'empty'
 53
 54    # The traditional BombSquad experience: multiple players using
 55    # traditional game controllers (or touch screen equivalents) in a
 56    # single arena small enough for all action to be viewed on a single
 57    # 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'
 64
 65
 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'
 73
 74
 75class AppPlatform(Enum):
 76    """Overall platform a Ballistica build is targeting.
 77
 78    Each distinct flavor of an app has a unique combination of
 79    AppPlatform and AppVariant. Generally platform describes a set of
 80    hardware, while variant describes a destination or purpose for the
 81    build.
 82    """
 83
 84    MAC = 'mac'
 85    WINDOWS = 'windows'
 86    LINUX = 'linux'
 87    ANDROID = 'android'
 88    IOS = 'ios'
 89    TVOS = 'tvos'
 90
 91
 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 of
 96    AppPlatform and AppVariant. Generally platform describes a set of
 97    hardware, while variant describes a destination or purpose for the
 98    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'
120
121
122@ioprepped
123@dataclass
124class AppInstanceInfo:
125    """General info about an individual running app."""
126
127    name = Annotated[str, IOAttrs('n')]
128
129    engine_version = Annotated[str, IOAttrs('ev')]
130    engine_build = Annotated[int, IOAttrs('eb')]
131
132    platform = Annotated[AppPlatform, IOAttrs('p')]
133    variant = Annotated[AppVariant, IOAttrs('va')]
134    architecture = Annotated[AppArchitecture, IOAttrs('a')]
135    os_version = Annotated[str | None, IOAttrs('o')]
136
137    interface_idiom: Annotated[AppInterfaceIdiom, IOAttrs('i')]
138    locale: Annotated[str, IOAttrs('l')]
139
140    device: Annotated[str | None, IOAttrs('d')]
class AppInterfaceIdiom(enum.Enum):
18class AppInterfaceIdiom(Enum):
19    """A general form-factor or method 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 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).

PHONE = <AppInterfaceIdiom.PHONE: 'phone'>
TABLET = <AppInterfaceIdiom.TABLET: 'tablet'>
DESKTOP = <AppInterfaceIdiom.DESKTOP: 'desktop'>
TV = <AppInterfaceIdiom.TV: 'tv'>
XR = <AppInterfaceIdiom.XR: 'xr'>
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 each
36    other where there might be no technical barriers doing so. For
37    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 to join servers of 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 for the default
52    # empty AppMode when starting the app, etc.
53    EMPTY = 'empty'
54
55    # The traditional BombSquad experience: multiple players using
56    # traditional game controllers (or touch screen equivalents) in a
57    # single arena small enough for all action to be viewed on a single
58    # screen.
59    MELEE = 'melee'
60
61    # The traditional BombSquad Remote experience; buttons on a
62    # touch-screen allowing a mobile device to be used as a game
63    # controller.
64    REMOTE = 'remote'

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 = <AppExperience.EMPTY: 'empty'>
MELEE = <AppExperience.MELEE: 'melee'>
REMOTE = <AppExperience.REMOTE: 'remote'>
class AppArchitecture(enum.Enum):
67class AppArchitecture(Enum):
68    """Processor architecture the App is running on."""
69
70    ARM = 'arm'
71    ARM64 = 'arm64'
72    X86 = 'x86'
73    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'>
class AppPlatform(enum.Enum):
76class AppPlatform(Enum):
77    """Overall platform a Ballistica build is targeting.
78
79    Each distinct flavor of an app has a unique combination of
80    AppPlatform and AppVariant. Generally platform describes a set of
81    hardware, while variant describes a destination or purpose for the
82    build.
83    """
84
85    MAC = 'mac'
86    WINDOWS = 'windows'
87    LINUX = 'linux'
88    ANDROID = 'android'
89    IOS = 'ios'
90    TVOS = 'tvos'

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.

MAC = <AppPlatform.MAC: 'mac'>
WINDOWS = <AppPlatform.WINDOWS: 'windows'>
LINUX = <AppPlatform.LINUX: 'linux'>
ANDROID = <AppPlatform.ANDROID: 'android'>
IOS = <AppPlatform.IOS: 'ios'>
TVOS = <AppPlatform.TVOS: 'tvos'>
class AppVariant(enum.Enum):
 93class AppVariant(Enum):
 94    """A unique Ballistica build type within a single platform.
 95
 96    Each distinct flavor of an app has a unique combination of
 97    AppPlatform and AppVariant. Generally platform describes a set of
 98    hardware, while variant describes a destination or purpose for the
 99    build.
100    """
101
102    # Default builds.
103    GENERIC = 'generic'
104
105    # Builds intended for public testing (may have some extra checks
106    # or logging enabled).
107    TEST = 'test'
108
109    # Various stores.
110    AMAZON_APPSTORE = 'amazon_appstore'
111    GOOGLE_PLAY = 'google_play'
112    APP_STORE = 'app_store'
113    WINDOWS_STORE = 'windows_store'
114    STEAM = 'steam'
115    META = 'meta'
116    EPIC_GAMES_STORE = 'epic_games_store'
117
118    # Other.
119    ARCADE = 'arcade'
120    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'>
@ioprepped
@dataclass
class AppInstanceInfo:
123@ioprepped
124@dataclass
125class AppInstanceInfo:
126    """General info about an individual running app."""
127
128    name = Annotated[str, IOAttrs('n')]
129
130    engine_version = Annotated[str, IOAttrs('ev')]
131    engine_build = Annotated[int, IOAttrs('eb')]
132
133    platform = Annotated[AppPlatform, IOAttrs('p')]
134    variant = Annotated[AppVariant, IOAttrs('va')]
135    architecture = Annotated[AppArchitecture, IOAttrs('a')]
136    os_version = Annotated[str | None, IOAttrs('o')]
137
138    interface_idiom: Annotated[AppInterfaceIdiom, IOAttrs('i')]
139    locale: Annotated[str, IOAttrs('l')]
140
141    device: Annotated[str | None, IOAttrs('d')]

General info about an individual running app.

AppInstanceInfo( interface_idiom: Annotated[AppInterfaceIdiom, <efro.dataclassio.IOAttrs object>], locale: Annotated[str, <efro.dataclassio.IOAttrs object>], device: Annotated[str | None, <efro.dataclassio.IOAttrs object>])
name = typing.Annotated[str, <efro.dataclassio.IOAttrs object>]
engine_version = typing.Annotated[str, <efro.dataclassio.IOAttrs object>]
engine_build = typing.Annotated[int, <efro.dataclassio.IOAttrs object>]
platform = typing.Annotated[AppPlatform, <efro.dataclassio.IOAttrs object>]
variant = typing.Annotated[AppVariant, <efro.dataclassio.IOAttrs object>]
architecture = typing.Annotated[AppArchitecture, <efro.dataclassio.IOAttrs object>]
os_version = typing.Annotated[str | None, <efro.dataclassio.IOAttrs object>]
interface_idiom: Annotated[AppInterfaceIdiom, <efro.dataclassio.IOAttrs object at 0x1066e3b90>]
locale: Annotated[str, <efro.dataclassio.IOAttrs object at 0x1062144d0>]
device: Annotated[str | None, <efro.dataclassio.IOAttrs object at 0x1066e85c0>]