Created
January 4, 2018 09:43
-
-
Save aymen-mouelhi/e53498a8f67488bfb55739764a15b040 to your computer and use it in GitHub Desktop.
Multi Threaded Gym Environment - Extract
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if __name__ == '__main__': | |
env = gym.make('Mario-Kart-Luigi-Raceway-Multi-v0') | |
obs = env.reset() | |
env.render() | |
while not end_episode: | |
# Action should be multi-threaded + setting agent | |
for i in range(num_agents): | |
agent = i+1 | |
# Set current agent | |
CurrentAgent.set_current_agent(agent) | |
# CReate Thread | |
thread = AgentThread(target=get_action, args=(agent, obs,actors[i],)) | |
thread.start() | |
# Get action | |
action = thread.join() | |
# cprint('[Gym Thread] Got action %s for agent %i' %((action,agent)),'red') | |
obs, reward, end_episode, info = env.step(action) | |
env.render() | |
#self.queue.put('render') | |
total_reward += reward |
I'm looking for the same thing. Also end_episode is not defined.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello, I was wondering if you could share where the modified multiplayer environment code used is being pulled from? I had a look in gym-mupen64plus and while I see the MarioKart environment I don't believe I'm finding the multi environment you're using.