← All tools

arcade-learning-environment

Popularity 85 Updated Development & Build

Platform for AI research

homebrewauto-collected

Installation

Homebrew
brew install arcade-learning-environment

Install with Homebrew.

<p align="center" <a href="https://ale.farama.org/" target = "blank" <img src="ale-text-v2-centered.png" width="500px" / </a

The Arcade Learning Environment (ALE) is a simple framework that allows researchers and hobbyists to develop AI agents for Atari 2600 games. It is built on top of the Atari 2600 emulator Stella and separates the details of emulation from agent design. This video depicts over 50 games currently supported in the ALE.

For an overview of our goals for the ALE read The Arcade Learning Environment: An Evaluation Platform for General Agents. If you use ALE in your research, we ask that you please cite this paper in reference to the environment. See the Citing section for BibTeX entries.

Features --------

  • Object-oriented framework with support to add agents and games.
  • Emulation core uncoupled from rendering and sound generation modules for fast emulation with minimal library dependencies.
  • Automatic extraction of game score and end-of-game signal for more than 100 Atari 2600 games.
  • Multi-platform code (compiled and tested under macOS, Windows, and several Linux distributions).
  • Python bindings through nanobind.
  • Native support for Gymnasium, the maintained fork of OpenAI Gym.
  • Atari roms are packaged within the pip package.
  • C++ based vectorizer for acting in multiple ROMs at the same time.
  • WebAssembly support for running ALE in the Browser

Quick Start ===========

The ALE currently supports three different interfaces: C++, Python, Gymnasium and WASM.

Python ------

You simply need to install the ale-py package distributed via PyPI:

pip install ale-py

Note: Make sure you're using an up-to-date version of pip or the installation may fail.

Note: Free-threaded CPython (the t ABI, e.g. python3.14t) aren't supported as OpenCV doesn't build compatible wheels on any system which is necessary for preprocessing. We will look to add support when OpenCV does.

You can now import the ALE in your Python projects with providing a direct interface to Stella for interacting with games

from ale_py import ALEInterface, roms

ale = ALEInterface()
ale.loadROM(roms.get_rom_path("breakout"))
ale.reset_game()

reward = ale.act(0)  # noop
screen_obs = ale.getScreenRGB()

Gymnasium

For simplicity for installing ale-py with Gymnasium, pip install "gymnasium[atari]" shall install all necessary modules and ROMs. See Gymnasium introductory page for description of the API to interface with the environment.

import gymnasium as gym
import ale_py

gym.register_envs(ale_py)  # unnecessary but helpful for IDEs

env = gym.make('ALE/Breakout-v5', render_mode="human")  # remove render_mode in training
obs, info = env.reset()
episode_over = False
while not episode_over:
    action = policy(obs)  # to implement - use `env.action_space.sample()` for a random policy
    obs, reward, terminated, truncated, info = env.step(action)