Skip to content
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

About player direction #9

Open
yumianhuli2 opened this issue May 2, 2020 · 5 comments
Open

About player direction #9

yumianhuli2 opened this issue May 2, 2020 · 5 comments

Comments

@yumianhuli2
Copy link

yumianhuli2 commented May 2, 2020

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
Copy link
Owner

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
Copy link
Author

yumianhuli2 commented May 3, 2020

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 google-research/football#145,
so plz help me!^_^!
source link is here: https://github.com/google-research/football/tree/master/third_party/gfootball_engine

@BazkieBumpercar
Copy link
Owner

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
Copy link
Author

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants