How to use the vizdoom.ScreenFormat.CRCGCB 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 mihahauke / VDAIC2017 / intelact / IntelAct_track2 / agent / doom_simulator.py View on Github external
self._game.load_config(self.config)
        self._game.add_game_args(self.game_args)

        if 'ticrate' in args:
            self._game.set_ticrate(args['ticrate'])

        # set resolution
        try:
            self._game.set_screen_resolution(getattr(vizdoom.ScreenResolution, 'RES_%dX%d' % self.resolution))
        except:
            print("Requested resolution not supported:", sys.exc_info()[0])
            raise

        # set color mode
        if self.color_mode == 'RGB':
            self._game.set_screen_format(vizdoom.ScreenFormat.CRCGCB)
            self.num_channels = 3
        elif self.color_mode == 'GRAY':
            self._game.set_screen_format(vizdoom.ScreenFormat.GRAY8)
            self.num_channels = 1
        else:
            print("Unknown color mode")
            raise

        self.available_controls, self.continuous_controls, self.discrete_controls = self.analyze_controls(self.config)
        self.num_buttons = self._game.get_available_buttons_size()
        assert (self.num_buttons == len(self.discrete_controls) + len(self.continuous_controls))
        assert (len(self.continuous_controls) == 0)  # only discrete for now
        self.num_meas = self._game.get_available_game_variables_size()

        self.game_initialized = False
github intel-isl / DirectFuturePrediction / DFP / doom_simulator.py View on Github external
self._game.add_game_args(self.game_args)
        self.curr_map = 0
        self._game.set_doom_map(self.maps[self.curr_map])
        
        # set resolution
        try:
            self._game.set_screen_resolution(getattr(vizdoom.ScreenResolution, 'RES_%dX%d' % self.resolution))
            self.resize = False
        except:
            print("Requested resolution not supported:", sys.exc_info()[0], ". Setting to 160x120 and resizing")
            self._game.set_screen_resolution(getattr(vizdoom.ScreenResolution, 'RES_160X120'))
            self.resize = True

        # set color mode
        if self.color_mode == 'RGB':
            self._game.set_screen_format(vizdoom.ScreenFormat.CRCGCB)
            self.num_channels = 3
        elif self.color_mode == 'GRAY':
            self._game.set_screen_format(vizdoom.ScreenFormat.GRAY8)
            self.num_channels = 1
        else:
            print("Unknown color mode")
            raise

        self.available_controls, self.continuous_controls, self.discrete_controls = self.analyze_controls(self.config)
        self.num_buttons = self._game.get_available_buttons_size()
        assert(self.num_buttons == len(self.discrete_controls) + len(self.continuous_controls))
        assert(len(self.continuous_controls) == 0) # only discrete for now
        self.num_meas = self._game.get_available_game_variables_size()
            
        self.meas_tags = []
        for nm in range(self.num_meas):
github mwydmuch / ViZDoom / examples / python / fps.py View on Github external
# 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."
                             " Please see "