Genvid Project Configuration Overview

Genvid Project

A genvid project is set of artifacts, scripts and settings for a particular game. The structure is simple: it is just a folder containing a specific configuration file. For example, to load the tutorial project, run the following command under the installation directory:

py local.py load-project samples/tutorial

When specifying a project directory path, the script will look for a genvid.hcl file, or fallback to a genvid.json file. The script also accepts project file paths directly.

The project file will be first be rendered by consul-template, and then interpreted as either a JSON or HCL, depending on the extension. More details on the project file are available in the chapter Genvid Project.

The result of will then be saved under config/_local.json for reference, but it will not be accessed further. Should you need the system to read it again, you can run the command:

py local.py reload-project

Note that everytime a project file is reloaded, all running services are stopped and all settings are cleared. This is to prevent confusion between the different settings that could lead to corrupted behaviour.

The Key-Value Store

Most of the Genvid settings are stored in Consul’s Key Value Store. This allow for easy access and modification from all services as well as from the web interface using py local.py monitor. Consul also has an extensive HTTP API which allows various applications and libraries to view, edit and watch for changes.

For populating the storage, we are using two sets of configuration files, each located inside a config folder. The first one is under the actual project directory (see Genvid Project Configuration Overview section), and the second one under the installation folder of the SDK.

Each folder is looked up in order for files with the extension .hcl. The configuration files are in the Hashicorp Configuration Language. Every key is interpreted according to its value type: Object values are converted to folder, while other keys are converted to string before being written in the key store. For example, the following HCL configuration:

a_folder {
   a_string = "hello"
   a_bool = true
   a_subfolder {
      a_number = 3.2
   }
}

will be converted to the following key-value pairs:

a_folder/: folder
a_folder/a_string: "hello"
a_folder/a_bool: "true"
a_folder/a_subfolder/: folder
a_folder/a_subfolder/a_number: "3.2"

Arrays aren’t supported right now.

You can load the configuration files using the command:

py local.py config

The files from the project configuration are loaded first, followed by the ones from the SDK root directory, with newer values overriding previous ones. If multiple files are present in one folder, they are loaded in alphabetical order, with the same overriding rules.

Other commands exist to manipulate the settings. The command show-config will display the configuration in the key-value store in JSON format, clear-config will clear it, and reload-config will clear it and reload it from the original files. You can also add or modify key-values manually using either the consul commandline tool directly, or the web interface provide by py local.py monitor.

Configuration Settings

All Genvid specific settings are under the genvid root folder. We also use local and cloud for settings specific to the local.py and cloud.py script. Feel free to add your own. We suggest you to set the default values for your project under the project configuration folder, and the settings for your particular instance under the SDK configuration folder. This way, the latter will override the former.

Assuming you followed every step, your SDK configuration folder should contain a file named stream.hcl containing your Registration settings. There are other settings you can specify. Particularly, you should set the genvid/encode/input/width and genvid/encode/video/height to set values proper to your game, the default being 1920x1080. For the tutorial, we already set this to 1280x720, the value used for the game.

If your bandwidth is limited, you can reduce the size and quality by lowering resolution and video bitrate, e.g.:

genvid {
  encode {
    output {
      vbitrate = 500000
      width = 640
      height = 360
    }
  }
}