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

ALE 0.6 #49

Merged
merged 2 commits into from
Jun 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 0 additions & 56 deletions ChangeLog

This file was deleted.

126 changes: 111 additions & 15 deletions README-ale.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,119 @@
(Contents from [https://github.com/bbitmaster/ale_python_interface](https://github.com/bbitmaster/ale_python_interface))
[![Build Status](https://travis-ci.org/mgbellemare/Arcade-Learning-Environment.svg?branch=master)](https://travis-ci.org/mgbellemare/Arcade-Learning-Environment)

<img align="right" src="doc/manual/figures/ale.gif" width=50>

# Arcade-Learning-Environment
# The Arcade Learning Environment

The Arcade Learning Environment (ALE) -- a platform for AI research.
The Arcade Learning Environment (ALE) is a simple object-oriented 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](https://stella-emu.github.io/) and separates the details of emulation from agent design. This [video](https://www.youtube.com/watch?v=nzUiEkasXZI) depicts over 50 games currently supported in the ALE.

For more details and installation instructions, see the [website](http://www.arcadelearningenvironment.org) and [manual](doc/manual/manual.pdf). To ask questions and discuss, please join the [ALE-users group](https://groups.google.com/forum/#!forum/arcade-learning-environment).
For an overview of our goals for the ALE read [The Arcade Learning Environment: An Evaluation Platform for General Agents](http://www.jair.org/papers/paper3912.html). If you use ALE in your research, we ask that you please cite this paper in reference to the environment (BibTeX entry at the end of this document). Also, if you have any questions or comments about the ALE, please contact us through our [mailing list](https://groups.google.com/forum/#!forum/arcade-learning-environment).

## Citing ALE

If ALE helps in your research, please cite the following:
Feedback and suggestions are welcome and may be addressed to any active member of the ALE team.

@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",
}
### 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 50 Atari 2600 games.
- Multi-platform code (compiled and tested under OS X and several Linux distributions, with Cygwin support).
- Communication between agents and emulation core can be accomplished through pipes, allowing for cross-language development (sample Java code included).
- Python development is supported through ctypes.
- Agents programmed in C++ have access to all features in the ALE.
- Visualization tools.

## Quick start


Install main dependences:
```
sudo apt-get install libsdl1.2-dev libsdl-gfx1.2-dev libsdl-image1.2-dev cmake
```

Compilation:

```
$ mkdir build && cd build
$ cmake -DUSE_SDL=ON -DUSE_RLGLUE=OFF -DBUILD_EXAMPLES=ON ..
$ make -j 4
```

To install python module:

```
$ pip install .
or
$ pip install --user .
```

Getting the ALE to work on Visual Studio requires a bit of extra wrangling. You may wish to use IslandMan93's [Visual Studio port of the ALE.](https://github.com/Islandman93/Arcade-Learning-Environment)

For more details and installation instructions, see the [manual](doc/manual/manual.pdf). To ask questions and discuss, please join the [ALE-users group](https://groups.google.com/forum/#!forum/arcade-learning-environment).

## ALE releases

Releases before v.0.5 are available for download in our previous [website](http://www.arcadelearningenvironment.org/). For the latest releases, please check our releases [page](https://github.com/mgbellemare/Arcade-Learning-Environment/releases).

## List of command-line parameters

Execute ./ale -help for more details; alternatively, see documentation
available at http://www.arcadelearningenvironment.org.

```
-random_seed [n] -- sets the random seed; defaults to the current time

-game_controller [fifo|fifo_named] -- specifies how agents interact
with the ALE; see Java agent documentation for details

-config [file] -- specifies a configuration file, from which additional
parameters are read

-run_length_encoding [false|true] -- determine whether run-length encoding is
used to send data over pipes; irrelevant when an internal agent is
being used

-max_num_frames_per_episode [n] -- sets the maximum number of frames per
episode. Once this number is reached, a new episode will start. Currently
implemented for all agents when using pipes (fifo/fifo_named)

-max_num_frames [n] -- sets the maximum number of frames (independent of how
many episodes are played)
```


## Citing The Arcade Learning Environment


If you use the ALE in your research, we ask that you please cite the following.

*M. G. Bellemare, Y. Naddaf, J. Veness and M. Bowling. The Arcade Learning Environment: An Evaluation Platform for General Agents, Journal of Artificial Intelligence Research, Volume 47, pages 253-279, 2013.*

In BibTeX format:

```
@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",
}
```


If you use the ALE with sticky actions (flag `repeat_action_probability`), or if you use the different game flavours (mode and difficulty switches), we ask you that you also cite the following:

*M. C. Machado, M. G. Bellemare, E. Talvitie, J. Veness, M. J. Hausknecht, M. Bowling. Revisiting the Arcade Learning Environment: Evaluation Protocols and Open Problems for General Agents, CoRR abs/1709.06009, 2017.*

In BibTex format:

```
@Article{machado17arcade,
author = {Marlos C. Machado and Marc G. Bellemare and Erik Talvitie and Joel Veness and Matthew J. Hausknecht and Michael Bowling},
title = {Revisiting the Arcade Learning Environment: Evaluation Protocols and Open Problems for General Agents},
journal = {CoRR},
volume = {abs/1709.06009},
year = {2017}
}
```
24 changes: 21 additions & 3 deletions atari_py/ale_c_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,25 @@ extern "C" {
int act(ALEInterface *ale,int action){return ale->act((Action)action);}
bool game_over(ALEInterface *ale){return ale->game_over();}
void reset_game(ALEInterface *ale){ale->reset_game();}
void getLegalActionSet(ALEInterface *ale,int *actions){
void getAvailableModes(ALEInterface *ale,int *availableModes) {
ModeVect modes_vect = ale->getAvailableModes();
for(unsigned int i = 0; i < ale->getAvailableModes().size(); i++){
availableModes[i] = modes_vect[i];
}
}
int getAvailableModesSize(ALEInterface *ale) {return ale->getAvailableModes().size();}
void setMode(ALEInterface *ale, int mode) {ale->setMode(mode);}
void getAvailableDifficulties(ALEInterface *ale,int *availableDifficulties) {
DifficultyVect difficulties_vect = ale->getAvailableDifficulties();
for(unsigned int i = 0; i < ale->getAvailableDifficulties().size(); i++){
availableDifficulties[i] = difficulties_vect[i];
}
}
int getAvailableDifficultiesSize(ALEInterface *ale) {return ale->getAvailableDifficulties().size();}
void setDifficulty(ALEInterface *ale, int difficulty) {ale->setDifficulty(difficulty);}
void getLegalActionSet(ALEInterface *ale,int *actions) {
ActionVect action_vect = ale->getLegalActionSet();
for(unsigned int i = 0;i < ale->getLegalActionSet().size();i++){
for(unsigned int i = 0; i < ale->getLegalActionSet().size(); i++){
actions[i] = action_vect[i];
}
}
Expand Down Expand Up @@ -58,9 +74,10 @@ extern "C" {
size_t screen_size = w*h;
pixel_t *ale_screen_data = ale->getScreen().getArray();

ale->theOSystem->colourPalette().applyPaletteRGB(output_buffer, ale_screen_data, screen_size);
ale->theOSystem->colourPalette().applyPaletteRGB(output_buffer, ale_screen_data, screen_size );
}


void getScreenRGB2(ALEInterface *ale, unsigned char *output_buffer){
size_t w = ale->getScreen().width();
size_t h = ale->getScreen().height();
Expand All @@ -76,6 +93,7 @@ extern "C" {
}
}


void getScreenGrayscale(ALEInterface *ale, unsigned char *output_buffer){
size_t w = ale->getScreen().width();
size_t h = ale->getScreen().height();
Expand Down
37 changes: 26 additions & 11 deletions atari_py/ale_interface/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required (VERSION 2.6)
project(ale)
set(ALEVERSION "0.5")
set(ALEVERSION "0.6")


option(USE_SDL "Use SDL" OFF)
Expand All @@ -10,7 +10,7 @@ option(BUILD_CPP_LIB "Build C++ Shared Library" OFF)
option(BUILD_CLI "Build ALE Command Line Interface" OFF)
option(BUILD_C_LIB "Build ALE C Library (needed for Python interface)" ON)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -O3 -fomit-frame-pointer -D__STDC_CONSTANT_MACROS")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fPIC -O3 -fomit-frame-pointer -D__STDC_CONSTANT_MACROS")
add_definitions(-DHAVE_INTTYPES)
set(LINK_LIBS z)

Expand All @@ -28,8 +28,9 @@ if(USE_SDL)
list(APPEND LINK_LIBS ${SDL_LIBRARY} ${SDL_MAIN_LIBRARY})
else()
MESSAGE("SDL 1.2 not found: You may need to manually edit CMakeLists.txt or run \"cmake -i\" to specify your SDL path.")
# Uncomment below to specify the path to your SDL library. Run "locate libSDL" if unsure.
# Uncomment below to specify the path to your SDL library and header file. Run "locate libSDL" and "locate SDL.h" if unsure.
# link_directories(path_to_your_SDL)
# include_directories(path_to_your_SDL_header)
if(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -framework Cocoa")
list(APPEND LINK_LIBS sdl sdlmain)
Expand Down Expand Up @@ -127,10 +128,15 @@ include_directories(
${SOURCE_DIR}/external/TinyMT
)

if(NOT BUILD_CPP_LIB AND BUILD_EXAMPLES)
set(BUILD_CPP_LIB ON)
MESSAGE("Enabling C++ library to support examples.")
endif()

if(BUILD_CPP_LIB)
add_library(ale-lib SHARED ${SOURCE_DIR}/ale_interface.cpp ${SOURCES})
set_target_properties(ale-lib PROPERTIES OUTPUT_NAME ale)
set_target_properties(ale-lib PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
set_target_properties(ale-lib PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
if(UNIX)
install(TARGETS ale-lib
DESTINATION ${LIB_INSTALL_DIR})
Expand All @@ -141,7 +147,7 @@ endif()
if(BUILD_CLI)
add_executable(ale-bin ${SOURCE_DIR}/main.cpp ${SOURCE_DIR}/ale_interface.cpp ${SOURCES})
set_target_properties(ale-bin PROPERTIES OUTPUT_NAME ale)
set_target_properties(ale-bin PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
set_target_properties(ale-bin PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
if(UNIX)
install(TARGETS ale-bin
DESTINATION ${BIN_INSTALL_DIR})
Expand All @@ -152,7 +158,7 @@ endif()
if(BUILD_C_LIB)
add_library(ale-c-lib SHARED ${CMAKE_CURRENT_SOURCE_DIR}/../ale_c_wrapper.cpp ${SOURCE_DIR}/ale_interface.cpp ${SOURCES})
set_target_properties(ale-c-lib PROPERTIES OUTPUT_NAME ale_c)
set_target_properties(ale-c-lib PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
set_target_properties(ale-c-lib PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
if(UNIX)
install(TARGETS ale-c-lib
DESTINATION ${LIB_INSTALL_DIR})
Expand All @@ -164,25 +170,34 @@ if(BUILD_EXAMPLES)
# Shared library example.
link_directories(${CMAKE_CURRENT_SOURCE_DIR})
add_executable(sharedLibraryInterfaceExample ${CMAKE_CURRENT_SOURCE_DIR}/doc/examples/sharedLibraryInterfaceExample.cpp)
set_target_properties(sharedLibraryInterfaceExample PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/doc/examples)
set_target_properties(sharedLibraryInterfaceExample PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/doc/examples)
set_target_properties(sharedLibraryInterfaceExample PROPERTIES OUTPUT_NAME ${PROJECT_NAME}-sharedLibraryInterfaceExample)

target_link_libraries(sharedLibraryInterfaceExample ale)
target_link_libraries(sharedLibraryInterfaceExample ${LINK_LIBS})
add_dependencies(sharedLibraryInterfaceExample ale-lib)

# Fifo interface example.
link_directories(${CMAKE_CURRENT_SOURCE_DIR})

add_executable(fifoInterfaceExample ${CMAKE_CURRENT_SOURCE_DIR}/doc/examples/fifoInterfaceExample.cpp)
set_target_properties(fifoInterfaceExample PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/doc/examples)
set_target_properties(fifoInterfaceExample PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/doc/examples)
set_target_properties(fifoInterfaceExample PROPERTIES OUTPUT_NAME ${PROJECT_NAME}-fifoInterfaceExample)
target_link_libraries(fifoInterfaceExample ale)
target_link_libraries(fifoInterfaceExample ${LINK_LIBS})
add_dependencies(fifoInterfaceExample ale-lib)

add_executable(sharedLibraryInterfaceWithModesExample ${CMAKE_CURRENT_SOURCE_DIR}/doc/examples/sharedLibraryInterfaceWithModesExample.cpp)
set_target_properties(sharedLibraryInterfaceWithModesExample PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/doc/examples)
set_target_properties(sharedLibraryInterfaceWithModesExample PROPERTIES OUTPUT_NAME ${PROJECT_NAME}-sharedLibraryInterfaceWithModesExample)
target_link_libraries(sharedLibraryInterfaceWithModesExample ale)
target_link_libraries(sharedLibraryInterfaceWithModesExample ${LINK_LIBS})
add_dependencies(sharedLibraryInterfaceWithModesExample ale-lib)

# Example showing how to record an Atari 2600 video.
if (USE_SDL)
add_executable(videoRecordingExample ${CMAKE_CURRENT_SOURCE_DIR}/doc/examples/videoRecordingExample.cpp)
set_target_properties(videoRecordingExample PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/doc/examples)
set_target_properties(videoRecordingExample PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/doc/examples)
set_target_properties(videoRecordingExample PROPERTIES OUTPUT_NAME ${PROJECT_NAME}-videoRecordingExample)
target_link_libraries(videoRecordingExample ale)
target_link_libraries(videoRecordingExample ${LINK_LIBS})
Expand All @@ -192,14 +207,14 @@ endif()

if(USE_RLGLUE)
add_executable(RLGlueAgent ${CMAKE_CURRENT_SOURCE_DIR}/doc/examples/RLGlueAgent.c)
set_target_properties(RLGlueAgent PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/doc/examples)
set_target_properties(RLGlueAgent PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/doc/examples)
set_target_properties(RLGlueAgent PROPERTIES OUTPUT_NAME ${PROJECT_NAME}-RLGlueAgent)
target_link_libraries(RLGlueAgent rlutils)
target_link_libraries(RLGlueAgent rlagent)
target_link_libraries(RLGlueAgent rlgluenetdev)

add_executable(RLGlueExperiment ${CMAKE_CURRENT_SOURCE_DIR}/doc/examples/RLGlueExperiment.c)
set_target_properties(RLGlueExperiment PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/doc/examples)
set_target_properties(RLGlueExperiment PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/doc/examples)
set_target_properties(RLGlueExperiment PROPERTIES OUTPUT_NAME ${PROJECT_NAME}-RLGlueExperiment)
target_link_libraries(RLGlueExperiment rlutils)
target_link_libraries(RLGlueExperiment rlexperiment)
Expand Down
Loading