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

Multiplayer player API support in ALE #405

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

benblack769
Copy link
Contributor

A cleaned up and simplified version of #350. Fully functional, pip installable project with many environments is here, with high level PettingZoo support documented here and associated workshop paper here

Atari has some great multiplayer games. This PR starts the process of supporting these games with:

  • a new clean API for handling multiplayer games that is 100% backwards compatible
  • Support for 2 and 4 player Pong as an example (more games will be added once this PR is merged)

New API

The new api has the following methods in addition to all the old ones (in both the python and c++ interfaces):

  • numPlayersActive() -> int
    • the number of players in the current mode
  • act(list of actions) -> list of rewards
    • overloads act(int) ->int, which is still there
    • Requires that the number of actions matches numPlayersActive()
  • allLives() -> list of lives
  • getAvailableModes(num_players=1) -> list of modes
    • returns modes that support the specified number of players.
    • List is empty when the number of players is not supported at all

Note that Pong is renumbered to have the numbering scheme proposed in #397.

Notable internal changes

  • Addition of functions to the RomSettings class to provide methods of getting rewards and lives for multiple players
  • Addition of 2 and 4 player RomSettings classes to enforce that games override the multiplayer settings methods
  • To support 4 player games like pong (included) and warlords (implemented in main project) paddles are manipulated individually by index in ale_state.cpp, and support for manipulating all 4 paddles is included.
  • ALEState includes the number of players as part of the game state, StellaEnvironment sets the number of players when the game mode is changed.
  • PLAYER_B actions (numbered 18-35) are not accepted to the external interface, or any function which accepts a list of actions, but are accepted in certain internal functions such as StellaEnvironment::act(Action, Action) for backwards compatibility.

@benblack769 benblack769 changed the title (Cleaned up) multiplayer player support to ALE Multiplayer player API support in ALE Jan 20, 2021
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

Successfully merging this pull request may close these issues.

2 participants