How to use the vizdoom.ScreenResolution.RES_320X240 function in vizdoom

To help you get started, we’ve selected a few vizdoom 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 NervanaSystems / coach / environments / doom_environment_wrapper.py View on Github external
EnvironmentWrapper.__init__(self, tuning_parameters)

        # load the emulator with the required level
        self.level = DoomLevel().get(self.tp.env.level)
        self.scenarios_dir = path.join(environ.get('VIZDOOM_ROOT'), 'scenarios')
        self.game = vizdoom.DoomGame()
        self.game.load_config(path.join(self.scenarios_dir, self.level))
        self.game.set_window_visible(False)
        self.game.add_game_args("+vid_forcesurface 1")

        self.wait_for_explicit_human_action = True
        if self.human_control:
            self.game.set_screen_resolution(vizdoom.ScreenResolution.RES_640X480)
            self.renderer.create_screen(640, 480)
        elif self.is_rendered:
            self.game.set_screen_resolution(vizdoom.ScreenResolution.RES_320X240)
            self.renderer.create_screen(320, 240)
        else:
            # lower resolution since we actually take only 76x60 and we don't need to render
            self.game.set_screen_resolution(vizdoom.ScreenResolution.RES_160X120)

        self.game.set_render_hud(False)
        self.game.set_render_crosshair(False)
        self.game.set_render_decals(False)
        self.game.set_render_particles(False)
        self.game.init()

        # action space
        self.action_space_abs_range = 0
        self.actions = {}
        self.action_space_size = self.game.get_available_buttons_size() + 1
        self.action_vector_size = self.action_space_size - 1
github NervanaSystems / coach / rl_coach / environments / doom_environment.py View on Github external
self.scenarios_dir = local_scenarios_path
        elif 'VIZDOOM_ROOT' in environ:
            self.scenarios_dir = path.join(environ.get('VIZDOOM_ROOT'), 'scenarios')
        else:
            self.scenarios_dir = path.join(os.path.dirname(os.path.realpath(vizdoom.__file__)), 'scenarios')

        self.game = vizdoom.DoomGame()
        self.game.load_config(path.join(self.scenarios_dir, self.level.value))
        self.game.set_window_visible(False)
        self.game.add_game_args("+vid_forcesurface 1")

        self.wait_for_explicit_human_action = True
        if self.human_control:
            self.game.set_screen_resolution(vizdoom.ScreenResolution.RES_640X480)
        elif self.is_rendered:
            self.game.set_screen_resolution(vizdoom.ScreenResolution.RES_320X240)
        else:
            # lower resolution since we actually take only 76x60 and we don't need to render
            self.game.set_screen_resolution(vizdoom.ScreenResolution.RES_160X120)

        self.game.set_render_hud(False)
        self.game.set_render_crosshair(False)
        self.game.set_render_decals(False)
        self.game.set_render_particles(False)
        for camera in self.cameras:
            if hasattr(self.game, 'set_{}_enabled'.format(camera.value[1])):
                getattr(self.game, 'set_{}_enabled'.format(camera.value[1]))(True)
        self.game.init()

        # actions
        actions_description = ['NO-OP']
        actions_description += [str(action).split(".")[1] for action in self.game.get_available_buttons()]
github chainer / chainerrl / chainerrl / envs / doom_env.py View on Github external
game.set_seed(seed)

        # Load a config file
        game.load_config(os.path.join(
            vizdoom_dir, "examples", 'config', scenario + '.cfg'))

        # Replace default relative paths with actual paths
        game.set_vizdoom_path(os.path.join(vizdoom_dir, "bin/vizdoom"))
        game.set_doom_game_path(
            os.path.join(vizdoom_dir, 'scenarios/freedoom2.wad'))
        game.set_doom_scenario_path(
            os.path.join(vizdoom_dir, 'scenarios', scenario + '.wad'))

        # Set screen settings
        resolutions = {640: ScreenResolution.RES_640X480,
                       320: ScreenResolution.RES_320X240,
                       160: ScreenResolution.RES_160X120}
        game.set_screen_resolution(resolutions[resolution_width])
        game.set_screen_format(ScreenFormat.RGB24)
        game.set_window_visible(window_visible)
        game.set_sound_enabled(window_visible)

        game.init()
        self.game = game

        # Use one-hot actions
        self.n_actions = game.get_available_buttons_size()
        self.actions = []
        for i in range(self.n_actions):
            self.actions.append([i == j for j in range(self.n_actions)])
github mwydmuch / ViZDoom / examples / python / fps.py View on Github external
# It should give you some idea how fast the framework can work on
# your hardware. The test involes copying the state to make it more 
# simillar to any reasonable usage. Comment the line with get_state 
# to exclude copying process.
#####################################################################

from __future__ import print_function

from random import choice
from time import time
import vizdoom as vzd
from argparse import ArgumentParser
import tqdm

# Options:
resolution = vzd.ScreenResolution.RES_320X240
screen_format = vzd.ScreenFormat.CRCGCB
depth_buffer = False
labels_buffer = False
automap_buffer = False

#####################################################################
DEFAULT_CONFIG = "../../scenarios/basic.cfg"
DEFAULT_ITERATIONS = 10000

if __name__ == "__main__":

    parser = ArgumentParser("ViZDoom example showing possible framerates.")
    parser.add_argument(dest="config",
                        default=DEFAULT_CONFIG,
                        nargs="?",
                        help="Path to the configuration file of the scenario."