Genvid - Home

Download SDK
Register to Download SDK
Register

Genvid Tutorial Video 3: How to Set Up a Local GenvidServices Development Environment

(This is the third in a four-part series; click to jump to posts 1, 2, and 4)

SDK Setup

At the end of the process, you will be able to launch the Genvid Services and play the GenvidTanksSample Unity project while viewing it via a web stream broadcast from our local machine.

1. First, register an account and download the SDK from Genvid Technologies.

2. Run the installer and choose the option to install the Complete SDK. The installer will install a few dependencies such as TightVNC, AWS Command Line Client, Node JS, Visual C++, and Python 3.5.4.

3. If you need to install Python as part of the installation, ensure that the ‘Add Python 3.5 to PATH’ is checked as the Genvid SDK requires Python to be able to execute commands from a terminal instance. If you already have Python installed, ensure that the Python scripts directory is available in your path by viewing the environment variables in the Environment Variables window or in PowerShell by using the command $ENV:PATH.

4. If you’re prompted to install NodeJS, proceed with a standard installation and ensure that the feature “Add to PATH” is selected. Perform the same steps for the remainder of the dependencies that need to be installed on your local machine.

 

Environment and Project Prep

5. Open a Windows PowerShell instance by pressing the Windows and R keys and typing “PowerShell”.
 

6. In PowerShell, navigate to the SDK directory at C:\Genvid:

cd "C:\Genvid\Genvid\Genvid Technologies SDK 1.21.2.103"

Note: Adjust the version number to the same as the version installed on your machine.

7. Install the Genvid toolbox

py install-toolbox.py --user

8. The Unity GenvidTanksSample project should be located at C:\Genvid. Locate the GenvidServices.zip file in the GenvidTanksSample project in the Assets\Genvid directory in Windows Explorer. Alternatively, in the Unity project, open the Genvid folder in Windows Explorer by right clicking in the project-view and selecting ‘Show in Explorer’.
 

9. Move the GenvidServices.zip to the directory above the Unity project and unzip the contents. Now the C:\Genvid directory has the below contents:

In order to run the full solution, you need to create an executable build of the Unity game. In order to do that, you need to make sure that the GenvidTanksScene has been added to the Build Settings Window in Unity.

10. In Unity, go to File > Build Settings. With the window open, click Add Open Scenes to add this scene to our executable build. With that done save the scene and close the Unity Editor.

Now we need to modify a configuration file so that GenvidServices knows where to locate the build for our Unity project.

11. Go to the C:\Genvid\GenvidServices\config directory and open the hcl file with a text editor. In the config scope, change the path variable to match the location and name of your build.

path = "{{env `UNITYPROJECTROOT` | js}}\\Build\\GenvidTanksSample.exe"

Now, let’s head to PowerShell and add the location of our installation of Unity 2018.4 and the Unity project to the environment variables so that the Python script can launch the editor and kick off the build process automatically. This is important because the version of the editor that you provide the path to is the one that will be launched in the coming steps.

12. In PowerShell, type the below commands:

$ENV:PATH="$ENV:PATH;C:\path\to\Unity\Unity.exe"
$ENV:UNITYPROJECTROOT="C:\Genvid\GenvidTanksSample"

 

Build The Game

13. In PowerShell, go to the directory C:\Genvid\GenvidServices and run. This script will build the game and the web service itself, defaulting to a local build. The build command also requires the Unity editor to close – so close Unity if it is still open.

py .\unity.py build

 

Bastion

A bastion is a specialized service that is only part of a network system that has certain functionalities which are exposed outside of the network. It monitors traffic and prevents malicious traffic from accessing vital parts of the internal system, therefore minimizing the risk of attacks.

The bastion supervises other services the SDK needs and allows you, the developer, to monitor their health and status. For more information about its API and how to extend the services, please refer to the documentation here.

14. In PowerShell, run the below command to start up a local bastion server with the name ‘localbastion’. By default, you can find the newly installed server in the local user’s home directory in the .genvid folder.

genvid-bastion install --bastionid localbastion --loadconfig

15. To set up the bastion, run:

genvid-sdk setup

16. Clean any old configurations:

genvid-sdk clean-config

17. Next, load in a new blank configuration by running:

genvid-sdk load-config-sdk

 

Cluster UI

The Cluster UI is where you can find useful information about your server such as what jobs are running and their health, settings and logs.

18. Boot up Cluster UI by running:

genvid-sdk monitor

19. Please note that the Cluster UI works best in Chrome. If the Cluster UI does not open automatically, open Chrome and go to http://[::1]:8092/.

20. Make sure that Javascript is enabled in Chrome in settings by going to chrome://settings/.

 

Run The Game

21. Load the game into the server by running:

py .\genvid-project.py load

22. Start the Genvid Services by either typing ‘genvid-sdk start’ or by going to the Cluster UI “Jobs” page and clicking “Start All”. It’s also worth noting that the Genvid Services can be started from the game automatically if the “Activate SDK” field of the GenvidSessionManager is set to “true”, or by clicking the “Start All” button in the Genvid Window in Unity. Next, find the links for the admin user and live stream on the Console UI.”

genvid-sdk start

Now that you have the local environment set up and running, you’ll find that the Genvid SDK is composed of three major parts. The spectator game-client, which renders and streams the view of the game that viewers will watch. The Genvid Services receive and encode that stream along with data from the game. And lastly, the Genvid Overlay receives the broadcast data and allows viewers to watch and interact with the live stream and the game through it.

It’s worth noting that in the GenvidTanks Sample, both the spectator client and Genvid Services, are running locally for ease of setup. In a production deployment both would be running in the cloud.

Continue to the next tutorial ->