From 9cf0bf382a02510a3d5ab2fab933760f31569e46 Mon Sep 17 00:00:00 2001 From: Matthias Dittrich Date: Sun, 10 Sep 2017 14:08:54 +0200 Subject: [PATCH] update to proto3 syntax --- s2clientprotocol/common.proto | 34 ++--- s2clientprotocol/data.proto | 102 +++++++-------- s2clientprotocol/debug.proto | 64 +++++----- s2clientprotocol/error.proto | 3 +- s2clientprotocol/query.proto | 22 ++-- s2clientprotocol/raw.proto | 119 +++++++++--------- s2clientprotocol/sc2api.proto | 222 +++++++++++++++++---------------- s2clientprotocol/score.proto | 77 ++++++------ s2clientprotocol/spatial.proto | 67 +++++----- s2clientprotocol/ui.proto | 55 ++++---- 10 files changed, 397 insertions(+), 368 deletions(-) diff --git a/s2clientprotocol/common.proto b/s2clientprotocol/common.proto index 081f306..d13445a 100644 --- a/s2clientprotocol/common.proto +++ b/s2clientprotocol/common.proto @@ -1,51 +1,51 @@ -syntax = "proto2"; +syntax = "proto3"; package SC2APIProtocol; message AvailableAbility { - optional int32 ability_id = 1; - optional bool requires_point = 2; + int32 ability_id = 1; + bool requires_point = 2; } message ImageData { - optional int32 bits_per_pixel = 1; // Number of bits per pixel; 8 bits for a byte etc. - optional Size2DI size = 2; // Dimension in pixels. - optional bytes data = 3; // Binary data; the size of this buffer in bytes is width * height * bits_per_pixel / 8. + int32 bits_per_pixel = 1; // Number of bits per pixel; 8 bits for a byte etc. + Size2DI size = 2; // Dimension in pixels. + bytes data = 3; // Binary data; the size of this buffer in bytes is width * height * bits_per_pixel / 8. } // Point on the screen/minimap (e.g., 0..64). // Note: bottom left of the screen is 0, 0. message PointI { - optional int32 x = 1; - optional int32 y = 2; + int32 x = 1; + int32 y = 2; } // Screen space rectangular area. message RectangleI { - optional PointI p0 = 1; - optional PointI p1 = 2; + PointI p0 = 1; + PointI p1 = 2; } // Point on the game board, 0..255. // Note: bottom left of the screen is 0, 0. message Point2D { - optional float x = 1; - optional float y = 2; + float x = 1; + float y = 2; } // Point on the game board, 0..255. // Note: bottom left of the screen is 0, 0. message Point { - optional float x = 1; - optional float y = 2; - optional float z = 3; + float x = 1; + float y = 2; + float z = 3; } // Screen dimensions. message Size2DI { - optional int32 x = 1; - optional int32 y = 2; + int32 x = 1; + int32 y = 2; } enum Race { diff --git a/s2clientprotocol/data.proto b/s2clientprotocol/data.proto index 16cfd13..4c40b0b 100644 --- a/s2clientprotocol/data.proto +++ b/s2clientprotocol/data.proto @@ -1,5 +1,5 @@ -syntax = "proto2"; +syntax = "proto3"; package SC2APIProtocol; @@ -10,15 +10,16 @@ import "s2clientprotocol/common.proto"; // Stuff omitted: transient. // Stuff that may be important: cost, range, Alignment, targetfilters. message AbilityData { - optional uint32 ability_id = 1; // Stable ID. - optional string link_name = 2; // Catalog name of the ability. - optional uint32 link_index = 3; // Catalog index of the ability. - optional string button_name = 4; // Name used for the command card. May not always be set. - optional string friendly_name = 5; // A human friendly name when the button name or link name isn't descriptive. - optional string hotkey = 6; // Hotkey. May not always be set. - optional uint32 remaps_to_ability_id = 7; // This ability id may be represented by the given more generic id. + uint32 ability_id = 1; // Stable ID. + string link_name = 2; // Catalog name of the ability. + uint32 link_index = 3; // Catalog index of the ability. + string button_name = 4; // Name used for the command card. May not always be set. + string friendly_name = 5; // A human friendly name when the button name or link name isn't descriptive. + string hotkey = 6; // Hotkey. May not always be set. + uint32 remaps_to_ability_id = 7; // This ability id may be represented by the given more generic id. enum Target { + Target_UNSET = 0; None = 1; // Does not require a target. Point = 2; // Requires a target position. Unit = 3; // Requires a unit to target. Given by position using feature layers. @@ -26,17 +27,19 @@ message AbilityData { PointOrNone = 5; // Requires either a target point or no target. (eg. building add-ons) } - optional bool available = 8; // If true, the ability may be used by this set of mods/map. - optional Target target = 9; // Determines if a point is optional or required. - optional bool allow_minimap = 10; // Can be cast in the minimap. - optional bool allow_autocast = 11; // Autocast can be set. - optional bool is_building = 12; // Requires placement to construct a building. - optional float footprint_radius = 13; // Estimation of the footprint size. Need a better footprint. - optional bool is_instant_placement = 14; // Placement next to an existing structure, e.g., an add-on like a Tech Lab. - optional float cast_range = 15; // Range unit can cast ability without needing to approach target. + bool available = 8; // If true, the ability may be used by this set of mods/map. + Target target = 9; // Determines if a point is optional or required. + bool allow_minimap = 10; // Can be cast in the minimap. + bool allow_autocast = 11; // Autocast can be set. + bool is_building = 12; // Requires placement to construct a building. + float footprint_radius = 13; // Estimation of the footprint size. Need a better footprint. + bool is_instant_placement = 14; // Placement next to an existing structure, e.g., an add-on like a Tech Lab. + float cast_range = 15; // Range unit can cast ability without needing to approach target. + } enum Attribute { + Attribute_UNSET = 0; Light = 1; Armored = 2; Biological = 3; @@ -51,62 +54,63 @@ enum Attribute { } message DamageBonus { - optional Attribute attribute = 1; - optional float bonus = 2; + Attribute attribute = 1; + float bonus = 2; } message Weapon { enum TargetType { + TargetType_UNSET = 0; Ground = 1; Air = 2; Any = 3; } - optional TargetType type = 1; - optional float damage = 2; + TargetType type = 1; + float damage = 2; repeated DamageBonus damage_bonus = 3; - optional uint32 attacks = 4; // Number of hits per attack. (eg. Colossus has 2 beams) - optional float range = 5; - optional float speed = 6; // Time between attacks. + uint32 attacks = 4; // Number of hits per attack. (eg. Colossus has 2 beams) + float range = 5; + float speed = 6; // Time between attacks. } message UnitTypeData { - optional uint32 unit_id = 1; // Stable ID. - optional string name = 2; // Catalog name of the unit. - optional bool available = 3; // If true, the ability may be used by this set of mods/map. - optional uint32 cargo_size = 4; // Number of cargo slots it occupies in transports. - optional uint32 mineral_cost = 12; - optional uint32 vespene_cost = 13; - optional float food_required = 14; - optional float food_provided = 18; - optional uint32 ability_id = 15; // This is the ability the builds the unit - optional Race race = 16; - optional float build_time = 17; - optional bool has_vespene = 19; - optional bool has_minerals = 20; + uint32 unit_id = 1; // Stable ID. + string name = 2; // Catalog name of the unit. + bool available = 3; // If true, the ability may be used by this set of mods/map. + uint32 cargo_size = 4; // Number of cargo slots it occupies in transports. + uint32 mineral_cost = 12; + uint32 vespene_cost = 13; + float food_required = 14; + float food_provided = 18; + uint32 ability_id = 15; // This is the ability the builds the unit + Race race = 16; + float build_time = 17; + bool has_vespene = 19; + bool has_minerals = 20; repeated uint32 tech_alias = 21; // Units this is equivalent to in terms of satisfying tech requirement. - optional uint32 unit_alias = 22; // Units that are morphed variants of the same unit. + uint32 unit_alias = 22; // Units that are morphed variants of the same unit. - optional uint32 tech_requirement = 23; // Structure required to build this unit. (Or any with the same tech_alias) - optional bool require_attached = 24; // Whether tech_requirement is an add-on. + uint32 tech_requirement = 23; // Structure required to build this unit. (Or any with the same tech_alias) + bool require_attached = 24; // Whether tech_requirement is an add-on. // Values include changes from upgrades repeated Attribute attributes = 8; - optional float movement_speed = 9; - optional float armor = 10; + float movement_speed = 9; + float armor = 10; repeated Weapon weapons = 11; } message UpgradeData { - optional uint32 upgrade_id = 1; // Stable ID. - optional string name = 2; - optional uint32 mineral_cost = 3; - optional uint32 vespene_cost = 4; - optional float research_time = 5; - optional uint32 ability_id = 6; + uint32 upgrade_id = 1; // Stable ID. + string name = 2; + uint32 mineral_cost = 3; + uint32 vespene_cost = 4; + float research_time = 5; + uint32 ability_id = 6; } message BuffData { - optional uint32 buff_id = 1; // Stable ID. - optional string name = 2; + uint32 buff_id = 1; // Stable ID. + string name = 2; } diff --git a/s2clientprotocol/debug.proto b/s2clientprotocol/debug.proto index adea28a..85b091c 100644 --- a/s2clientprotocol/debug.proto +++ b/s2clientprotocol/debug.proto @@ -1,5 +1,5 @@ -syntax = "proto2"; +syntax = "proto3"; package SC2APIProtocol; @@ -28,45 +28,46 @@ message DebugDraw { } message Line { - optional Point p0 = 1; - optional Point p1 = 2; + Point p0 = 1; + Point p1 = 2; } message Color { - optional uint32 r = 1; - optional uint32 g = 2; - optional uint32 b = 3; + uint32 r = 1; + uint32 g = 2; + uint32 b = 3; } // Display debug text on screen. message DebugText { - optional Color color = 1; - optional string text = 2; // Text to display. - optional Point virtual_pos = 3; // Virtualized position in 2D (the screen is 0..1, 0..1 for any resolution). - optional Point world_pos = 4; // Position in the world. + Color color = 1; + string text = 2; // Text to display. + Point virtual_pos = 3; // Virtualized position in 2D (the screen is 0..1, 0..1 for any resolution). + Point world_pos = 4; // Position in the world. } // Display debug lines on screen. message DebugLine { - optional Color color = 1; - optional Line line = 2; // World space line. + Color color = 1; + Line line = 2; // World space line. } // Display debug boxes on screen. message DebugBox { - optional Color color = 1; - optional Point min = 2; - optional Point max = 3; + Color color = 1; + Point min = 2; + Point max = 3; } // Display debug spheres on screen. message DebugSphere { - optional Color color = 1; - optional Point p = 2; - optional float r = 3; + Color color = 1; + Point p = 2; + float r = 3; } enum DebugGameState { + DebugGameState_UNSET = 0; show_map = 1; control_enemy = 2; food = 3; @@ -82,10 +83,10 @@ enum DebugGameState { } message DebugCreateUnit { - optional uint32 unit_type = 1; - optional int32 owner = 2; - optional Point2D pos = 3; - optional uint32 quantity = 4; + uint32 unit_type = 1; + int32 owner = 2; + Point2D pos = 3; + uint32 quantity = 4; } message DebugKillUnit { @@ -94,37 +95,40 @@ message DebugKillUnit { message DebugTestProcess { enum Test { + UNSET = 0; hang = 1; crash = 2; exit = 3; } - optional Test test = 1; - optional int32 delay_ms = 2; + Test test = 1; + int32 delay_ms = 2; } message DebugSetScore { - optional float score = 1; + float score = 1; } message DebugEndGame { enum EndResult { + EndResult_UNSET = 0; Surrender = 1; // Default if nothing is set. The current player admits defeat. DeclareVictory = 2; } - optional EndResult end_result = 1; + EndResult end_result = 1; } message DebugSetUnitValue { enum UnitValue { + UnitValue_UNSET = 0; Energy = 1; Life = 2; Shields = 3; } - optional UnitValue unit_value = 1; - optional float value = 2; - optional uint64 unit_tag = 3; + UnitValue unit_value = 1; + float value = 2; + uint64 unit_tag = 3; } message DebugChat { - optional string message = 1; + string message = 1; } diff --git a/s2clientprotocol/error.proto b/s2clientprotocol/error.proto index fe223e9..1623e62 100644 --- a/s2clientprotocol/error.proto +++ b/s2clientprotocol/error.proto @@ -1,9 +1,10 @@ -syntax = "proto2"; +syntax = "proto3"; package SC2APIProtocol; enum ActionResult { + ActionResult_UNSET = 0; Success = 1; NotSupported = 2; Error = 3; diff --git a/s2clientprotocol/query.proto b/s2clientprotocol/query.proto index c4270f6..486b450 100644 --- a/s2clientprotocol/query.proto +++ b/s2clientprotocol/query.proto @@ -1,5 +1,5 @@ -syntax = "proto2"; +syntax = "proto3"; package SC2APIProtocol; @@ -10,7 +10,7 @@ message RequestQuery { repeated RequestQueryPathing pathing = 1; repeated RequestQueryAvailableAbilities abilities = 2; repeated RequestQueryBuildingPlacement placements = 3; - optional bool ignore_resource_requirements = 4; // Ignores requirements like food, minerals and so on. + bool ignore_resource_requirements = 4; // Ignores requirements like food, minerals and so on. } message ResponseQuery { @@ -25,31 +25,31 @@ message RequestQueryPathing { Point2D start_pos = 1; uint64 unit_tag = 2; } - optional Point2D end_pos = 3; + Point2D end_pos = 3; } message ResponseQueryPathing { - optional float distance = 1; // 0 if no path exists + float distance = 1; // 0 if no path exists } //-------------------------------------------------------------------------------------------------- message RequestQueryAvailableAbilities { - optional uint64 unit_tag = 1; + uint64 unit_tag = 1; } message ResponseQueryAvailableAbilities { repeated AvailableAbility abilities = 1; - optional uint64 unit_tag = 2; - optional uint32 unit_type_id = 3; + uint64 unit_tag = 2; + uint32 unit_type_id = 3; } //-------------------------------------------------------------------------------------------------- message RequestQueryBuildingPlacement { - optional int32 ability_id = 1; - optional Point2D target_pos = 2; - optional uint64 placing_unit_tag = 3; // Not required + int32 ability_id = 1; + Point2D target_pos = 2; + uint64 placing_unit_tag = 3; // Not required } message ResponseQueryBuildingPlacement { - optional ActionResult result = 1; + ActionResult result = 1; } diff --git a/s2clientprotocol/raw.proto b/s2clientprotocol/raw.proto index 23bcdcd..fca14bd 100644 --- a/s2clientprotocol/raw.proto +++ b/s2clientprotocol/raw.proto @@ -1,5 +1,5 @@ -syntax = "proto2"; +syntax = "proto3"; package SC2APIProtocol; @@ -10,11 +10,11 @@ import "s2clientprotocol/common.proto"; // message StartRaw { - optional Size2DI map_size = 1; // Width and height of the map. - optional ImageData pathing_grid = 2; // 1 byte bitmap of the pathing grid. - optional ImageData terrain_height = 3; // 1 byte bitmap of the terrain height. - optional ImageData placement_grid = 4; // 1 byte bitmap of the building placement grid. - optional RectangleI playable_area = 5; // The playable cells. + Size2DI map_size = 1; // Width and height of the map. + ImageData pathing_grid = 2; // 1 byte bitmap of the pathing grid. + ImageData terrain_height = 3; // 1 byte bitmap of the terrain height. + ImageData placement_grid = 4; // 1 byte bitmap of the building placement grid. + RectangleI playable_area = 5; // The playable cells. repeated Point2D start_locations = 6; // Possible start locations for players. } @@ -24,40 +24,42 @@ message StartRaw { // message ObservationRaw { - optional PlayerRaw player = 1; + PlayerRaw player = 1; repeated Unit units = 2; - optional MapState map_state = 3; // Fog of war, creep and so on. Board stuff that changes per frame. - optional Event event = 4; + MapState map_state = 3; // Fog of war, creep and so on. Board stuff that changes per frame. + Event event = 4; } message PowerSource { - optional Point pos = 1; - optional float radius = 2; - optional uint64 tag = 3; + Point pos = 1; + float radius = 2; + uint64 tag = 3; } message PlayerRaw { repeated PowerSource power_sources = 1; - optional Point camera = 2; + Point camera = 2; repeated uint32 upgrade_ids = 3; // TODO: Add to UI observation? } message UnitOrder { - optional uint32 ability_id = 1; + uint32 ability_id = 1; oneof target { Point target_world_space_pos = 2; uint64 target_unit_tag = 3; } - optional float progress = 4; // Progress of train abilities. Range: [0.0, 1.0] + float progress = 4; // Progress of train abilities. Range: [0.0, 1.0] } enum DisplayType { + DisplayType_UNSET = 0; Visible = 1; // Fully visible Snapshot = 2; // Dimmed version of unit left behind after entering fog of war Hidden = 3; // Fully hidden } enum Alliance { + Alliance_UNSET = 0; Self = 1; Ally = 2; Neutral = 3; @@ -65,69 +67,70 @@ enum Alliance { } enum CloakState { + CloakState_UNSET = 0; Cloaked = 1; CloakedDetected = 2; NotCloaked = 3; } message PassengerUnit { - optional uint64 tag = 1; - optional float health = 2; - optional float health_max = 3; - optional float shield = 4; - optional float energy = 5; - optional uint32 unit_type = 6; + uint64 tag = 1; + float health = 2; + float health_max = 3; + float shield = 4; + float energy = 5; + uint32 unit_type = 6; } message Unit { // Fields are populated based on type/alliance - optional DisplayType display_type = 1; - optional Alliance alliance = 2; + DisplayType display_type = 1; + Alliance alliance = 2; - optional uint64 tag = 3; // Unique identifier for a unit - optional uint32 unit_type = 4; - optional int32 owner = 5; + uint64 tag = 3; // Unique identifier for a unit + uint32 unit_type = 4; + int32 owner = 5; - optional Point pos = 6; - optional float facing = 7; - optional float radius = 8; - optional float build_progress = 9; // Range: [0.0, 1.0] - optional CloakState cloak = 10; + Point pos = 6; + float facing = 7; + float radius = 8; + float build_progress = 9; // Range: [0.0, 1.0] + CloakState cloak = 10; - optional float detect_range = 31; - optional float radar_range = 32; + float detect_range = 31; + float radar_range = 32; - optional bool is_selected = 11; - optional bool is_on_screen = 12; // Visible and within the camera frustrum. - optional bool is_blip = 13; // Detected by sensor tower - optional bool is_powered = 35; + bool is_selected = 11; + bool is_on_screen = 12; // Visible and within the camera frustrum. + bool is_blip = 13; // Detected by sensor tower + bool is_powered = 35; // Not populated for snapshots - optional float health = 14; - optional float health_max = 15; - optional float shield = 16; - optional float energy = 17; - optional int32 mineral_contents = 18; - optional int32 vespene_contents = 19; - optional bool is_flying = 20; - optional bool is_burrowed = 21; + float health = 14; + float health_max = 15; + float shield = 16; + float energy = 17; + int32 mineral_contents = 18; + int32 vespene_contents = 19; + bool is_flying = 20; + bool is_burrowed = 21; // Not populated for enemies repeated UnitOrder orders = 22; - optional uint64 add_on_tag = 23; + uint64 add_on_tag = 23; repeated PassengerUnit passengers = 24; - optional int32 cargo_space_taken = 25; - optional int32 cargo_space_max = 26; + int32 cargo_space_taken = 25; + int32 cargo_space_max = 26; repeated uint32 buff_ids = 27; // TODO: Should this be populated for enemies? - optional int32 assigned_harvesters = 28; - optional int32 ideal_harvesters = 29; - optional float weapon_cooldown = 30; - optional uint64 engaged_target_tag = 34; + int32 assigned_harvesters = 28; + int32 ideal_harvesters = 29; + float weapon_cooldown = 30; + uint64 engaged_target_tag = 34; } message MapState { - optional ImageData visibility = 1; // 1 byte visibility layer. - optional ImageData creep = 2; // 1 byte creep layer. + ImageData visibility = 1; // 1 byte visibility layer. + ImageData creep = 2; // 1 byte creep layer. } @@ -144,21 +147,21 @@ message ActionRaw { } message ActionRawUnitCommand { - optional int32 ability_id = 1; + int32 ability_id = 1; oneof target { Point2D target_world_space_pos = 2; uint64 target_unit_tag = 3; } repeated uint64 unit_tags = 4; - optional bool queue_command = 5; + bool queue_command = 5; } message ActionRawCameraMove { - optional Point center_world_space = 1; + Point center_world_space = 1; } message ActionRawToggleAutocast { - optional int32 ability_id = 1; + int32 ability_id = 1; repeated uint64 unit_tags = 2; } diff --git a/s2clientprotocol/sc2api.proto b/s2clientprotocol/sc2api.proto index 4f45088..aa0aadb 100644 --- a/s2clientprotocol/sc2api.proto +++ b/s2clientprotocol/sc2api.proto @@ -1,5 +1,5 @@ -syntax = "proto2"; +syntax = "proto3"; package SC2APIProtocol; @@ -141,10 +141,11 @@ message Response { ResponseDebug debug = 20; } repeated string error = 98; // If command is missing, this will contain the error. Otherwise this will contain any warnings. - optional Status status = 99; // Should be sent back with all responses. + Status status = 99; // Should be sent back with all responses. } enum Status { + Status_UNSET = 0; launched = 1; // Game has been launch and is not yet doing anything. init_game = 2; // Create game has been called, and the host is awaiting players. in_game = 3; // In a single or multiplayer game. @@ -165,22 +166,23 @@ message RequestCreateGame { repeated PlayerSetup player_setup = 3; - optional bool disable_fog = 4; + bool disable_fog = 4; - optional uint32 random_seed = 5; // Sets the pseudo-random seed for the game. - optional bool realtime = 6; // If set, the game plays in real time. + uint32 random_seed = 5; // Sets the pseudo-random seed for the game. + bool realtime = 6; // If set, the game plays in real time. } message LocalMap { // A map can be specified either by a file path or the data of the .SC2Map file. // If you provide both, it will play the game using map_data and store map_path // into the replay. (260 character max) - optional string map_path = 1; - optional bytes map_data = 7; + string map_path = 1; + bytes map_data = 7; } message ResponseCreateGame { enum Error { + Error_UNSET = 0; MissingMap = 1; InvalidMapPath = 2; InvalidMapData = 3; @@ -190,8 +192,8 @@ message ResponseCreateGame { InvalidPlayerSetup = 7; MultiplayerUnsupported = 8; // Multiplayer is not supported in the current build. } - optional Error error = 1; - optional string error_details = 2; + Error error = 1; + string error_details = 2; } //----------------------------------------------------------------------------- @@ -203,22 +205,23 @@ message RequestJoinGame { uint32 observed_player_id = 2; // Join as observer } - optional InterfaceOptions options = 3; // This is limited to what is specified in RequestCreateGame, but you can request less information if you want. - optional PortSet server_ports = 4; // Do not set in the single-player case. This is the port a server will use. + InterfaceOptions options = 3; // This is limited to what is specified in RequestCreateGame, but you can request less information if you want. + PortSet server_ports = 4; // Do not set in the single-player case. This is the port a server will use. repeated PortSet client_ports = 5; // Do not set in the single-player case. These are the ports clients will use to initialize communication. // Currently only a singe client is supported. - optional int32 shared_port = 6; + int32 shared_port = 6; } message PortSet { - optional int32 game_port = 1; // Game right now needs two internal ports to establish a multiplay game on the local host. - optional int32 base_port = 2; + int32 game_port = 1; // Game right now needs two internal ports to establish a multiplay game on the local host. + int32 base_port = 2; } message ResponseJoinGame { - optional uint32 player_id = 1; + uint32 player_id = 1; enum Error { + Error_UNSET = 0; MissingParticipation = 1; InvalidObservedPlayerId = 2; MissingOptions = 3; @@ -235,8 +238,8 @@ message ResponseJoinGame { NetworkError = 12; OtherError = 13; } - optional Error error = 2; - optional string error_details = 3; + Error error = 2; + string error_details = 3; } //----------------------------------------------------------------------------- @@ -245,10 +248,11 @@ message RequestRestartGame { message ResponseRestartGame { enum Error { + Error_UNSET = 0; LaunchError = 1; } - optional Error error = 1; - optional string error_details = 2; + Error error = 1; + string error_details = 2; } //----------------------------------------------------------------------------- @@ -257,15 +261,16 @@ message RequestStartReplay { string replay_path = 1; bytes replay_data = 5; } - optional bytes map_data = 6; // Overrides the map path stored in the replay. - optional int32 observed_player_id = 2; - optional InterfaceOptions options = 3; + bytes map_data = 6; // Overrides the map path stored in the replay. + int32 observed_player_id = 2; + InterfaceOptions options = 3; - optional bool disable_fog = 4; + bool disable_fog = 4; } message ResponseStartReplay { enum Error { + Error_UNSET = 0; MissingReplay = 1; InvalidReplayPath = 2; InvalidReplayData = 3; @@ -274,8 +279,8 @@ message ResponseStartReplay { MissingOptions = 6; LaunchError = 7; } - optional Error error = 1; - optional string error_details = 2; + Error error = 1; + string error_details = 2; } //----------------------------------------------------------------------------- @@ -313,30 +318,30 @@ message RequestGameInfo { } message ResponseGameInfo { - optional string map_name = 1; + string map_name = 1; repeated string mod_names = 6; - optional string local_map_path = 2; + string local_map_path = 2; repeated PlayerInfo player_info = 3; - optional StartRaw start_raw = 4; // Populated if Raw interface is enabled. - optional InterfaceOptions options = 5; + StartRaw start_raw = 4; // Populated if Raw interface is enabled. + InterfaceOptions options = 5; } //----------------------------------------------------------------------------- message RequestObservation { - optional bool disable_fog = 1; + bool disable_fog = 1; } message ResponseObservation { repeated Action actions = 1; // Actions this player did since the last Observation. repeated ActionError action_errors = 2; // Equivalent of UI "red text" errors. - optional Observation observation = 3; + Observation observation = 3; repeated PlayerResult player_result = 4; // Only populated if the game ended during this step. repeated ChatReceived chat = 5; } message ChatReceived { - optional int32 player_id = 1; - optional string message = 2; + int32 player_id = 1; + string message = 2; } //----------------------------------------------------------------------------- @@ -350,7 +355,7 @@ message ResponseAction { //----------------------------------------------------------------------------- message RequestStep { - optional uint32 count = 1; // Number of game loops to simulate for the next frame. + uint32 count = 1; // Number of game loops to simulate for the next frame. } message ResponseStep { @@ -358,10 +363,10 @@ message ResponseStep { //----------------------------------------------------------------------------- message RequestData { - optional bool ability_id = 1; - optional bool unit_type_id = 2; - optional bool upgrade_id = 3; - optional bool buff_id = 4; + bool ability_id = 1; + bool unit_type_id = 2; + bool upgrade_id = 3; + bool buff_id = 4; } message ResponseData { @@ -376,7 +381,7 @@ message RequestSaveReplay { } message ResponseSaveReplay { - optional bytes data = 1; + bytes data = 1; } //----------------------------------------------------------------------------- @@ -385,36 +390,37 @@ message RequestReplayInfo { string replay_path = 1; // Limitation: might fail if the replay file is currently loaded. bytes replay_data = 2; } - optional bool download_data = 3; // Ensure the data and binary are downloaded if this is an old version replay. + bool download_data = 3; // Ensure the data and binary are downloaded if this is an old version replay. } message PlayerInfoExtra { - optional PlayerInfo player_info = 1; - optional PlayerResult player_result = 2; - optional int32 player_mmr = 3; - optional int32 player_apm = 4; + PlayerInfo player_info = 1; + PlayerResult player_result = 2; + int32 player_mmr = 3; + int32 player_apm = 4; } message ResponseReplayInfo { - optional string map_name = 1; - optional string local_map_path = 2; + string map_name = 1; + string local_map_path = 2; repeated PlayerInfoExtra player_info = 3; - optional uint32 game_duration_loops = 4; - optional float game_duration_seconds = 5; - optional string game_version = 6; - optional string data_version = 11; - optional uint32 data_build = 7; - optional uint32 base_build = 8; + uint32 game_duration_loops = 4; + float game_duration_seconds = 5; + string game_version = 6; + string data_version = 11; + uint32 data_build = 7; + uint32 base_build = 8; enum Error { + Error_UNSET = 0; MissingReplay = 1; InvalidReplayPath = 2; InvalidReplayData = 3; ParsingError = 4; DownloadError = 5; } - optional Error error = 9; - optional string error_details = 10; + Error error = 9; + string error_details = 10; } //----------------------------------------------------------------------------- @@ -432,15 +438,16 @@ message ResponseAvailableMaps { //----------------------------------------------------------------------------- // Copies map data into the path specified. message RequestSaveMap { - optional string map_path = 1; // Path the game process will write to, relative to the temp directory. (260 character max) - optional bytes map_data = 2; // Binary map data of a .SC2Map. + string map_path = 1; // Path the game process will write to, relative to the temp directory. (260 character max) + bytes map_data = 2; // Binary map data of a .SC2Map. } message ResponseSaveMap { enum Error { + Error_UNSET = 0; InvalidMapData = 1; } - optional Error error = 1; + Error error = 1; } //----------------------------------------------------------------------------- @@ -448,10 +455,10 @@ message RequestPing { } message ResponsePing { - optional string game_version = 1; - optional string data_version = 2; - optional uint32 data_build = 3; - optional uint32 base_build = 4; + string game_version = 1; + string data_version = 2; + uint32 data_build = 3; + uint32 base_build = 4; } //----------------------------------------------------------------------------- @@ -468,6 +475,7 @@ message ResponseDebug { // enum Difficulty { + Difficulty_UNSET = 0; VeryEasy = 1; Easy = 2; Medium = 3; @@ -481,41 +489,42 @@ enum Difficulty { } enum PlayerType { + PlayerType_UNSET = 0; Participant = 1; Computer = 2; Observer = 3; } message PlayerSetup { - optional PlayerType type = 1; + PlayerType type = 1; // Only used for a computer player. - optional Race race = 2; - optional Difficulty difficulty = 3; + Race race = 2; + Difficulty difficulty = 3; } message SpatialCameraSetup { - optional float width = 1; - optional Size2DI resolution = 2; - optional Size2DI minimap_resolution = 3; + float width = 1; + Size2DI resolution = 2; + Size2DI minimap_resolution = 3; } message InterfaceOptions { // Interface options - optional bool raw = 1; - optional bool score = 2; - optional SpatialCameraSetup feature_layer = 3; // Omit to disable. - optional SpatialCameraSetup render = 4; // Not implemented. + bool raw = 1; + bool score = 2; + SpatialCameraSetup feature_layer = 3; // Omit to disable. + SpatialCameraSetup render = 4; // Not implemented. } message PlayerInfo { // Identifier that will be used to reference this player. // SC2 will always assign playerIds starting from 1 in standard Melee maps. This may not be true in custom maps. - optional uint32 player_id = 1; - optional PlayerType type = 2; - optional Race race_requested = 3; - optional Race race_actual = 4; // Only populated for your player or when watching replay - optional Difficulty difficulty = 5; + uint32 player_id = 1; + PlayerType type = 2; + Race race_requested = 3; + Race race_actual = 4; // Only populated for your player or when watching replay + Difficulty difficulty = 5; } @@ -524,61 +533,64 @@ message PlayerInfo { // message PlayerCommon { - optional uint32 player_id = 1; - optional uint32 minerals = 2; - optional uint32 vespene = 3; - optional uint32 food_cap = 4; - optional uint32 food_used = 5; - optional uint32 food_army = 6; - optional uint32 food_workers = 7; - optional uint32 idle_worker_count = 8; - optional uint32 army_count = 9; - optional uint32 warp_gate_count = 10; - optional uint32 larva_count = 11; + uint32 player_id = 1; + uint32 minerals = 2; + uint32 vespene = 3; + uint32 food_cap = 4; + uint32 food_used = 5; + uint32 food_army = 6; + uint32 food_workers = 7; + uint32 idle_worker_count = 8; + uint32 army_count = 9; + uint32 warp_gate_count = 10; + uint32 larva_count = 11; } message Observation { - optional uint32 game_loop = 9; - optional PlayerCommon player_common = 1; + uint32 game_loop = 9; + PlayerCommon player_common = 1; repeated Alert alerts = 10; repeated AvailableAbility abilities = 3; // Abilities available in the selection. Enabled if in this list, disabled otherwise. - optional Score score = 4; + Score score = 4; - optional ObservationRaw raw_data = 5; // Populated if Raw interface is enabled. - optional ObservationFeatureLayer feature_layer_data = 6; // Populated if Feature Layer interface is enabled. - optional ObservationRender render_data = 7; // Populated if Render interface is enabled. - optional ObservationUI ui_data = 8; // Populated if Feature Layer or Render interface is enabled. + ObservationRaw raw_data = 5; // Populated if Raw interface is enabled. + ObservationFeatureLayer feature_layer_data = 6; // Populated if Feature Layer interface is enabled. + ObservationRender render_data = 7; // Populated if Render interface is enabled. + ObservationUI ui_data = 8; // Populated if Feature Layer or Render interface is enabled. } message Action { - optional ActionRaw action_raw = 1; // Populated if Raw interface is enabled. - optional ActionSpatial action_feature_layer = 2; // Populated if Feature Layer interface is enabled. - optional ActionSpatial action_render = 3; // Not implemented. Populated if Render interface is enabled. - optional ActionUI action_ui = 4; // Populated if Feature Layer or Render interface is enabled. + ActionRaw action_raw = 1; // Populated if Raw interface is enabled. + ActionSpatial action_feature_layer = 2; // Populated if Feature Layer interface is enabled. + ActionSpatial action_render = 3; // Not implemented. Populated if Render interface is enabled. + ActionUI action_ui = 4; // Populated if Feature Layer or Render interface is enabled. repeated ActionChat chat = 5; // Chat messages as a player typing into the chat channel. } message ActionChat { enum Channel { + Channel_UNSET = 0; Broadcast = 1; Team = 2; } - optional Channel channel = 1; - optional string message = 2; + Channel channel = 1; + string message = 2; } message ActionError { - optional uint64 unit_tag = 1; // Only populated when using raw interface. - optional uint64 ability_id = 2; - optional ActionResult result = 3; + uint64 unit_tag = 1; // Only populated when using raw interface. + uint64 ability_id = 2; + ActionResult result = 3; } enum Alert { + Alert_UNSET = 0; NuclearLaunchDetected = 1; NydusWormDetected = 2; } enum Result { + Result_UNSET = 0; Victory = 1; Defeat = 2; Tie = 3; @@ -586,6 +598,6 @@ enum Result { } message PlayerResult { - optional uint32 player_id = 1; - optional Result result = 2; + uint32 player_id = 1; + Result result = 2; } diff --git a/s2clientprotocol/score.proto b/s2clientprotocol/score.proto index 42c3016..00272cf 100644 --- a/s2clientprotocol/score.proto +++ b/s2clientprotocol/score.proto @@ -1,73 +1,74 @@ -syntax = "proto2"; +syntax = "proto3"; package SC2APIProtocol; message Score { enum ScoreType { + ScoreType_UNSET = 0; Curriculum = 1; // map generated score (from curriculum maps with special scoring) Melee = 2; // summation of in-progress and current units/buildings value + minerals + vespene } - optional ScoreType score_type = 6; - optional int32 score = 7; // Note: check score_type to know whether this is a melee score or curriculum score - optional ScoreDetails score_details = 8; + ScoreType score_type = 6; + int32 score = 7; // Note: check score_type to know whether this is a melee score or curriculum score + ScoreDetails score_details = 8; } message CategoryScoreDetails { - optional float none = 1; // Used when no other category is configured in game data - optional float army = 2; - optional float economy = 3; - optional float technology = 4; - optional float upgrade = 5; + float none = 1; // Used when no other category is configured in game data + float army = 2; + float economy = 3; + float technology = 4; + float upgrade = 5; } message VitalScoreDetails { - optional float life = 1; - optional float shields = 2; - optional float energy = 3; + float life = 1; + float shields = 2; + float energy = 3; } message ScoreDetails { - optional float idle_production_time = 1; // Interesting as a delta - optional float idle_worker_time = 2; // Interesting as a delta + float idle_production_time = 1; // Interesting as a delta + float idle_worker_time = 2; // Interesting as a delta // Note the "total_value" fields are a combination of minerals, vespene and a human designer guess. Maybe useful as a delta. - optional float total_value_units = 3; - optional float total_value_structures = 4; + float total_value_units = 3; + float total_value_structures = 4; // Note the "killed_value" fields are a combination of minerals, vespene and a human designer guess. Maybe useful as a delta. // The weighting of the combination and the human designer guess is different (not symmetric) with the "total_value" fields! - optional float killed_value_units = 5; - optional float killed_value_structures = 6; + float killed_value_units = 5; + float killed_value_structures = 6; - optional float collected_minerals = 7; - optional float collected_vespene = 8; + float collected_minerals = 7; + float collected_vespene = 8; - optional float collection_rate_minerals = 9; - optional float collection_rate_vespene = 10; + float collection_rate_minerals = 9; + float collection_rate_vespene = 10; - optional float spent_minerals = 11; - optional float spent_vespene = 12; + float spent_minerals = 11; + float spent_vespene = 12; - optional CategoryScoreDetails food_used = 13; + CategoryScoreDetails food_used = 13; - optional CategoryScoreDetails killed_minerals = 14; - optional CategoryScoreDetails killed_vespene = 15; + CategoryScoreDetails killed_minerals = 14; + CategoryScoreDetails killed_vespene = 15; - optional CategoryScoreDetails lost_minerals = 16; - optional CategoryScoreDetails lost_vespene = 17; + CategoryScoreDetails lost_minerals = 16; + CategoryScoreDetails lost_vespene = 17; - optional CategoryScoreDetails friendly_fire_minerals = 18; - optional CategoryScoreDetails friendly_fire_vespene = 19; + CategoryScoreDetails friendly_fire_minerals = 18; + CategoryScoreDetails friendly_fire_vespene = 19; - optional CategoryScoreDetails used_minerals = 20; - optional CategoryScoreDetails used_vespene = 21; + CategoryScoreDetails used_minerals = 20; + CategoryScoreDetails used_vespene = 21; - optional CategoryScoreDetails total_used_minerals = 22; // Interesting as a delta - optional CategoryScoreDetails total_used_vespene = 23; // Interesting as a delta + CategoryScoreDetails total_used_minerals = 22; // Interesting as a delta + CategoryScoreDetails total_used_vespene = 23; // Interesting as a delta - optional VitalScoreDetails total_damage_dealt = 24; // Interesting as a delta - optional VitalScoreDetails total_damage_taken = 25; // Interesting as a delta - optional VitalScoreDetails total_healed = 26; // Interesting as a delta + VitalScoreDetails total_damage_dealt = 24; // Interesting as a delta + VitalScoreDetails total_damage_taken = 25; // Interesting as a delta + VitalScoreDetails total_healed = 26; // Interesting as a delta } diff --git a/s2clientprotocol/spatial.proto b/s2clientprotocol/spatial.proto index 806a520..4fb80a8 100644 --- a/s2clientprotocol/spatial.proto +++ b/s2clientprotocol/spatial.proto @@ -1,5 +1,5 @@ -syntax = "proto2"; +syntax = "proto3"; package SC2APIProtocol; @@ -10,38 +10,38 @@ import "s2clientprotocol/common.proto"; // message ObservationFeatureLayer { - optional FeatureLayers renders = 1; - optional FeatureLayersMinimap minimap_renders = 2; + FeatureLayers renders = 1; + FeatureLayersMinimap minimap_renders = 2; } message FeatureLayers { - optional ImageData height_map = 1; // uint8. Terrain height. World space units of [-200, 200] encoded into [0, 255]. - optional ImageData visibility_map = 2; // uint8. 0=Hidden, 1=Fogged, 2=Visible, 3=FullHidden - optional ImageData creep = 3; // 1-bit. Zerg creep. - optional ImageData power = 4; // 1-bit. Protoss power. - optional ImageData player_id = 5; // uint8. Participants: [1, 15] Neutral: 16 - optional ImageData unit_type = 6; // int32. Unique identifier for type of unit. - optional ImageData selected = 7; // 1-bit. Selected units. - optional ImageData unit_hit_points = 8; // int32. - optional ImageData unit_hit_points_ratio = 17; // uint8. Ratio of current health to max health. [0%, 100%] encoded into [0, 255]. - optional ImageData unit_energy = 9; // int32. - optional ImageData unit_shields = 10; // int32. - optional ImageData player_relative = 11; // uint8. See "Alliance" enum in raw.proto. Range: [1, 4] - optional ImageData unit_density_aa = 14; // uint8. Density of units overlapping a pixel, anti-aliased. [0.0, 16.0f] encoded into [0, 255]. - optional ImageData unit_density = 15; // uint8. Count of units overlapping a pixel. + ImageData height_map = 1; // uint8. Terrain height. World space units of [-200, 200] encoded into [0, 255]. + ImageData visibility_map = 2; // uint8. 0=Hidden, 1=Fogged, 2=Visible, 3=FullHidden + ImageData creep = 3; // 1-bit. Zerg creep. + ImageData power = 4; // 1-bit. Protoss power. + ImageData player_id = 5; // uint8. Participants: [1, 15] Neutral: 16 + ImageData unit_type = 6; // int32. Unique identifier for type of unit. + ImageData selected = 7; // 1-bit. Selected units. + ImageData unit_hit_points = 8; // int32. + ImageData unit_hit_points_ratio = 17; // uint8. Ratio of current health to max health. [0%, 100%] encoded into [0, 255]. + ImageData unit_energy = 9; // int32. + ImageData unit_shields = 10; // int32. + ImageData player_relative = 11; // uint8. See "Alliance" enum in raw.proto. Range: [1, 4] + ImageData unit_density_aa = 14; // uint8. Density of units overlapping a pixel, anti-aliased. [0.0, 16.0f] encoded into [0, 255]. + ImageData unit_density = 15; // uint8. Count of units overlapping a pixel. } message FeatureLayersMinimap { - optional ImageData height_map = 1; // uint8. Terrain height. World space units of [-200, 200] encoded into [0, 255]. - optional ImageData visibility_map = 2; // uint8. 0=Hidden, 1=Fogged, 2=Visible, 3=FullHidden - optional ImageData creep = 3; // 1-bit. Zerg creep. - optional ImageData camera = 4; // 1-bit. Area covered by the camera. - optional ImageData player_id = 5; // uint8. Participants: [1, 15] Neutral: 16 - optional ImageData player_relative = 6; // uint8. See "Alliance" enum in raw.proto. Range: [1, 4] - optional ImageData selected = 7; // 1-bit. Selected units. + ImageData height_map = 1; // uint8. Terrain height. World space units of [-200, 200] encoded into [0, 255]. + ImageData visibility_map = 2; // uint8. 0=Hidden, 1=Fogged, 2=Visible, 3=FullHidden + ImageData creep = 3; // 1-bit. Zerg creep. + ImageData camera = 4; // 1-bit. Area covered by the camera. + ImageData player_id = 5; // uint8. Participants: [1, 15] Neutral: 16 + ImageData player_relative = 6; // uint8. See "Alliance" enum in raw.proto. Range: [1, 4] + ImageData selected = 7; // 1-bit. Selected units. // Cheat layers. Only populated in replays. - optional ImageData unit_type = 8; // int32. Unique identifier for type of unit. + ImageData unit_type = 8; // int32. Unique identifier for type of unit. } @@ -50,8 +50,8 @@ message FeatureLayersMinimap { // message ObservationRender { - optional ImageData map = 1; - optional ImageData minimap = 2; + ImageData map = 1; + ImageData minimap = 2; } @@ -69,31 +69,32 @@ message ActionSpatial { } message ActionSpatialUnitCommand { - optional int32 ability_id = 1; + int32 ability_id = 1; oneof target { PointI target_screen_coord = 2; PointI target_minimap_coord = 3; } - optional bool queue_command = 4; // Equivalent to shift+command. + bool queue_command = 4; // Equivalent to shift+command. } message ActionSpatialCameraMove { - optional PointI center_minimap = 1; // Simulates a click on the minimap to move the camera. + PointI center_minimap = 1; // Simulates a click on the minimap to move the camera. } message ActionSpatialUnitSelectionPoint { - optional PointI selection_screen_coord = 1; + PointI selection_screen_coord = 1; enum Type { + Type_UNSET = 0; Select = 1; // Equivalent to normal click. Changes selection to unit. Toggle = 2; // Equivalent to shift+click. Toggle selection of unit. AllType = 3; // Equivalent to control+click. Selects all units of a given type. AddAllType = 4; // Equivalent to shift+control+click. Selects all units of a given type. } - optional Type type = 2; + Type type = 2; } message ActionSpatialUnitSelectionRect { repeated RectangleI selection_screen_coord = 1; // Eventually this should not be an array, but a single field (multiple would be cheating). - optional bool selection_add = 2; // Equivalent to shift+drag. Adds units to selection. + bool selection_add = 2; // Equivalent to shift+drag. Adds units to selection. } diff --git a/s2clientprotocol/ui.proto b/s2clientprotocol/ui.proto index 28212e7..df70610 100644 --- a/s2clientprotocol/ui.proto +++ b/s2clientprotocol/ui.proto @@ -1,5 +1,5 @@ -syntax = "proto2"; +syntax = "proto3"; package SC2APIProtocol; @@ -18,24 +18,24 @@ message ObservationUI { } message ControlGroup { - optional uint32 control_group_index = 1; - optional uint32 leader_unit_type = 2; - optional uint32 count = 3; + uint32 control_group_index = 1; + uint32 leader_unit_type = 2; + uint32 count = 3; } message UnitInfo { - optional uint32 unit_type = 1; - optional uint32 player_relative = 2; - optional int32 health = 3; - optional int32 shields = 4; - optional int32 energy = 5; - optional int32 transport_slots_taken = 6; - optional float build_progress = 7; // Range: [0.0, 1.0] - optional UnitInfo add_on = 8; + uint32 unit_type = 1; + uint32 player_relative = 2; + int32 health = 3; + int32 shields = 4; + int32 energy = 5; + int32 transport_slots_taken = 6; + float build_progress = 7; // Range: [0.0, 1.0] + UnitInfo add_on = 8; } message SinglePanel { - optional UnitInfo unit = 1; + UnitInfo unit = 1; // Upgrades? // Buffs? } @@ -45,13 +45,13 @@ message MultiPanel { } message CargoPanel { - optional UnitInfo unit = 1; + UnitInfo unit = 1; repeated UnitInfo passengers = 2; - optional int32 slots_available = 3; // TODO: Change to cargo size + int32 slots_available = 3; // TODO: Change to cargo size } message ProductionPanel { - optional UnitInfo unit = 1; + UnitInfo unit = 1; repeated UnitInfo build_queue = 2; } @@ -76,22 +76,23 @@ message ActionUI { message ActionControlGroup { enum ControlGroupAction { + ControlGroupAction_UNSET = 0; Recall = 1; // Equivalent to number hotkey. Replaces current selection with control group. Set = 2; // Equivalent to Control + number hotkey. Sets control group to current selection. Append = 3; // Equivalent to Shift + number hotkey. Adds current selection into control group. SetAndSteal = 4; // Equivalent to Control + Alt + number hotkey. Sets control group to current selection. Units are removed from other control groups. AppendAndSteal = 5; // Equivalent to Shift + Alt + number hotkey. Adds current selection into control group. Units are removed from other control groups. } - optional ControlGroupAction action = 1; - optional uint32 control_group_index = 2; + ControlGroupAction action = 1; + uint32 control_group_index = 2; } message ActionSelectArmy { - optional bool selection_add = 1; + bool selection_add = 1; } message ActionSelectWarpGates { - optional bool selection_add = 1; + bool selection_add = 1; } message ActionSelectLarva { @@ -99,33 +100,35 @@ message ActionSelectLarva { message ActionSelectIdleWorker { enum Type { + Type_UNSET = 0; Set = 1; // Equivalent to click with no modifiers. Replaces selection with single idle worker. Add = 2; // Equivalent to shift+click. Adds single idle worker to current selection. All = 3; // Equivalent to control+click. Selects all idle workers. AddAll = 4; // Equivalent to shift+control+click. Adds all idle workers to current selection. } - optional Type type = 1; + Type type = 1; } message ActionMultiPanel { enum Type { + Type_UNSET = 0; SingleSelect = 1; // Click on icon DeselectUnit = 2; // Shift Click on icon SelectAllOfType = 3; // Control Click on icon. DeselectAllOfType = 4; // Control+Shift Click on icon. } - optional Type type = 1; - optional int32 unit_index = 2; + Type type = 1; + int32 unit_index = 2; } message ActionCargoPanelUnload { - optional int32 unit_index = 1; + int32 unit_index = 1; } message ActionProductionPanelRemoveFromQueue { - optional int32 unit_index = 1; + int32 unit_index = 1; } message ActionToggleAutocast { - optional int32 ability_id = 1; + int32 ability_id = 1; }