Exemple #1
0
 def __init__(
         self,
         session,
         num_actions,
         input_formatter_info=[0, 0],
         player_index=-1,
         action_handler=None,
         is_training=False,
         optimizer=tf.train.GradientDescentOptimizer(learning_rate=0.1),
         summary_writer=None,
         summary_every=100,
         config_file=None):
     super().__init__(session,
                      num_actions,
                      input_formatter_info=input_formatter_info,
                      player_index=player_index,
                      action_handler=action_handler,
                      is_training=is_training,
                      optimizer=optimizer,
                      summary_writer=summary_writer,
                      summary_every=summary_every,
                      config_file=config_file)
     if player_index >= 0:
         self.rotating_expected_reward_buffer = live_data_util.RotatingBuffer(
             player_index)
Exemple #2
0
    def __init__(self, name, team, index, bot_parameters=None):
        self.last_frame_time = None
        self.config_file = bot_parameters
        self.index = index
        self.load_config_file()
        self.reward_manager = reward_manager.RewardManager()
        config = tf.ConfigProto(device_count={'GPU': 0})
        self.sess = tf.Session(config=config)
        # self.sess = tf.Session()
        self.actions_handler = action_factory.get_handler(
            control_scheme=self.control_scheme)
        self.num_actions = self.actions_handler.get_logit_size()
        print('num_actions', self.num_actions)

        self.model = self.model_class(self.sess,
                                      self.num_actions,
                                      input_formatter_info=[team, index],
                                      player_index=self.index,
                                      action_handler=self.actions_handler,
                                      config_file=bot_parameters,
                                      is_training=False)

        self.model.add_summary_writer('random_packet', is_replay=True)

        self.model.batch_size = 1
        self.model.mini_batch_size = 1

        self.model.is_graphing = self.is_graphing

        self.model.is_online_training = self.is_online_training

        self.model.apply_feature_creation(TensorflowFeatureCreator())

        try:
            self.model.create_model(self.model.get_input_placeholder())
        except TypeError as e:
            raise Exception('failed to create model') from e

        if self.model.is_training and self.model.is_online_training:
            self.model.create_reinforcement_training_model()

        self.model.create_savers()

        self.model.initialize_model()
        if self.is_graphing:
            self.rotating_real_reward_buffer = live_data_util.RotatingBuffer(
                self.index + 10)
Exemple #3
0
    return p6, blue_curve, orng_curve

#QtGui.QApplication.setGraphicsSystem('raster')
app = QtGui.QApplication([])
#mw = QtGui.QMainWindow()
#mw.resize(800,800)

win = pg.GraphicsWindow(title="RLBot Live Plotting")
win.resize(500, 300)
win.setWindowTitle('RLBot Live Plotting')

# Enable antialiasing for prettier plots
pg.setConfigOptions(antialias=True)

# Open shared memory rotating buffer
expected_reward_blue_0 = live_data_util.RotatingBuffer(0)
expected_reward_orange_0 = live_data_util.RotatingBuffer(1)
real_reward_blue_0 = live_data_util.RotatingBuffer(10)
real_reward_orange_0 = live_data_util.RotatingBuffer(11)

realPlot, real_blue, real_orange = create_plot("RLBot Real Rewards")
expectedPlot, expected_blue, expected_orange = create_plot("RLBot Expected Rewards")
def update():
    global realPlot, real_blue, real_orange, expectedPlot, expected_blue, expected_orange
    expected_blue.setData(expected_reward_blue_0.get_current_buffer())
    expected_orange.setData(expected_reward_orange_0.get_current_buffer())
    real_blue.setData(real_reward_blue_0.get_current_buffer())
    real_orange.setData(real_reward_orange_0.get_current_buffer())

timer = QtCore.QTimer()
timer.timeout.connect(update)