Git Product home page Git Product logo

vizdoomgym's People

Contributors

bionicles avatar garethjns avatar shakenes avatar zuoxingdong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

vizdoomgym's Issues

Monitor class not working - how to visualize?

Hi

My model has trained on the vizdoomgym environment, but how do you recommend we visualize gameplay results?
I've tried wrapping the environment in the monitor class, but this returns "Could not find video" as an error, as defined in show_video(). Same code works fine for OpenAI's default gyms.

Any help is appreciated!

def show_video():
  mp4list = glob.glob('video/*.mp4')
  if len(mp4list) > 0:
    mp4 = mp4list[0]
    video = io.open(mp4, 'r+b').read()
    encoded = base64.b64encode(video)
    ipythondisplay.display(HTML(data='''<video alt="test" autoplay 
                loop controls style="height: 400px;">
                <source src="data:video/mp4;base64,{0}" type="video/mp4" />
             </video>'''.format(encoded.decode('ascii'))))
  else: 
    print("Could not find video")
    

def wrap_env(env):
  env = Monitor(env, './video', force=True)
  return env
environment = wrap_env(env)
done = False
observation = environment.reset()
new_observation = observation

prev_input = None


environment = wrap_env(env)
done = False
observation = environment.reset()
new_observation = observation

prev_input = None
with tf.compat.v1.Session() as sess:
    init.run()
    observation, stacked_frames = stack_frames(stacked_frames, observation, True)
    
    while True:
       
    
        #set input to network to be difference image
  
        
        #print(observation.shape)
        
        

        # feed the game screen and get the Q values for each action
        actions = mainQ_outputs.eval(feed_dict={X:[observation], in_training_mode:False})

        # get the action
        action = np.argmax(actions, axis=-1)
        actions_counter[str(action)] += 1 

        # select the action using epsilon greedy policy
        action = epsilon_greedy(action, global_step)
        environment.render()
        new_observation, stacked_frames = stack_frames(stacked_frames, new_observation, False)
        
        observation = new_observation        
        # now perform the action and move to the next state, next_obs, receive reward
        new_observation, reward, done, _ = environment.step(action)
        
       
        if done: 
          
          break
      
    environment.close()
    show_video()

No registered env with id: VizdoomBasic-v0

Hi,

Not sure if this is maintained any longer, but attempting to run your VizDoomBasic in a online Colaboratory notebook following your tutorial yields the error "No registered env with id: VizdoomBasic-v0"

How to install on windows ?

Could you please tell us how to install this on windows since we can only see instruction for linux but any for windows?

Error on env.render()

import gym
import vizdoomgym
env = gym.make("VizdoomBasic-v0")
env.reset()
env.render()
env.env.close()

Generates the error:

Exception ignored in: <bound method SimpleImageViewer.__del__ of <gym.envs.classic_control.rendering.SimpleImageViewer object at 0x7fa15f523a90>>
Traceback (most recent call last):
  File "/home/colin/py3/lib/python3.6/site-packages/gym/envs/classic_control/rendering.py", line 359, in __del__
  File "/home/colin/py3/lib/python3.6/site-packages/gym/envs/classic_control/rendering.py", line 355, in close
  File "/home/colin/py3/lib/python3.6/site-packages/pyglet/window/xlib/__init__.py", line 480, in close
  File "/home/colin/py3/lib/python3.6/site-packages/pyglet/gl/xlib.py", line 345, in destroy
  File "/home/colin/py3/lib/python3.6/site-packages/pyglet/gl/base.py", line 334, in destroy
  File "/home/colin/py3/lib/python3.6/site-packages/pyglet/gl/xlib.py", line 335, in detach
  File "/home/colin/py3/lib/python3.6/site-packages/pyglet/gl/lib.py", line 97, in errcheck
ImportError: sys.meta_path is None, Python is likely shutting down

step() returns old observation

I noticed that in the step function the state is recorded before the action is taken.
Which means that the observation returned is one step old and doesn't correspond to the current state.
Easy enough to fix by simply putting self.state = self.game.get_state() after reward = self.game.make_action(act).

Error during running

the code is as follows:

import gym
import vizdoomgym

env = gym.make('VizdoomBasic-v0')

File ".../vizdoomgym/vizdoomgym/envs/vizdoomenv.py", line 3, in
import vizdoom.vizdoom as vzd
ModuleNotFoundError: No module named 'vizdoom'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.