Car Racing#

../../../_images/car_racing.gif

This environment is part of the Box2D environments. Please read that page first for general information.

Action Space

Box([-1. 0. 0.], 1.0, (3,), float32)

Observation Shape

(96, 96, 3)

Observation High

255

Observation Low

0

Import

gym.make("CarRacing-v1")

Description#

The easiest continuous control task to learn from pixels - a top-down racing environment. Discrete control is reasonable in this environment as well; on/off discretization is fine.

The game is solved when the agent consistently gets 900+ points. The generated track is random every episode.

Some indicators are shown at the bottom of the window along with the state RGB buffer. From left to right: true speed, four ABS sensors, steering wheel position, and gyroscope. To play yourself (it’s rather fast for humans), type:

python gym/envs/box2d/car_racing.py

Remember: it’s a powerful rear-wheel drive car - don’t press the accelerator and turn at the same time.

Action Space#

There are 3 actions: steering (-1 is full left, +1 is full right), gas, and breaking.

Observation Space#

State consists of 96x96 pixels.

Rewards#

The reward is -0.1 every frame and +1000/N for every track tile visited, where N is the total number of tiles visited in the track. For example, if you have finished in 732 frames, your reward is 1000 - 0.1*732 = 926.8 points.

Starting State#

The car starts at rest in the center of the road.

Episode Termination#

The episode finishes when all of the tiles are visited. The car can also go outside of the playfield - that is, far off the track, in which case it will receive -100 reward and die.

Arguments#

There are no arguments supported in constructing the environment.

Version History#

  • v0: Current version

References#

  • Chris Campbell (2014), http://www.iforce2d.net/b2dtut/top-down-car.

Credits#

Created by Oleg Klimov