sc2_datasets.replay_parser.init_data.game_description ===================================================== .. py:module:: sc2_datasets.replay_parser.init_data.game_description Classes ------- .. autoapisummary:: sc2_datasets.replay_parser.init_data.game_description.GameDescription Module Contents --------------- .. py:class:: GameDescription Specifies essential parameters for a StarCraft II replay in the GameDescription. :param gameOptions: Options within the game, including settings like fog, random races, competitive mode, etc. :type gameOptions: GameOptions :param gameSpeed: The speed at which the game runs. Enumeration: [Slower, Slow, Normal, Fast, Faster]. Default is Faster. :type gameSpeed: str :param isBlizzardMap: Indicates if the map was created by Blizzard. :type isBlizzardMap: bool :param mapAuthorName: Nickname or full name of the map's author. :type mapAuthorName: str :param mapFileSyncChecksum: The checksum for map file synchronization. :type mapFileSyncChecksum: int :param mapSizeX: The size of the map in pixels on the X-axis. :type mapSizeX: int :param mapSizeY: The size of the map in pixels on the Y-axis. :type mapSizeY: int :param maxPlayers: The maximum number of players allowed on this map simultaneously. :type maxPlayers: int .. py:attribute:: gameOptions :type: sc2_datasets.replay_parser.init_data.game_options.GameOptions .. py:attribute:: gameSpeed :type: str .. py:attribute:: isBlizzardMap :type: bool .. py:attribute:: mapAuthorName :type: str .. py:attribute:: mapFileSyncChecksum :type: int .. py:attribute:: mapSizeX :type: int .. py:attribute:: mapSizeY :type: int .. py:attribute:: maxPlayers :type: int .. py:method:: from_dict(d: dict[str, Any]) -> GameDescription :staticmethod: Static method that initializes a GameDescription class from a dictionary. This aids in parsing the original JSON content from an .SC2Replay file. :param d: Dictionary obtained from preprocessing an .SC2Replay file in JSON format. :type d: dict[str, Any] :returns: An initialized instance of the GameDescription class. :rtype: GameDescription .. rubric:: Examples **Correct Usage Examples:** Using from_dict factory method provides ease of use when parsing a replay pre-processed with SC2InfoExtractorGo_ This method requires a dictionary representation of data to be passed as a parameter because of the built in json parser provided by the Python standard library. _SC2InfoExtractorGo: https://github.com/Kaszanas/SC2InfoExtractorGo The use of this method is intended to get game description information from the game's json representation. >>> from sc2egset_dataset.dataset.replay_data.replay_parser.init_data.game_options import GameOptions #noqa >>> game_options_object = { ... "advancedSharedControl": False, ... "amm": False, ... "battleNet": False, ... "clientDebugFlags": 265, ... "competitive": False, ... "cooperative": False, ... "fog": 0, ... "heroDuplicatesAllowed": True, ... "lockTeams": True, ... "noVictoryOrDefeat": False, ... "observers": 0, ... "practice": False, ... "randomRaces": False, ... "teamsTogether": False, ... "userDifficulty": 0} ... >>> game_description_dict ={ ... "gameOptions": game_options_object, ... "gameSpeed": "Faster", ... "isBlizzardMap": True, ... "mapAuthorName": "98-S2-1-26", ... "mapFileSyncChecksum": 2133219109, ... "mapSizeX": 144, ... "mapSizeY": 160, ... "maxPlayers": 2 ... } ... >>> game_description_object = GameDescription.from_dict(d=game_description_dict) ... >>> assert isinstance(game_description_object, GameDescription) >>> assert isinstance(game_description_object.gameOptions, GameOptions) >>> assert isinstance(game_description_object.gameSpeed, str) >>> assert isinstance(game_description_object.isBlizzardMap, bool) >>> assert isinstance(game_description_object.mapAuthorName, str) >>> assert isinstance(game_description_object.mapFileSyncChecksum, int) >>> assert isinstance(game_description_object.mapSizeX, int) >>> assert isinstance(game_description_object.mapSizeY, int) >>> assert isinstance(game_description_object.maxPlayers, int) ... >>> assert game_description_object.gameOptions == game_options_object >>> assert game_description_object.gameSpeed == "Faster" >>> assert game_description_object.isBlizzardMap == True >>> assert game_description_object.mapAuthorName == "98-S2-1-26" >>> assert game_description_object.mapFileSyncChecksum == 2133219109 >>> assert game_description_object.mapSizeX == 144 >>> assert game_description_object.mapSizeY == 160 >>> assert game_description_object.maxPlayers == 2 ... >>> assert game_description_object.mapFileSyncChecksum > 0 >>> assert game_description_object.mapSizeX > 0 >>> assert game_description_object.mapSizeY > 0 >>> assert game_description_object.maxPlayers > 0 **Incorrect Usage Examples:** >>> gameOptions_value_wrong = "False" >>> gameSpeed_value_wrong = True >>> isBlizzardMap_value_wrong = "wrong type" >>> mapAuthorName_value_wrong = int(2) >>> mapFileSyncChecksum_value_wrong = str(2) >>> mapSizeX_value_wrong = str(2) >>> mapSizeY_value_wrong = str(2) >>> maxPlayers_value_wrong = str(2) >>> GameDescription( ... gameOptions=gameOptions_value_wrong, ... gameSpeed=gameSpeed_value_wrong, ... isBlizzardMap=isBlizzardMap_value_wrong, ... mapAuthorName=mapAuthorName_value_wrong, ... mapFileSyncChecksum=mapFileSyncChecksum_value_wrong, ... mapSizeX=mapSizeX_value_wrong, ... mapSizeY=mapSizeY_value_wrong, ... maxPlayers=maxPlayers_value_wrong) Traceback (most recent call last): ... TypeError: unsupported operand type(s) ...