OpenAI Universe
OpenAI Universe provides a wide range of realistic gaming environments. It is an extension to OpenAI Gym. It provides the ability to train and evaluate agents on a wide range of simple to real-time complex environments. It has unlimited access to many gaming environments.Â
Building a video game bot
Let's learn how to build a video game bot which plays a car racing game. Our objective is that the car has to move forward without getting stuck on any obstacles or hitting other cars.
First, we import the necessary libraries:
import gym import universe # register universe environment import random
Then we simulate our car racing environment using the make function:
env = gym.make('flashgames.NeonRace-v0')
env.configure(remotes=1) #automatically creates a local docker containerLet's create the variables for moving the car:
# Move left
left = [('KeyEvent', 'ArrowUp', True), ('KeyEvent', 'ArrowLeft', True),
('KeyEvent', 'ArrowRight', False)]
#Move right
right = [('KeyEvent', 'ArrowUp...