### Install C++ Dependencies and Build ALE Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/getting-started.md Provides commands to install necessary C++ dependencies (zlib, SDL2) using vcpkg and then build and install the ALE C++ library using CMake. This is for users who want to integrate ALE directly into C++ projects. ```sh vcpkg install zlib sdl2 mkdir build && cd build cmake ../ -DCMAKE_BUILD_TYPE=Release cmake --build . --target install ``` -------------------------------- ### Install Python Interface (PyPI) Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/getting-started.md Installs the `ale-py` package from the Python Package Index (PyPI). This is the primary method for using ALE with Python. ```bash pip install ale-py ``` -------------------------------- ### Integrate ALE with Gymnasium API Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/getting-started.md Shows how to register ALE environments with the Gymnasium API and interact with an ALE-wrapped environment, such as Breakout. This involves importing Gymnasium, registering ALE environments, creating an environment instance, and performing basic steps. ```python import gymnasium as gym import ale_py gym.register_envs(ale_py) env = gym.make('ALE/Breakout-v5') obs, info = env.reset() obs, reward, terminated, truncated, info = env.step(env.action_space.sample()) env.close() ``` -------------------------------- ### Import and Initialize ALE Python Interface Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/getting-started.md Demonstrates how to import the `ALEInterface` class from the `ale_py` library and create an instance of the ALE interface in Python. ```python from ale_py import ALEInterface ale = ALEInterface() ``` -------------------------------- ### Install Documentation Requirements Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/README.md Installs the necessary Python packages required to build the Arcade Learning Environment documentation. This is a prerequisite for generating the documentation. ```bash pip install -r docs/requirements.txt ``` -------------------------------- ### Initialize ALE Interface Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/cpp-interface.md Demonstrates the basic instantiation of the ALEInterface class to start the Arcade Learning Environment. ```cpp ale::ALEInterface ale; ``` -------------------------------- ### Build Documentation (One-time) Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/README.md Builds the HTML version of the documentation for the Arcade Learning Environment. This command should be run after installing the requirements. ```bash cd docs make html ``` -------------------------------- ### Gymnasium Vector Environment Comparison Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/vector-environment.md Compares the ALE Vector Environment setup with the equivalent Gymnasium setup using FrameStackObservation and AtariPreprocessing. ```python gym_envs = gym.vector.SyncVectorEnv( [ lambda: gym.wrappers.FrameStackObservation( gym.wrappers.AtariPreprocessing( gym.make(env_id, frameskip=1), ), stack_size=stack_num, padding_type="zero", ) for _ in range(num_envs) ], ) ale_envs = gym.make_vec( env_id, num_envs, use_fire_reset=False, reward_clipping=False, repeat_action_probability=0.0, ) ``` -------------------------------- ### Link ALE C++ Library in CMake Project Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/getting-started.md Demonstrates how to link the installed ALE C++ library against your target executable or library within a CMake build system. This allows your C++ application to use ALE's functionalities. ```cmake find_package(ale REQUIRED) target_link_libraries(YourTarget ale::ale-lib) ``` -------------------------------- ### Basic Usage: Creating and Interacting with AtariVectorEnv Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/vector-environment.md Demonstrates the basic steps to create an AtariVectorEnv, reset it, sample actions, step through the environment, and close it. ```python from ale_py.vector_env import AtariVectorEnv # Create a vector environment with 4 parallel instances of Breakout envs = AtariVectorEnv( game="breakout", # The ROM id not name, i.e., camel case compared to `gymnasium.make` name versions num_envs=4, ) # Reset all environments observations, info = envs.reset() # Take random actions in all environments actions = envs.action_space.sample() observations, rewards, terminations, truncations, infos = envs.step(actions) # Close the environment when done envs.close() ``` -------------------------------- ### Furo Theme from Git Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/requirements.txt Installs the Furo theme for Sphinx documentation from a Git repository. This allows for customization of the documentation's appearance. ```git git+https://github.com/Farama-Foundation/Celshast#egg=furo ``` -------------------------------- ### Initialize ALE and Load ROM Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/README.md Demonstrates how to initialize the ALE interface, load a specific Atari ROM (e.g., 'breakout'), and reset the game state. This is the starting point for interacting with games using the ALE. ```python from ale_py import ALEInterface, roms ale = ALEInterface() ale.loadROM(roms.get_rom_path("breakout")) ale.reset_game() ``` -------------------------------- ### Sphinx Gallery from Git Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/requirements.txt This dependency installs the sphinx-gallery package directly from a specific commit in its GitHub repository. This ensures a consistent version of the documentation generation tool is used. ```git git+https://github.com/sphinx-gallery/sphinx-gallery.git@4006662c8c1984453a247dc6d3df6260e5b00f4b#egg=sphinx_gallery ``` -------------------------------- ### ffmpeg Command for Video Creation Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/visualization.md An example bash command using ffmpeg to combine recorded frames and audio into a video file. It specifies the frame rate, input files (image sequence and audio), output format, and codecs for audio and video. ```bash # -r frame_rate # -i input # -f format # -c:a audio_codec # -c:v video_codec ffmpeg -r 60 \ -i record/%06d.png \ -i record/sound.wav \ -f mov \ -c:a mp3 \ -c:v libx264 \ agent.mov ``` -------------------------------- ### Installation Rules for UNIX Systems Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/src/ale/CMakeLists.txt Defines installation rules for UNIX-like systems when building the C++ library. This includes installing targets, headers, the version file, and CMake configuration files for package management. ```cmake if (UNIX AND BUILD_CPP_LIB) include(GNUInstallDirs) include(CMakePackageConfigHelpers) install(TARGETS ale ale-lib EXPORT ale-export INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME} FILES_MATCHING REGEX "\.h((pp)?|(xx?))$" REGEX "os_dependent/.*(Win32)\.(h|h(xx)?|h(pp)?|c(xx)?|c(pp)?)$" EXCLUDE) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/version.hpp DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}) install(EXPORT ale-export FILE ${PROJECT_NAME}-targets.cmake NAMESPACE ${PROJECT_NAME}:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}) write_basic_package_version_file( ${PROJECT_NAME}-config-version.cmake VERSION ${PACKAGE_VERSION} COMPATIBILITY AnyNewerVersion) configure_package_config_file( ${PROJECT_SOURCE_DIR}/cmake/${PROJECT_NAME}-config.cmake.in ${PROJECT_NAME}-config.cmake INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake" "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake" DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}) endif() ``` -------------------------------- ### Take an Action and Get Reward Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/cpp-interface.md Demonstrates how to select an action from the legal action set and execute it in the environment, returning the resulting reward. ```cpp ale::Action a = legal_actions[rand() % legal_actions.size()]; float reward = ale.act(a); ``` -------------------------------- ### Advanced Configuration for AtariVectorEnv Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/vector-environment.md Illustrates the extensive configuration options available when creating an AtariVectorEnv, covering preprocessing, environment behavior, and performance tuning. ```python envs = AtariVectorEnv( # Required parameters game: str = "breakout", # The ROM id not name, i.e., camel case compared to Gymnasium.make name versions num_envs: int = 1, # Number of parallel environments *, # Preprocessing parameters frameskip: int = 4, # Number of frames to skip (action repeat) grayscale: bool = True, # Use grayscale observations stack_num: int = 4, # Number of frames to stack img_height: int = 84, # Height to resize frames to img_width: int = 84, # Width to resize frames to maxpool: bool = True, # If to maxpool sequential frames reward_clipping: bool = True, # If to clip environment step rewards between -1 and 1 # Environment behavior noop_max: int = 30, # Maximum number of no-ops at reset use_fire_reset: bool = True, # Press FIRE on reset for games that require it episodic_life: bool = False, # End episodes on life loss life_loss_info: bool = False, # Return termination signal on life loss but don't reset the environment until all lives are alot. If used, this MUST be indicated as has a significant impact on training performance. max_num_frames_per_episode: int = 108000, # Max frames per episode (27000 steps * 4 frame skip) repeat_action_probability: float = 0.0, # Sticky actions probability full_action_space: bool = False, # Use full action space (not minimal) continuous: bool = False, # If to use continuous actions continuous_action_threshold: bool = 0.5, # The threshold at which to use continuous actions # Performance options batch_size=0, # Number of environments to process at once (default=0 is the `num_envs`) autoreset_mode=gym.vector.AutoresetMode.NEXT_STEP, # How reset sub-environments when they terminated (https://farama.org/Vector-Autoreset-Mode) num_threads=0, # Number of worker threads (0=auto) thread_affinity_offset=-1,# CPU core offset for thread affinity (-1=no affinity) ) ``` -------------------------------- ### Running ALE Tests Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/CONTRIBUTING.md This command demonstrates how to build and run the test suite for the Arcade Learning Environment using CMake. Ensure you have CMake installed and configured for your project. ```cmake cmake --build . --config Release --target test ``` -------------------------------- ### Qbert Environment Initialization Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/environments/qbert.md Demonstrates how to make the Qbert environment using gymnasium.make. It specifies the environment ID and optional parameters like full_action_space. ```python import gymnasium as gym env = gym.make("ALE/Qbert-v5") # To enable all 18 possible actions: env_full_action_space = gym.make("ALE/Qbert-v5", full_action_space=True) ``` -------------------------------- ### Install ale-py Package Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/README.md Installs the 'ale-py' package from PyPI, which provides Python bindings for the Arcade Learning Environment. Ensure you are using an up-to-date version of pip for a successful installation. ```shell pip install ale-py ``` -------------------------------- ### Install Atari Environments Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/multi-agent-environments.md Installs the necessary dependencies for the Atari environments using pip. This command ensures that all required packages, including those for Atari support within PettingZoo, are downloaded and installed. ```bash pip install pettingzoo[atari] ``` -------------------------------- ### C++ ALE Build and Install with CMake Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/README.md Provides the shell commands to build and install the Arcade Learning Environment (ALE) using CMake. It includes creating a build directory, configuring the build with Release type, and executing the build and install targets. ```sh mkdir build && cd build cmake ../ -DCMAKE_BUILD_TYPE=Release cmake --build . --target install ``` -------------------------------- ### Documentation Tools Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/requirements.txt These packages are used for generating and managing project documentation. They include Sphinx for building documentation, sphinx-autobuild for live reloading during development, sphinx_github_changelog for GitHub-style changelogs, and myst-parser for parsing Markdown files within Sphinx. ```python sphinx sphinx-autobuild sphinx_github_changelog myst-parser ``` -------------------------------- ### Gymnasium Basic Usage with ALE Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/README.md Demonstrates how to initialize and interact with an ALE environment (Breakout) using Gymnasium. It covers environment creation, resetting, stepping through episodes, and closing the environment. Includes a placeholder for a custom policy. ```python 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) episode_over = terminated or truncated env.close() ``` -------------------------------- ### Set Integer Environment Parameter Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/cpp-interface.md Shows how to set an integer-valued parameter for the ALE environment, using 'random_seed' as an example. ```cpp ale.setInt("random_seed", 123); ``` -------------------------------- ### Gymnasium Video Recording Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/visualization.md Shows how to record videos of ALE environment episodes using Gymnasium's `RecordVideo` wrapper. It configures the wrapper to record every other episode, specifies a save directory and filename prefix, and then runs a series of episodes, stepping through each one. ```python import gymnasium import ale_py gymnasium.register_envs(ale_py) env = gymnasium.make("ALE/Pong-v5", render_mode="rgb_array") env = gymnasium.wrappers.RecordVideo( env, episode_trigger=lambda num: num % 2 == 0, video_folder="saved-video-folder", name_prefix="video-", ) for episode in range(10): obs, info = env.reset() episode_over = False while not episode_over: action = env.action_space.sample() obs, reward, terminated, truncated, info = env.step(action) episode_over = terminated or truncated env.close() ``` -------------------------------- ### Get Audio Observation Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/cpp-interface.md Retrieves the optional audio observation from the ALE environment after enabling the sound observation feature. ```cpp ale.getAudio() ``` -------------------------------- ### Get Legal Action Set Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/cpp-interface.md Retrieves the set of all legal actions available in the current game from the ALE interface. ```cpp ale::ActionVect legal_actions = ale.getLegalActionSet(); ``` -------------------------------- ### WizardOfWor Environment Initialization Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/environments/wizard_of_wor.md Demonstrates how to initialize the WizardOfWor environment using gymnasium.make. It specifies the environment ID and optionally allows for a full action space. ```python import gymnasium as gym env = gym.make("ALE/WizardOfWor-v5") # To enable all 18 possible actions: env_full_action_space = gym.make("ALE/WizardOfWor-v5", full_action_space=True) ``` -------------------------------- ### Surround Environment Initialization Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/environments/surround.md Demonstrates how to make the Surround environment using gymnasium. Includes details on action and observation spaces. ```python import gymnasium as gym env = gym.make("ALE/Surround-v5") # Action Space: Discrete(5) # Observation Space: Box(0, 255, (210, 160, 3), uint8) ``` -------------------------------- ### MontezumaRevenge Environment Creation Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/environments/montezuma_revenge.md Example of how to create the MontezumaRevenge environment using gymnasium.make. It specifies the environment ID and can be configured with different observation types and frame skips. ```python import gymnasium as gym env = gym.make("ALE/MontezumaRevenge-v5") ``` -------------------------------- ### Klax Environment Initialization Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/environments/klax.md Demonstrates how to initialize the Klax environment using gymnasium.make. It specifies the environment ID and mentions the default action and observation spaces. ```Python import gymnasium as gym env = gym.make("ALE/Klax-v5") # Action Space: Discrete(18) # Observation Space: Box(0, 255, (250, 160, 3), uint8) ``` -------------------------------- ### Simple Random Agent Example Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/cpp-interface.md A complete C++ program demonstrating a simple agent that plays a game randomly until the episode ends. ```cpp #include #include int main(int argc, char** argv) { if (argc < 2) { std::cerr << "Usage: " << argv[0] << " rom_file" << std::endl; return 1; } ale::ALEInterface ale; ale.setInt("random_seed", 123); ale.loadROM(argv[1]); ale::ActionVect legal_actions = ale.getLegalActionSet(); float totalReward = 0.0; while (!ale.game_over()) { Action a = legal_actions[std::rand() % legal_actions.size()]; float reward = ale.act(a); totalReward += reward; std::cout << "The episode ended with score: " << totalReward << std::endl; } return 0; } ``` -------------------------------- ### VideoPinball Environment Initialization Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/environments/video_pinball.md Demonstrates how to initialize the VideoPinball environment using gymnasium.make. It specifies the environment ID and highlights the default action and observation spaces. ```python import gymnasium as gym env = gym.make("ALE/VideoPinball-v5") print(env.action_space) # Output: Discrete(9) print(env.observation_space) # Output: Box(0, 255, (210, 160, 3), uint8) ``` -------------------------------- ### UpNDown Environment Initialization Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/environments/up_n_down.md Demonstrates how to make the UpNDown environment using gymnasium.make. It specifies the environment ID and optionally allows for full action space. ```python import gymnasium as gym # Default initialization env = gym.make("ALE/UpNDown-v5") # Initialization with full action space env_full_action = gym.make("ALE/UpNDown-v5", full_action_space=True) ``` -------------------------------- ### Original Citation for Arcade Learning Environment Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/multi-agent-environments.md BibTeX entry for the original paper introducing the Arcade Learning Environment. ```bibtex @Article{bellemare13arcade, author = { {Bellemare}, M.~G. and {Naddaf}, Y. and {Veness}, J. and {Bowling}, M.}, title = {The Arcade Learning Environment: An Evaluation Platform for General Agents}, journal = {Journal of Artificial Intelligence Research}, year = "2013", month = "jun", volume = "47", pages = "253--279" } ``` -------------------------------- ### Warlords Agent Configuration Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/multi-agent-environments/warlords.md Details the agent setup for the Warlords environment, including the number of agents and their naming convention. This environment supports parallel API usage. ```APIDOC Warlords Agent Configuration: Agents: 4 Agent Names: ['first_0', 'second_0', 'third_0', 'fourth_0'] Parallel API: Yes ``` -------------------------------- ### Breakout Environment Initialization Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/environments/breakout.md Demonstrates how to initialize the Breakout environment using gymnasium.make. It specifies the environment ID and mentions the default observation and action spaces. ```python import gymnasium as gym env = gym.make("ALE/Breakout-v5") # Default Action Space: Discrete(4) # Default Observation Space: Box(0, 255, (210, 160, 3), uint8) ``` -------------------------------- ### Asynchronous Stepping with Send/Recv Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/vector-environment.md Demonstrates how to use the `send` and `recv` methods for asynchronous environment stepping. This allows for overlapping computation with environment execution, potentially improving performance. ```python # Send actions to environments envs.send(actions) # Do other computation here while environments are stepping # Receive results when ready observations, rewards, terminations, truncations, infos = envs.recv() ``` -------------------------------- ### NameThisGame Environment Initialization Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/environments/name_this_game.md Demonstrates how to initialize the NameThisGame environment using gymnasium.make. It specifies the environment ID and optional parameters like full_action_space. ```python import gymnasium as gym env = gym.make("ALE/NameThisGame-v5") # To enable all 18 possible actions: # env = gym.make("ALE/NameThisGame-v5", full_action_space=True) ``` -------------------------------- ### Setting Thread Affinity in AtariVectorEnv Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/vector-environment.md Shows how to configure `thread_affinity_offset` for `AtariVectorEnv` to manage thread affinity on multi-core systems. This can lead to performance improvements by optimizing CPU core utilization. ```python # Set thread affinity starting from core 0 envs = AtariVectorEnv(game="Breakout", num_envs=8, thread_affinity_offset=0) ``` -------------------------------- ### Kaboom Environment Initialization Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/environments/kaboom.md Demonstrates how to initialize the Kaboom environment using gymnasium.make. It specifies the environment ID and highlights the default observation and action spaces. ```python import gymnasium as gym env = gym.make("ALE/Kaboom-v5") # Action Space: Discrete(4) # Observation Space: Box(0, 255, (210, 160, 3), uint8) ``` -------------------------------- ### Get Minimal Action Set Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/env-spec.md This snippet shows how to retrieve the minimal set of actions required to play a game using the RomSettings class in the Arcade Learning Environment. ```Python from ale_py.rom.rom_settings import RomSettings # Assuming 'game_path' is the path to your ROM file minimal_actions = RomSettings.getMinimalActionSet('path/to/your/game.bin') ``` -------------------------------- ### Galaxian Environment Initialization Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/environments/galaxian.md Demonstrates how to create an instance of the Galaxian environment using gymnasium.make. It specifies the environment ID and optionally allows for enabling the full action space. ```python import gymnasium as gym # Default initialization env = gym.make("ALE/Galaxian-v5") # Initialization with full action space enabled env_full_action = gym.make("ALE/Galaxian-v5", full_action_space=True) ``` -------------------------------- ### Configuring Batch Size in AtariVectorEnv Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/vector-environment.md Illustrates how to set the `batch_size` parameter when initializing `AtariVectorEnv`. This parameter controls the number of environments processed concurrently by worker threads, affecting latency and throughput. ```python # Process environments in batches of 4 envs = AtariVectorEnv(game="Breakout", num_envs=16, batch_size=4) ``` -------------------------------- ### Adventure Environment Initialization Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/environments/adventure.md Demonstrates how to initialize the Adventure environment using gymnasium.make. It specifies the environment ID and highlights the default action and observation spaces. ```python import gymnasium as gym env = gym.make("ALE/Adventure-v5") # Action Space: Discrete(18) # Observation Space: Box(0, 255, (250, 160, 3), uint8) ``` -------------------------------- ### Tennis Environment Parameters Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/multi-agent-environments/tennis.md This section outlines the key parameters and characteristics of the Tennis environment, including its agent configuration, observation shape, and action shape. It's useful for understanding the environment's setup. ```APIDOC Tennis Environment Details: Agents: ['first_0', 'second_0'] (2 agents) Action Shape: (1,) Action Values: [0, 17] Observation Shape: (210, 160, 3) Observation Values: (0, 255) Parallel API: Yes Manual Control: No ``` -------------------------------- ### Amidar Environment Initialization Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/environments/amidar.md Demonstrates how to make the Amidar environment using gymnasium.make. It specifies the environment ID and optionally the full action space. ```python import gymnasium as gym env = gym.make("ALE/Amidar-v5") # To enable all 18 possible actions: env_full_action_space = gym.make("ALE/Amidar-v5", full_action_space=True) ``` -------------------------------- ### Quadrapong Environment Import Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/multi-agent-environments/quadrapong.md This snippet shows the standard import statement for the Quadrapong v4 environment from the PettingZoo library. It's the entry point for using this specific Atari game in multi-agent reinforcement learning setups. ```python from pettingzoo.atari import quadrapong_v4 ``` -------------------------------- ### Vector Environment Observation Shape Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/vector-environment.md Defines the expected shape of observations returned by the vector environment. It accounts for the number of parallel environments, stacked frames, and image dimensions. An additional dimension is present for RGB frames when grayscale is disabled. ```python observations.shape = (num_envs, stack_size, height, width) # For RGB frames (grayscale=False): # observations.shape = (num_envs, stack_size, height, width, 3) ``` -------------------------------- ### BasicMath Environment Creation Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/environments/basic_math.md Demonstrates how to create an instance of the BasicMath environment using gymnasium.make. It specifies the environment ID and optional parameters like full_action_space. ```python import gymnasium as gym env = gym.make("ALE/BasicMath-v5") # To enable all 18 possible actions: env_full_action_space = gym.make("ALE/BasicMath-v5", full_action_space=True) ``` -------------------------------- ### KingKong Environment Initialization Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/environments/king_kong.md Demonstrates how to initialize the KingKong environment using gymnasium.make. It specifies the environment ID and optional parameters like full_action_space. ```python import gymnasium as gym # Default initialization env = gym.make("ALE/KingKong-v5") # Initialization with full action space env_full_action_space = gym.make("ALE/KingKong-v5", full_action_space=True) ``` -------------------------------- ### Atari Environment Parameters Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/multi-agent-environments.md Configures Atari environments within the Arcade Learning Environment. Allows setting observation type (RGB, grayscale, RAM), action space (full or unique actions), maximum game cycles, and the path for AutoROM installation. ```python atari_game.env(obs_type='rgb_image', full_action_space=True, max_cycles=100000, auto_rom_install_path=None) ``` -------------------------------- ### BankHeist Environment Initialization Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/environments/bank_heist.md Initializes the BankHeist environment using gymnasium.make. This is the standard way to create an instance of the environment. ```python import gymnasium as gym env = gym.make("ALE/BankHeist-v5") ``` -------------------------------- ### Gopher Environment Initialization Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/environments/gopher.md Demonstrates how to initialize the Gopher environment using gymnasium.make. It specifies the environment ID and optionally the full action space. ```python import gymnasium as gym env = gym.make("ALE/Gopher-v5") # To enable all 18 possible actions: env_full_action_space = gym.make("ALE/Gopher-v5", full_action_space=True) ``` -------------------------------- ### Atari Environment Preprocessing with SuperSuit Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/multi-agent-environments.md Provides an example of preprocessing Atari environments using the SuperSuit library. This includes handling frame flickering with `max_observation_v0`, introducing non-determinism with `sticky_actions_v0`, speeding up processing with `frame_skip_v0`, downscaling observations with `resize_v1`, and stacking frames with `frame_stack_v1`. ```python import supersuit from pettingzoo.atari import space_invaders_v1 env = space_invaders_v1.env() # as per openai baseline's MaxAndSKip wrapper, maxes over the last 2 frames # to deal with frame flickering env = supersuit.max_observation_v0(env, 2) # repeat_action_probability is set to 0.25 to introduce non-determinism to the system env = supersuit.sticky_actions_v0(env, repeat_action_probability=0.25) # skip frames for faster processing and less control # to be compatible with gym, use frame_skip(env, (2,5)) env = supersuit.frame_skip_v0(env, 4) # downscale observation for faster processing env = supersuit.resize_v1(env, 84, 84) # allow agent to see everything on the screen despite Atari's flickering screen problem env = supersuit.frame_stack_v1(env, 4) ``` -------------------------------- ### Pong Environment Initialization Source: https://github.com/farama-foundation/arcade-learning-environment/blob/master/docs/environments/pong.md Demonstrates how to initialize the Pong environment using gymnasium.make. It specifies the environment ID and optional arguments like full_action_space. ```python import gymnasium as gym # Default initialization env = gym.make("ALE/Pong-v5") # Initialization with full action space env = gym.make("ALE/Pong-v5", full_action_space=True) ```