Skip to content

Commit

Permalink
Merge pull request #14 from CLSFramework/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
naderzare authored Sep 16, 2024
2 parents 5411e12 + 1b34152 commit c3c9a22
Show file tree
Hide file tree
Showing 33 changed files with 21,251 additions and 12,573 deletions.
18 changes: 18 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# ChangeLog

## [1.0.0] - 2024-09-15

### Added
- added rpc_version to the RegisterRequest message.
- added rpc_server_language_type to the RegisterResponse message.
- added server side planner decision maker.

### Fixed
- fixed bugs in the getActions functions in thrift and grpc.

### Changed
- changed chain_action messages name to planner

### Engineers
- [NaderZare](https://github.com/naderzare)
- [SadraKhanjari](https://github.com/SK2iP)


## [0.1.4] - 2024-09-03

### Added
Expand Down
88 changes: 86 additions & 2 deletions idl/grpc/service.proto
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// version 1

syntax = "proto3";

package protos;
Expand All @@ -19,13 +21,26 @@ message RegisterRequest {
AgentType agent_type = 1;
string team_name = 2;
int32 uniform_number = 3;
int32 rpc_version = 4;
}

enum RpcServerLanguageType {
UNKNOWN_LANGUAGE = 0;
PYThON = 1;
JAVA = 2;
CPP = 3;
CSHARP = 4;
RUBY = 5;
JAVE_SCRIPT = 6;
GO = 7;
}

message RegisterResponse {
int32 client_id = 1;
AgentType agent_type = 2;
string team_name = 3;
int32 uniform_number = 4;
RpcServerLanguageType rpc_server_language_type = 5;
}

message Ball {
Expand Down Expand Up @@ -81,6 +96,12 @@ enum LoggerLevel{
// LEVEL_ANY = 0xffffffff;
}

enum CardType {
NO_CARD = 0;
YELLOW = 1;
RED = 2;
}

message Player {
RpcVector2D position = 1;
RpcVector2D seen_position = 2;
Expand Down Expand Up @@ -151,6 +172,9 @@ message Self {
ViewWidth view_width = 34;
int32 type_id = 35;
float kick_rate = 36;
float recovery = 37;
float stamina_capacity = 38;
CardType card = 39;
}

enum InterceptActionType {
Expand Down Expand Up @@ -254,6 +278,10 @@ message WorldModel {
int32 their_team_score = 29;
bool is_penalty_kick_mode = 30;
map<int32, RpcVector2D> helios_home_positions = 31;
double our_defense_line_x = 32;
double their_defense_line_x = 33;
double our_defense_player_line_x = 34;
double their_defense_player_line_x = 35;
}

message State {
Expand Down Expand Up @@ -748,7 +776,7 @@ message HeliosGoalieKick {}

message HeliosShoot {}

message HeliosChainAction {
message HeliosOffensivePlanner {
bool direct_pass = 1;
bool lead_pass = 2;
bool through_pass = 3;
Expand All @@ -758,6 +786,7 @@ message HeliosChainAction {
bool simple_pass = 7;
bool simple_dribble = 8;
bool simple_shoot = 9;
bool server_side_decision = 10;
}

message HeliosBasicOffensive {}
Expand Down Expand Up @@ -830,12 +859,13 @@ message PlayerAction {
HeliosGoalieMove helios_goalie_move = 56;
HeliosGoalieKick helios_goalie_kick = 57;
HeliosShoot helios_shoot = 58;
HeliosChainAction helios_chain_action = 59;
HeliosOffensivePlanner helios_offensive_planner = 59;
HeliosBasicOffensive helios_basic_offensive = 60;
HeliosBasicMove helios_basic_move = 61;
HeliosSetPlay helios_set_play = 62;
HeliosPenalty helios_penalty = 63;
HeliosCommunicaion helios_communication = 64;

}
}

Expand Down Expand Up @@ -1202,6 +1232,59 @@ message PlayerType {
float player_speed_max = 34;
}

enum RpcActionCategory {
AC_Hold = 0;
AC_Dribble = 1;
AC_Pass = 2;
AC_Shoot = 3;
AC_Clear = 4;
AC_Move = 5;
AC_NoAction = 6;
}
message RpcCooperativeAction {
RpcActionCategory category = 1;
int32 index = 2;
int32 sender_unum = 3;
int32 target_unum = 4;
RpcVector2D target_point = 5;
double first_ball_speed = 6;
double first_turn_moment = 7;
double first_dash_power = 8;
double first_dash_angle_relative = 9;
int32 duration_step = 10;
int32 kick_count = 11;
int32 turn_count = 12;
int32 dash_count = 13;
bool final_action = 14;
string description = 15;
int32 parent_index = 16;
}

message RpcPredictState {
int32 spend_time = 1;
int32 ball_holder_unum = 2;
RpcVector2D ball_position = 3;
RpcVector2D ball_velocity = 4;
double our_defense_line_x = 5;
double our_offense_line_x = 6;
}

message RpcActionState {
RpcCooperativeAction action = 1;
RpcPredictState predict_state = 2;
double evaluation = 3;
}

message BestPlannerActionRequest {
RegisterResponse register_response = 1;
map<int32, RpcActionState> pairs = 2;
State state = 3;
}

message BestPlannerActionResponse {
int32 index = 1;
}

message Empty {
}

Expand All @@ -1215,4 +1298,5 @@ service Game {
rpc SendPlayerType(PlayerType) returns (Empty) {} //should be PlayerTypes
rpc Register(RegisterRequest) returns (RegisterResponse) {}
rpc SendByeCommand(RegisterResponse) returns (Empty) {}
rpc GetBestPlannerAction(BestPlannerActionRequest) returns (BestPlannerActionResponse) {}
}
98 changes: 91 additions & 7 deletions idl/thrift/soccer_service.thrift
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// version 1

namespace cpp soccer
namespace py soccer

Expand All @@ -23,14 +25,27 @@ struct RpcVector2D {
struct RegisterRequest {
1: AgentType agent_type,
2: string team_name,
3: i32 uniform_number
3: i32 uniform_number,
4: i32 rpc_version
}

enum RpcServerLanguageType {
UNKNOWN_LANGUAGE = 0;
PYThON = 1;
JAVA = 2;
CPP = 3;
CSHARP = 4;
RUBY = 5;
JAVE_SCRIPT = 6;
GO = 7;
}

struct RegisterResponse {
1: i32 client_id
2: AgentType agent_type,
3: string team_name,
4: i32 uniform_number
4: i32 uniform_number,
5: RpcServerLanguageType rpc_server_language_type
}

struct Ball {
Expand Down Expand Up @@ -84,6 +99,12 @@ enum LoggerLevel {
PLAN = 1048576
}

enum CardType {
NO_CARD = 0,
YELLOW = 1,
RED = 2
}

struct Player {
1: RpcVector2D position,
2: RpcVector2D seen_position,
Expand Down Expand Up @@ -153,7 +174,10 @@ struct Self {
33: double foul_probability,
34: ViewWidth view_width,
35: i32 type_id,
36: double kick_rate
36: double kick_rate,
37: double recovery,
38: double stamina_capacity,
39: CardType card
}

enum InterceptActionType {
Expand Down Expand Up @@ -256,7 +280,11 @@ struct WorldModel {
28: i32 our_team_score,
29: i32 their_team_score,
30: bool is_penalty_kick_mode,
31: map<i32, RpcVector2D> helios_home_positions
31: map<i32, RpcVector2D> helios_home_positions,
32: double our_defense_line_x,
33: double their_defense_line_x,
34: double our_defense_player_line_x,
35: double their_defense_player_line_x
}

struct State {
Expand Down Expand Up @@ -714,7 +742,7 @@ struct HeliosGoalieKick {}

struct HeliosShoot {}

struct HeliosChainAction {
struct HeliosOffensivePlanner {
1: bool direct_pass,
2: bool lead_pass,
3: bool through_pass,
Expand All @@ -724,6 +752,7 @@ struct HeliosChainAction {
7: bool simple_pass,
8: bool simple_dribble,
9: bool simple_shoot
10: bool server_side_decision
}

struct HeliosBasicOffensive {}
Expand Down Expand Up @@ -795,7 +824,7 @@ struct PlayerAction {
56: optional HeliosGoalieMove helios_goalie_move,
57: optional HeliosGoalieKick helios_goalie_kick,
58: optional HeliosShoot helios_shoot,
59: optional HeliosChainAction helios_chain_action,
59: optional HeliosOffensivePlanner helios_offensive_planner,
60: optional HeliosBasicOffensive helios_basic_offensive,
61: optional HeliosBasicMove helios_basic_move,
62: optional HeliosSetPlay helios_set_play,
Expand Down Expand Up @@ -1162,6 +1191,60 @@ struct PlayerType {
34: double player_speed_max,
}

enum RpcActionCategory {
AC_Hold = 0;
AC_Dribble = 1;
AC_Pass = 2;
AC_Shoot = 3;
AC_Clear = 4;
AC_Move = 5;
AC_NoAction = 6;
}

struct RpcCooperativeAction {
1: RpcActionCategory category;
2: i32 index;
3: i32 sender_unum;
4: i32 target_unum;
5: RpcVector2D target_point;
6: double first_ball_speed;
7: double first_turn_moment;
8: double first_dash_power;
9: double first_dash_angle_relative;
10: i32 duration_step;
11: i32 kick_count;
12: i32 turn_count;
13: i32 dash_count;
14: bool final_action;
15: string description;
16: i32 parent_index;
}

struct RpcPredictState {
1: i32 spend_time;
2: i32 ball_holder_unum;
3: RpcVector2D ball_position;
4: RpcVector2D ball_velocity;
5: double our_defense_line_x;
6: double our_offense_line_x;
}

struct RpcActionState {
1: RpcCooperativeAction action;
2: RpcPredictState predict_state;
3: double evaluation;
}

struct BestPlannerActionRequest {
1: RegisterResponse register_response,
2: map<i32, RpcActionState> pairs;
3: State state;
}

struct BestPlannerActionResponse {
1: i32 index;
}

struct Empty {}

service Game {
Expand All @@ -1173,6 +1256,7 @@ service Game {
Empty SendPlayerParams(1: PlayerParam player_param),
Empty SendPlayerType(1: PlayerType player_type),
RegisterResponse Register(1: RegisterRequest request),
Empty SendByeCommand(1: RegisterResponse register_response)
Empty SendByeCommand(1: RegisterResponse register_response),
BestPlannerActionResponse GetBestPlannerAction(1: BestPlannerActionRequest best_planner_action_request)
}

Loading

0 comments on commit c3c9a22

Please sign in to comment.