Games Academy – PRO 2017 BER – CR350

Below you will find links to the presentation given and resources used for CR350 (Web Advanced) at Games Academy Berlin.

Important: Select your engine of choice

Both engines can be set up for this project simultaniously. Simply follow the guide a second time and change the active engine.


Presentation

…can be found on Google Sheets. (spoilers!)

Requirements

Verify tools are installed correctly

Below you will find a series of command line commands.

Open a command line prompt anywhere (hit Windows + R, enter cmd), enter the code inside the highlighted blocks and compare the resulting text with the darker code block of each pair.

wmic datafile where "drive='c:' and path='\\Program Files\\Unity\\Editor\\' and extension='exe' and version is not null" get Name, Version
Name                                         Version
c:\program files\unity\editor\uninstall.exe  2018.2.11.0
c:\program files\unity\editor\unity.exe      2018.2.11.48509
find /c "4.20" "C:\ProgramData\Epic\UnrealEngineLauncher\LauncherInstalled.dat"
---------- C:\PROGRAMDATA\EPIC\UNREALENGINELAUNCHER\LAUNCHERINSTALLED.DAT: 3

Replace XYZ with the installed Visual Studio version number (VS2015 = 14, VS2017 = 15, etc.)

reg query HKEY_CLASSES_ROOT\VisualStudio.DTE.XYZ.0
HKEY_CLASSES_ROOT\VisualStudio.DTE.XYZ.0
    (Default)    REG_SZ    Microsoft Visual Studio DTE Object
git --version
git version 2.18.0.windows.1
node -v
v10.9.0
npm -v
6.4.1

Setting up projects

Change the working directory or open a new command line window inside an empty folder that should contain the required project files.

Clone the engine project repository

git clone https://github.com/ViMaSter/CS320_2017_Unity.git unity
Cloning into 'unity'...
remote: Enumerating objects: 308, done.
remote: Counting objects: 100% (308/308), done.
remote: Compressing objects: 100% (115/115), done.
remote: Total 308 (delta 195), reused 304 (delta 191), pack-reused 0R
Receiving objects: 100% (308/308), 169.44 KiB | 393.00 KiB/s, done.
Resolving deltas: 100% (195/195), done.

Opening the resulting unity-folder with Unity should result in an error-free project.
Try opening the Scenes/Game-scene and hit the play button at the top of Unity’s toolbar. Verify, that no errors occur inside the console-tab still.

git clone https://github.com/ViMaSter/CS320_2017_UE4.git unreal
Cloning into 'unreal'...
remote: Enumerating objects: 547, done.
remote: Counting objects: 100% (547/547), done.
remote: Compressing objects: 100% (272/272), done.
remote: Total 547 (delta 281), reused 532 (delta 266), pack-reused 0
Receiving objects: 100% (547/547), 9.20 MiB | 5.20 MiB/s, done.
Resolving deltas: 100% (281/281), done.
Checking out files: 100% (621/621), done.

Inside the unreal folder you should find a C++-only (cpp_prj) and a Blueprint-only (bp_prj) project.
Both can be started the same way:

  1. Right-click the .uproject-file and select Generate Visual Studio project files
  2. Open the generated .sln-file in Visual Studio
  3. Right click the prj project inside the Solution Explorer window and select Set as StartUp project
  4. Build and run the solution

Important: This step is also required once for the blueprint-only project, as we’re making use of an Unreal Engine Plugin. (The plugin itself can be accessed through Blueprint and you can work without Visual Studio and modifying any sort of source code from this point on.)
If you’ve successfully opened the editor once using Visual Studio, you can now choose to open the editor directly (without Visual Studio) by double-clicking the .uproject file.

Clone the server repository

git clone https://github.com/ViMaSter/CS320_2017_Server.git server
Cloning into 'server'...
remote: Enumerating objects: 33, done.
remote: Counting objects: 100% (33/33), done.
remote: Compressing objects: 100% (14/14), done.
remote: Total 33 (delta 14), reused 33 (delta 14), pack-reused 0
Unpacking objects: 100% (33/33), done.
cd server
npm install
> websocket@1.0.28 install [YOURPATH]\server\\node_modules\websocket
> (node-gyp rebuild 2> builderror.log) || (exit 0)


[YOURPATH]\server\node_modules\websocket>if not defined npm_config_node_gyp (node "C:\Users\[USERNAME]\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Users\[USERNAME]\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )

> CS3202017DemoServer@0.1.0 prepare [YOURPATH]\server
> npm run build


> CS3202017DemoServer@0.1.0 build [YOURPATH]\server
> tsc

npm WARN CS3202017DemoServer@0.1.0 No description
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

added 870 packages from 504 contributors and audited 22982 packages in 53.9s
found 0 vulnerabilities
npm start
> CS3202017DemoServer@0.1.0 start [YOURPATH]\server
> node build/server.js

[SessionServer] Listening on port 7000...

Once the last line is displayed, everything is successfully set up and you can exit the running server by sending a SIGINT (pressing Ctrl + C) or closing the command prompt window.

Optional: Preperations for modifying server-code

The following line is only required, if work in TypeScript is requested and can also be executed at a later point in time.

npm install -g typescript
[USERNAME]\AppData\Roaming\npm\tsc -> [USERNAME]\AppData\Roaming\npm\node_modules\typescript\bin\tsc
[USERNAME]\AppData\Roaming\npm\tsserver -> [USERNAME]\AppData\Roaming\npm\node_modules\typescript\bin\tsserver
+ typescript@3.3.1
added 1 package from 1 contributor in 1.231s

Reference material

Header file and source file of blueprint library of Websocket plugin – all functions are exposed to C++ too

Usage documentation of websocket-sharp

Data structures and required commands

Example of communication flow

Working in-browser WebSocket-example

Building Unreal Engine 4 in AWS (Amazon Web Services)