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

Error when running game only among bots #40

Closed
alexander3605 opened this issue Jul 8, 2019 · 4 comments
Closed

Error when running game only among bots #40

alexander3605 opened this issue Jul 8, 2019 · 4 comments

Comments

@alexander3605
Copy link

Hello
For a project that I am working on, I am trying to execute the simulator without any learning agent but only among bots.
I am using this command to run the game:

alessandroserena@alessandroserena-VirtualBox:~/Desktop/football$ MESA_GL_VERSION_OVERRIDE=3.2 MESA_GLSL_VERSION_OVERRIDE=150 python3 -m gfootball.play_game --home_players=bot --away_players=bot

The rendered window starts and as soon as the kick-off is done the game crashes with the following error:

/home/alessandroserena/.local/lib/python3.6/site-packages/google/protobuf/__init__.py:37: UserWarning: Module gfootball_engine was already imported from /home/alessandroserena/.local/lib/python3.6/site-packages/gfootball_engine/__init__.py, but /home/alessandroserena/Desktop/football is being added to sys.path
  __import__('pkg_resources').declare_namespace(__name__)
Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/alessandroserena/Desktop/football/gfootball/play_game.py", line 64, in <module>
    app.run(main)
  File "/home/alessandroserena/.local/lib/python3.6/site-packages/absl/app.py", line 300, in run
    _run_main(main, args)
  File "/home/alessandroserena/.local/lib/python3.6/site-packages/absl/app.py", line 251, in _run_main
    sys.exit(main(argv))
  File "/home/alessandroserena/Desktop/football/gfootball/play_game.py", line 55, in main
    _, _, done, _ = env.step(None)
  File "/home/alessandroserena/Desktop/football/gfootball/env/football_env.py", line 139, in step
    observation, reward, done = self._env.step(self._get_actions())
  File "/home/alessandroserena/Desktop/football/gfootball/env/football_env.py", line 129, in _get_actions
    adopted_obs = self._convert_observations(obs, False, i)
  File "/home/alessandroserena/Desktop/football/gfootball/env/football_env.py", line 117, in _convert_observations
    observations = observation_rotation.flip_observation(observations)
TypeError: flip_observation() missing 1 required positional argument: 'config'


Can someone please help me fix this error, or otherwise show me how to run a simulation between players that can play a "realistic" game?

Thanks a lot for creating this package
alexander3605

@michalzajac-ml
Copy link

Thanks for creating this issue!
This is a bug and a fix will be released soon.
In the meantime, to make it work just change this line: https://github.com/google-research/football/blob/master/gfootball/env/football_env.py#L117 from observations = observation_rotation.flip_observation(observations) to observations = observation_rotation.flip_observation(observations, self._config).
Alternatively (even without changes in code), you can run:
MESA_GL_VERSION_OVERRIDE=3.2 MESA_GLSL_VERSION_OVERRIDE=150 python3 -m gfootball.play_game --home_players= --away_players=. This will run two built-in AIs, while your original command runs two bots defined here: https://github.com/google-research/football/blob/master/gfootball/env/players/bot.py .

@kkurach
Copy link
Collaborator

kkurach commented Jul 9, 2019

Closing the issue, @alexander3605 - please re-open if this didn't solve your problem.

@kkurach kkurach closed this as completed Jul 9, 2019
@alexander3605
Copy link
Author

Hi @zajaczajac
Thank you for the reply, that worked.

Now, I am trying to extract some information about the players, specifically the sticky_actions.
If I run the command you suggested above MESA_GL_VERSION_OVERRIDE=3.2 MESA_GLSL_VERSION_OVERRIDE=150 python3 -m gfootball.play_game --home_players= --away_players= the game works but no information about the players actions is exposed (not even internally in the source code, from what I can see) since there is no active player in any team.

How can I specify the built-in AI in the --home_team= and --away_team= arguments when I run the game?

@alexander3605
Copy link
Author

I opened a new issue since I cannot reopen this one.

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