How to use the vizdoom.__file__ 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 akolishchak / doom-net-pytorch / src / bt_doom.py View on Github external
def test():

    builder = BTBulder(conditions, actions, goal_defs)
    bt = builder.expand('finished')
    #bt.draw('bt_doom_root.png')

    vizdoom_path = os.path.dirname(vizdoom.__file__)
    config = "../environments/oblige/oblige-map.cfg"

    game_levels = DoomInstanceBt.get_game_levels(config)
    print('Game levels: ', len(game_levels))

    for i, [wad_file, map_id] in enumerate(game_levels):
        print('Playing ''{}'', map{:02d}'.format(wad_file, map_id+1))
        game = DoomInstanceBt(config,
                              vizdoom_path + "/freedoom2.wad",
                              skiprate=4,
                              visible=True,
                              actions=[],
                              id=0,
                              config_wad=wad_file,
                              map_id=map_id
                              )
github akolishchak / doom-net-pytorch / src / main_train_server.py View on Github external
#
import argparse
import os.path
from cuda import *
from aac import AdvantageActorCritic
from aac_lstm import AdvantageActorCriticLSTM
from aac_intrinsic import AdvantageActorCriticIntrinsic
from aac_duel import AdvantageActorCriticDuel
from aac_noisy import AdvantageActorCriticNoisy
from aac_big import AdvantageActorCriticBig
from doom_env import init_doom_env
from train_server import train
import vizdoom

if __name__ == '__main__':
    _vzd_path = os.path.dirname(vizdoom.__file__)
    parser = argparse.ArgumentParser(description='Doom Network')
    parser.add_argument('--learning_rate', type=float, default=1e-4, help='learning rate')
    parser.add_argument('--episode_size', type=int, default=20, help='number of steps in an episode')
    parser.add_argument('--batch_size', type=int, default=20, help='number of game instances running in parallel')
    parser.add_argument('--episode_num', type=int, default=150000, help='number of episodes for training')
    parser.add_argument('--episode_discount', type=float, default=0.95, help='number of episodes for training')
    parser.add_argument('--seed', type=int, default=1, help='seed value')
    parser.add_argument(
        '--model',
        default='aac',
        choices=('aac', 'aac_lstm', 'aac_intrinsic', 'aac_duel', 'aac_noisy', 'aac_big'),
        help='model to work with')
    parser.add_argument('--base_model', default=None, help='path to base model file')
    parser.add_argument('--action_set', default=None, help='model to work with')
    parser.add_argument('--load', default=None, help='path to model file')
    parser.add_argument('--vizdoom_config', default='environments/basic.cfg', help='vizdoom config path')
github akolishchak / doom-net-pytorch / src / main_server.py View on Github external
# Created by Andrey Kolishchak on 01/21/17.
#
import argparse
import os.path
from cuda import *
from aac import AdvantageActorCritic
from aac_lstm import AdvantageActorCriticLSTM
from aac_intrinsic import AdvantageActorCriticIntrinsic
from aac_duel import AdvantageActorCriticDuel
from doom_env import init_doom_env
from train_server import train
from test import test
import vizdoom

if __name__ == '__main__':
    _vzd_path = os.path.dirname(vizdoom.__file__)
    parser = argparse.ArgumentParser(description='Doom Network')
    parser.add_argument('--learning_rate', type=float, default=1e-4, help='learning rate')
    parser.add_argument('--episode_size', type=int, default=30, help='number of steps in an episode')
    parser.add_argument('--batch_size', type=int, default=10, help='number of game instances running in parallel')
    parser.add_argument('--episode_num', type=int, default=15000, help='number of episodes for training')
    parser.add_argument('--episode_discount', type=float, default=0.97, help='number of episodes for training')
    parser.add_argument('--seed', type=int, default=1, help='seed value')
    parser.add_argument('--model', default='aac', choices=('aac', 'aac_lstm', 'aac_intrinsic', 'aac_duel'), help='model to work with')
    parser.add_argument('--base_model', default='aac_model_server_cp_start.pth', help='path to base model file')
    parser.add_argument('--action_set', default='action_set_speed_shot_backward_right.npy', help='model to work with')
    parser.add_argument('--load', default=None, help='path to model file')
    #parser.add_argument('--vizdoom_config', default='environments/basic.cfg', help='vizdoom config path')
    #parser.add_argument('--vizdoom_config', default='environments/rocket_basic.cfg', help='vizdoom config path')
    parser.add_argument('--vizdoom_config', default='environments/cig_server.cfg', help='vizdoom config path')
    #parser.add_argument('--vizdoom_config', default='environments/deathmatch.cfg', help='vizdoom config path')
    # parser.add_argument('--vizdoom_config', default='environments/D3_battle.cfg', help='vizdoom config path')
github NervanaSystems / coach / rl_coach / environments / doom_environment.py View on Github external
def __init__(self, level: LevelSelection, seed: int, frame_skip: int, human_control: bool,
                 custom_reward_threshold: Union[int, float], visualization_parameters: VisualizationParameters,
                 cameras: List[CameraTypes], target_success_rate: float=1.0, **kwargs):
        super().__init__(level, seed, frame_skip, human_control, custom_reward_threshold, visualization_parameters, target_success_rate)

        self.cameras = cameras

        # load the emulator with the required level
        self.level = DoomLevel[level.upper()]
        local_scenarios_path = path.join(os.path.dirname(os.path.realpath(__file__)), 'doom')
        if 'COACH_LOCAL' in level:
            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)
github intel-isl / DirectFuturePrediction / DFP / doom_simulator.py View on Github external
'''
ViZDoom wrapper
'''
from __future__ import print_function
import sys
import os

vizdoom_path = '../../../../toolboxes/ViZDoom_2017_03_31'
sys.path = [os.path.join(vizdoom_path,'bin/python3')] + sys.path

import vizdoom 
print(vizdoom.__file__)
import random
import time
import numpy as np
import re
import cv2

class DoomSimulator:
    
    def __init__(self, args):        
        self.config = args['config']
        self.resolution = args['resolution']
        self.frame_skip = args['frame_skip']
        self.color_mode = args['color_mode']
        self.switch_maps = args['switch_maps']
        self.maps = args['maps']
        self.game_args = args['game_args']
github akolishchak / doom-net-pytorch / src / main.py View on Github external
#
# main.py, doom-net
#
# Created by Andrey Kolishchak on 01/21/17.
#
import argparse
import os.path
from model_utils import get_model
from doom_env import init_doom_env
import vizdoom

if __name__ == '__main__':
    _vzd_path = os.path.dirname(vizdoom.__file__)
    parser = argparse.ArgumentParser(description='Doom Network')
    parser.add_argument('--mode', default='train', choices=('train', 'test'), help='train or test')
    parser.add_argument('--learning_rate', type=float, default=5e-4, help='learning rate')
    parser.add_argument('--episode_size', type=int, default=20, help='number of steps in an episode')
    parser.add_argument('--batch_size', type=int, default=20, help='number of game instances running in parallel')
    parser.add_argument('--episode_num', type=int, default=20000, help='number of episodes for training')
    parser.add_argument('--epoch_game_steps', type=int, default=10000, help='number of steps per epoch')
    parser.add_argument('--episode_discount', type=float, default=0.95, help='number of episodes for training')
    parser.add_argument('--seed', type=int, default=1, help='seed value')
    parser.add_argument(
        '--model',
        default='aac',
        choices=('aac', 'aac_lstm', 'aac_noisy', 'aac_depth', 'aac_map', 'ppo', 'ppo_map', 'ppo_screen', 'mcts', 'state', 'es', 'planner'),
        help='model to work with')
    parser.add_argument('--base_model', default=None, help='path to base model file')
    parser.add_argument('--state_model', default=None, help='path to state model file')