BazkieBumpercar / GameplayFootball

Football game, discontinued
The Unlicense
198 stars 68 forks source link

About player direction #9

Open yumianhuli2 opened 4 years ago

yumianhuli2 commented 4 years ago

Hello! Could you plz tell me that the graph below is correct for play direction calculation?

Selection_001 ........ info.player_direction = (movement / GetGameConfig().physics_steps_per_frame).coords; ........ if not,plz tell me the corrent answer!Thank you very much indeed!!!

BazkieBumpercar commented 4 years ago

I have no idea, depends on what all these variables mean :) needs more context..

In general, a direction would be normalized, while movement isn't, so info.player_direction = movement.GetNormalized(0); would make more sense. But it really depends on what you want, where movement comes from, what info.player_direction is, etc..

yumianhuli2 commented 4 years ago

I have no idea, depends on what all these variables mean :) needs more context..

In general, a direction would be normalized, while movement isn't, so info.player_direction = movement.GetNormalized(0); would make more sense. But it really depends on what you want, where movement comes from, what info.player_direction is, etc..

Hello!The context is below from google-football engine,but this engine is from your project^_^ So I want to know where is the formula and code for the direction of the player! Thank you very much!

void Match::GetTeamState(SharedInfo state, std::map<IHIDevice , int> &controller_mapping, int team_id) { DO_VALIDATION; std::vector &team = team_id == 0 ? state->left_team : state->right_team; team.clear(); std::vector<Player *> players; GetAllTeamPlayers(team_id, players); for (auto player : players) { DO_VALIDATION; auto controller = player->GetExternalController(); if (controller) { DO_VALIDATION; if (team_id == 0) { state->left_controllers[controller_mapping[controller->GetHIDevice()]] .controlled_player = team.size(); } else { state->right_controllers[controller_mapping[controller->GetHIDevice()]] .controlled_player = team.size(); } } if (player->CastHumanoid() != NULL) { DO_VALIDATION; auto position = player->GetPosition(); auto movement = player->GetMovement(); if (team_id == 1) { position.Mirror(); movement.Mirror(); } PlayerInfo info; info.player_position = position.coords; info.player_direction = (movement / GetGameConfig().physics_steps_per_frame).coords; GetGameConfig().physics_steps_per_frame).coords[0])<<","<<"y:"<<std::to_string((movement / GetGameConfig().physics_steps_per_frame).coords[1])<<","<<"z:"<<std::to_string((movement / GetGameConfig().physics_steps_per_frame).coords[2])<<"\n"; info.tired_factor = 1 - player->GetFatigueFactorInv(); info.has_card = player->HasCards(); info.is_active = player->IsActive(); info.role = player->GetFormationEntry().role; if (player->HasPossession() && GetLastTouchTeamID() != -1 && GetLastTouchTeam()->GetLastTouchPlayer() == player) { DO_VALIDATION; state->ball_owned_player = team.size(); state->ball_owned_team = GetLastTouchTeamID(); } team.push_back(info); } } }

And I did not get the answer from this https://github.com/google-research/football/issues/145, so plz help me!^_^! source link is here: https://github.com/google-research/football/tree/master/third_party/gfootball_engine

BazkieBumpercar commented 4 years ago

Ahh I see.. but I have no idea about Google's code, and I don't really have the time or energy to put into helping people with custom code. I hope maybe someone else can come along and help you here, so I'll leave this topic open. Good luck :)

yumianhuli2 commented 4 years ago

Ahh I see.. but I have no idea about Google's code, and I don't really have the time or energy to put into helping people with custom code. I hope maybe someone else can come along and help you here, so I'll leave this topic open. Good luck :)

^_^

roberth11 commented 4 years ago

Ahh, ya veo ... pero no tengo idea sobre el código de Google, y realmente no tengo el tiempo ni la energía para ayudar a las personas con código personalizado. Espero que alguien más pueda venir y ayudarte aquí, así que dejaré este tema abierto. Buena suerte :)

^ _ ^

you could compile the game