Skip to content

Commit

Permalink
Merge pull request #70 from KevinCalderone/master
Browse files Browse the repository at this point in the history
Updating protocol for new 4.0 features.
  • Loading branch information
Kevin Calderone committed Nov 14, 2017
2 parents 023734c + f9313fa commit 33f0ecf
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 9 deletions.
1 change: 1 addition & 0 deletions s2clientprotocol/data.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 1 addition & 4 deletions s2clientprotocol/debug.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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.
}
}

Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -125,6 +125,3 @@ message DebugSetUnitValue {
optional uint64 unit_tag = 3;
}

message DebugChat {
optional string message = 1;
}
54 changes: 49 additions & 5 deletions s2clientprotocol/sc2api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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 | |
Expand All @@ -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 | |
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -262,6 +267,7 @@ message RequestStartReplay {
optional InterfaceOptions options = 3;

optional bool disable_fog = 4;
optional bool realtime = 7;
}

message ResponseStartReplay {
Expand Down Expand Up @@ -335,7 +341,7 @@ message ResponseObservation {
}

message ChatReceived {
optional int32 player_id = 1;
optional uint32 player_id = 1;
optional string message = 2;
}

Expand All @@ -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.
Expand Down Expand Up @@ -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 {
Expand All @@ -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;
Expand Down

0 comments on commit 33f0ecf

Please sign in to comment.