From f9313faf7fea2a7a990527d03511dbd5044af532 Mon Sep 17 00:00:00 2001 From: "BLIZZARD\\kcalderone" Date: Tue, 14 Nov 2017 12:50:05 -0800 Subject: [PATCH] Updating protocol for new 4.0 features. --- s2clientprotocol/data.proto | 1 + s2clientprotocol/debug.proto | 5 +--- s2clientprotocol/sc2api.proto | 54 +++++++++++++++++++++++++++++++---- 3 files changed, 51 insertions(+), 9 deletions(-) diff --git a/s2clientprotocol/data.proto b/s2clientprotocol/data.proto index cc5f7f8..1ac5e56 100644 --- a/s2clientprotocol/data.proto +++ b/s2clientprotocol/data.proto @@ -83,6 +83,7 @@ message UnitTypeData { optional float build_time = 17; optional bool has_vespene = 19; optional bool has_minerals = 20; + optional float sight_range = 25; // Range unit reveals vision. repeated uint32 tech_alias = 21; // Other units that satisfy the same tech requirement. optional uint32 unit_alias = 22; // The morphed variant of this unit. diff --git a/s2clientprotocol/debug.proto b/s2clientprotocol/debug.proto index adea28a..60ae90a 100644 --- a/s2clientprotocol/debug.proto +++ b/s2clientprotocol/debug.proto @@ -16,7 +16,6 @@ message DebugCommand { DebugSetScore score = 6; // Useful only for single-player "curriculum" maps. DebugEndGame end_game = 7; DebugSetUnitValue unit_value = 8; - DebugChat chat = 9; // TODO. } } @@ -44,6 +43,7 @@ message DebugText { 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. + optional uint32 size = 5; // Pixel height of the text. Defaults to 8px. } // Display debug lines on screen. @@ -125,6 +125,3 @@ message DebugSetUnitValue { optional uint64 unit_tag = 3; } -message DebugChat { - optional string message = 1; -} diff --git a/s2clientprotocol/sc2api.proto b/s2clientprotocol/sc2api.proto index 27f479e..4679802 100644 --- a/s2clientprotocol/sc2api.proto +++ b/s2clientprotocol/sc2api.proto @@ -42,6 +42,7 @@ import "s2clientprotocol/ui.proto"; // leave_game | in_game (required when finishing multiplayer) | launched | // quick_save | in_game | | // quick_load | in_game | | +// | ended | | // quit | any | quit (not sent) | // game_info | in_game | | // | in_replay | | @@ -52,6 +53,8 @@ import "s2clientprotocol/ui.proto"; // step* | in_game (not available in realtime mode) | in_game | // | in_replay | ended | // action | in_game (not available to observers) | | +// obs_action | in_game (only for observers) | | +// | in_replay | | // data | in_game | | // | in_replay | | // | ended | | @@ -86,15 +89,16 @@ message Request { RequestStartReplay start_replay = 4; // Start playing a replay. RequestLeaveGame leave_game = 5; // Multiplayer only. Disconnects from a multiplayer game, equivalent to surrender. - RequestQuickSave quick_save = 6; // Not implemented. Saves game to an in-memory bookmark. - RequestQuickLoad quick_load = 7; // Not implemented. Loads from an in-memory bookmark. + RequestQuickSave quick_save = 6; // Saves game to an in-memory bookmark. + RequestQuickLoad quick_load = 7; // Loads from an in-memory bookmark. RequestQuit quit = 8; // Terminates the application. // During Game RequestGameInfo game_info = 9; // Static data about the current game and map. RequestObservation observation = 10; // Snapshot of the current game state. - RequestAction action = 11; // Executes an action. + RequestAction action = 11; // Executes an action for a participant. + RequestObserverAction obs_action = 21; // Executes an action for an observer. RequestStep step = 12; // Advances the game simulation. RequestData data = 13; // Data about different gameplay elements. May be different for different games. RequestQuery query = 14; // Additional methods for inspecting game state. @@ -127,6 +131,7 @@ message Response { ResponseGameInfo game_info = 9; ResponseObservation observation = 10; ResponseAction action = 11; + ResponseObserverAction obs_action = 21; ResponseStep step = 12; ResponseData data = 13; ResponseQuery query = 14; @@ -262,6 +267,7 @@ message RequestStartReplay { optional InterfaceOptions options = 3; optional bool disable_fog = 4; + optional bool realtime = 7; } message ResponseStartReplay { @@ -335,7 +341,7 @@ message ResponseObservation { } message ChatReceived { - optional int32 player_id = 1; + optional uint32 player_id = 1; optional string message = 2; } @@ -348,6 +354,15 @@ message ResponseAction { repeated ActionResult result = 1; } +//----------------------------------------------------------------------------- +message RequestObserverAction { + repeated ObserverAction actions = 1; +} + +message ResponseObserverAction { + +} + //----------------------------------------------------------------------------- message RequestStep { optional uint32 count = 1; // Number of game loops to simulate for the next frame. @@ -557,7 +572,7 @@ message Action { 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. - repeated ActionChat chat = 5; // Chat messages as a player typing into the chat channel. + optional ActionChat action_chat = 6; // Chat messages as a player typing into the chat channel. } message ActionChat { @@ -575,6 +590,35 @@ message ActionError { optional ActionResult result = 3; } +message ObserverAction { + oneof action { + ActionObserverPlayerPerspective player_perspective = 1; // Not implemented + ActionObserverCameraMove camera_move = 2; + ActionObserverCameraFollowPlayer camera_follow_player = 3; + ActionObserverCameraFollowUnits camera_follow_units = 4; // Not implemented + } +} + +message ActionObserverPlayerPerspective { + optional uint32 player_id = 1; // 0 to observe "Everyone" +} + +message ActionObserverCameraMove { + optional Point2D world_pos = 1; + + // Distance between camera and terrain. Larger value zooms out camera. + // Defaults to standard camera distance if set to 0. + optional float distance = 2; +} + +message ActionObserverCameraFollowPlayer { + optional uint32 player_id = 1; // Not implemented. Value must be [1, 15] +} + +message ActionObserverCameraFollowUnits { + repeated uint64 unit_tags = 1; +} + enum Alert { NuclearLaunchDetected = 1; NydusWormDetected = 2;