Skip to content

Develop #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Oct 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 34 additions & 2 deletions idl/service.proto
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// version 1

// version 1.6

syntax = "proto3";

Expand Down Expand Up @@ -102,6 +103,16 @@ enum CardType {
RED = 2;
}

message PenaltyKickState {
Side on_field_side = 1;
Side current_taker_side = 2;
int32 our_taker_counter = 3;
int32 their_taker_counter = 4;
int32 our_score = 5;
int32 their_score = 6;
bool is_kick_taker = 7;
}

message Player {
RpcVector2D position = 1;
RpcVector2D seen_position = 2;
Expand Down Expand Up @@ -175,6 +186,8 @@ message Self {
float recovery = 37;
float stamina_capacity = 38;
CardType card = 39;
int32 catch_time = 40;
float effort = 41;
}

enum InterceptActionType {
Expand Down Expand Up @@ -282,6 +295,13 @@ message WorldModel {
double their_defense_line_x = 33;
double our_defense_player_line_x = 34;
double their_defense_player_line_x = 35;
bool kickable_teammate_existance = 36;
bool kickable_opponent_existance = 37;
PenaltyKickState penalty_kick_state = 38;
int32 see_time = 39;
int32 time_stopped = 40;
int32 set_play_count = 41;
Side game_mode_side = 42;
}

message State {
Expand Down Expand Up @@ -799,6 +819,10 @@ message HeliosPenalty {}

message HeliosCommunicaion {}

message bhv_doForceKick {}

message bhv_doHeardPassRecieve {}

message PlayerAction {
oneof action {
Dash dash = 1;
Expand Down Expand Up @@ -865,13 +889,17 @@ message PlayerAction {
HeliosSetPlay helios_set_play = 62;
HeliosPenalty helios_penalty = 63;
HeliosCommunicaion helios_communication = 64;
bhv_doForceKick bhv_do_force_kick = 65;
bhv_doHeardPassRecieve bhv_do_heard_pass_recieve = 66;

}
}

message PlayerActions {
repeated PlayerAction actions = 1;
bool ignore_preprocess = 2;
bool ignore_doforcekick = 3;
bool ignore_doHeardPassRecieve = 4;
}

message ChangePlayerType {
Expand Down Expand Up @@ -1160,6 +1188,10 @@ message ServerParam {
float penalty_area_half_width = 220;
float penalty_area_length = 221;
float goal_width = 222;
float goal_area_width = 223;
float goal_area_length = 224;
float center_circle_r = 225;
float goal_post_radius = 226;
}

message PlayerParam {
Expand Down Expand Up @@ -1299,4 +1331,4 @@ service Game {
rpc Register(RegisterRequest) returns (RegisterResponse) {}
rpc SendByeCommand(RegisterResponse) returns (Empty) {}
rpc GetBestPlannerAction(BestPlannerActionRequest) returns (BestPlannerActionResponse) {}
}
}
8 changes: 4 additions & 4 deletions server.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def GetPlayerActions(self, state: pb2.State):
simple_shoot=True,
simple_dribble=True,
cross=True,
server_side_decision=False
server_side_decision=True
)))
actions.append(pb2.PlayerAction(helios_shoot=pb2.HeliosShoot()))
else:
Expand All @@ -65,7 +65,7 @@ def GetPlayerActions(self, state: pb2.State):
return pb2.PlayerActions(actions=actions)

def GetBestPlannerAction(self, pairs: pb2.BestPlannerActionRequest):
self.logger.debug(f"GetBestPlannerAction cycle:{pairs.state.world_model.cycle} pairs:{len(pairs.pairs)} unum:{pairs.state.register_response.uniform_number}")
self.logger.debug(f"GetBestPlannerAction cycle:{pairs.state.world_model.cycle} pairs:{len(pairs.pairs)} unum:{pairs.register_response.uniform_number}")
pairs_list: list[int, pb2.RpcActionState] = [(k, v) for k, v in pairs.pairs.items()]
pairs_list.sort(key=lambda x: x[0])
best_action = max(pairs_list, key=lambda x: -1000 if x[1].action.parent_index != -1 else x[1].predict_state.ball_position.x)
Expand Down Expand Up @@ -183,8 +183,8 @@ def SendByeCommand(self, register_response: pb2.RegisterResponse, context):
return res

def GetBestPlannerAction(self, pairs: pb2.BestPlannerActionRequest, context):
main_logger.debug(f"GetBestPlannerAction cycle:{pairs.state.world_model.cycle} pairs:{len(pairs.pairs)} unum:{pairs.state.register_response.uniform_number}")
res = self.agents[pairs.state.register_response.client_id].GetBestPlannerAction(pairs)
main_logger.debug(f"GetBestPlannerAction cycle:{pairs.state.world_model.cycle} pairs:{len(pairs.pairs)} unum:{pairs.register_response.uniform_number}")
res = self.agents[pairs.register_response.client_id].GetBestPlannerAction(pairs)
return res


Expand Down
580 changes: 298 additions & 282 deletions service_pb2.py

Large diffs are not rendered by default.

Loading