How to use the openai.StructConv function in openai

To help you get started, we’ve selected a few openai examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vladfi1 / phillip / openai.py View on Github external
playerConv = StructConv(player_spec)

def gameSpec(self=0, enemy=1, swap=False):
  players = [self, enemy]
  if swap:
    players.reverse()
  
  return [
    ('players', ArrayConv(playerConv, players)),
    ('stage', DiscreteConv(32)),
  ]

game_spec = gameSpec()
gameConv = StructConv(game_spec)

gameConv1 = StructConv(gameSpec(swap=True))

default_args = dict(
  tag=None,
  dolphin_dir = 'dolphin/',
  self_play = True,
  act_every=3, # fastest short-hop timing window
  zmq=True,
  p1="marth",
  p2="zelda",
  stage="battlefield",
)

class SmashEnv(gym.Env):
  def __init__(self, **kwargs):
    for k, v in default_args.items():
      if k in kwargs and kwargs[k] is not None:
github vladfi1 / phillip / openai.py View on Github external
]

playerConv = StructConv(player_spec)

def gameSpec(self=0, enemy=1, swap=False):
  players = [self, enemy]
  if swap:
    players.reverse()
  
  return [
    ('players', ArrayConv(playerConv, players)),
    ('stage', DiscreteConv(32)),
  ]

game_spec = gameSpec()
gameConv = StructConv(game_spec)

gameConv1 = StructConv(gameSpec(swap=True))

default_args = dict(
  tag=None,
  dolphin_dir = 'dolphin/',
  self_play = True,
  act_every=3, # fastest short-hop timing window
  zmq=True,
  p1="marth",
  p2="zelda",
  stage="battlefield",
)

class SmashEnv(gym.Env):
  def __init__(self, **kwargs):
github vladfi1 / phillip / openai.py View on Github external
('character', DiscreteConv(maxCharacter, 'character')),
  ('invulnerable', boolConv),
  ('hitlag_frames_left', frameConv),
  ('hitstun_frames_left', frameConv),
  ('jumps_used', DiscreteConv(8, 'jumps_used')),
  ('charging_smash', boolConv),
  ('in_air', boolConv),
  ('speed_air_x_self', speedConv),
  ('speed_ground_x_self', speedConv),
  ('speed_y_self', speedConv),
  ('speed_x_attack', speedConv),
  ('speed_y_attack', speedConv),
  ('shield_size', RealConv(0, 1)),
]

playerConv = StructConv(player_spec)

def gameSpec(self=0, enemy=1, swap=False):
  players = [self, enemy]
  if swap:
    players.reverse()
  
  return [
    ('players', ArrayConv(playerConv, players)),
    ('stage', DiscreteConv(32)),
  ]

game_spec = gameSpec()
gameConv = StructConv(game_spec)

gameConv1 = StructConv(gameSpec(swap=True))