NotAnyMike / gym

An improvement of CarRacing-v0 from OpenAI Gym in order to make the environment complex enough for Hierarchical Reinforcement Learning
https://notanymike.github.io/
Other
69 stars 25 forks source link

CarRacing-v1

An improvement over OpenAI gym Car-Racing-v0

This repo has improvements on the complexity for CarRacing-v0, which are focus torwards making Car-Racing env solvable, it s also intended to make the env complex enought to make it ideal to try new more complex tasks and RL problems.

Installation

Clone this repo and pip install -e ."[Box2D]" it is likely that you will need to install pyglet 1.3.2, use pip install pyglet==v1.3.2 for that.

New Features

The new environment has some improvements regarding the complexity of the map, the action space and the observation space, let's start with the most useful changes

New Features in action_space

The action space can be:

New Features in observation_space

The observation space, i.e. the state (the raw pixels of the game), can be:

some screenshots of some of the possible states (in real size i.e. 96x96):

rbg_bar rbg b&w

New Features regarding the Map

The map of the track now is configurable but still completely random, now the map can be configurable with

t y y y

map map map map

obstacle obstacle

New Features regarding Reward Function

New Features regarding Agent (i.e. car)

Features regarding debugging

and in general de controls are (while playing)

key Action
D Set trace (debug)
R Reset the map
Z Zoom in/out
G Shows the intersection groups
I Shows intersection points
X Shows X junctions
E Shows end of track
S Shows start of track
T Take screenshot
Q Exit

Some other interesting features

Useful functions

This list is far from comprehensive. This are some improvements of the environment, this allows configures each experiments depending on the objective

List

Name params Description
play env,discretize Opens a windows in which you can play this game
set_speed speed Set the speed of the car
place_agent position Set the agent in position
screenshot dest, name Saves the current state/observations of the agent in dest with name name
get_rnd_point_in_track border Gets a random position inside the track (touching or not the border)
get_position_near_junction type_junction, tiles_before Returns a position tiles_before tiles before the type_junction junction
get_position_outside distance Returns a position outside the track distance meters far from track
set_press_fn fn Will call this function everytime a key is press in the window of the game. Do not use it while using play
set_release_fn fn Will call this function everytime a key is release in the window of the game. Do not use it while using play

Things to do or done:

high priority:

low priority:


for more information about the environment see the original readme file of the original repo or the code, most functions have descriptions and explanaitions.