aboutsummaryrefslogtreecommitdiff
path: root/proto/client_api.proto
blob: 07164e54dd94e8e00e2a915ee015163b7a2db149 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
syntax = "proto3";

package grpc.planetwars.client_api;

// Provides the planetwars client API, allowing for remote play.
service ClientApiService {
  rpc CreateMatch(CreateMatchRequest) returns (CreateMatchResponse);
  rpc ConnectPlayer(stream PlayerApiClientMessage) returns (stream PlayerApiServerMessage);
}

message CreateMatchRequest {
  string opponent_name = 1;
  string map_name = 2;
}

message CreateMatchResponse {
  int32 match_id = 1;
  string player_key = 2;
  string match_url = 3;
}


// Server messages
message PlayerApiServerMessage {
  oneof server_message {
    PlayerActionRequest action_request = 1;
  }
}

message PlayerActionRequest {
  int32 action_request_id = 1;
  bytes content = 2;
}


// Player messages
message PlayerApiClientMessage {
  oneof client_message {
    PlayerAction action = 1;
  }
}

message PlayerAction {
  int32 action_request_id = 1;
  bytes content = 2;
}