Unreal Engine 4 Genvid Module¶
Introduction¶
The Genvid Module is a standard UE4 module which developers can drop in their UE4 game and very quickly get started with Genvid technologies.
In a certain way, it is the high level parts of the GenvidPlugin. It provides a couple of predefined events and routines that can be used in Blueprint and/or into your C++ code.
It’s highly recommended to use the GenvidPlugin and the Genvid Module together for many reasons:
- Dynamic load/unload of the Plugin.
- Easy On/Off switch of the Plugin.
- Automatic Audio/Video streaming.
- Predefined events and callback
- Blueprint script.
Installation¶
At this point, you have already copied the GenvidPlugin
into your project. Now, you need
to copy the Genvid
directory inside your game’s source code directory
(e.g. UE4_PROJ_ROOT/MyGame/Source
).
Once both directories are copied, you need to modify your game’s build script to use the plugin. This is done by simply adding the following lines:
PrivateIncludePaths.Add("Genvid/Private");
PublicIncludePaths.Add("Genvid/Public");
PublicDependencyModuleNames.Add("Genvid");
to your game’s build script (e.g. UE4_PROJ_ROOT/MyGame/Source/MyGame/MyGame.Build.cs
).
Once that is done, rerun GenerateProjectFiles.bat
, and you should have access to the Genvid module.
Details¶
-
UE4 Genvid Module
-
Genvid/Genvid.Build.cs
This file is needed to integrate Genvid Module inside the Unreal Engine build process.
-
Public folder
-
Genvid/Public/IGenvidModule.h
Class defining standard Unreal Engine module interface of the Plugin.
-
Genvid/Public/GenvidModule.h
Used for including Genvid Module classes definitions.
-
Genvid/Public/GenvidStreamer.h
Implementation of the class events and streams accessible from C++ and Blueprint.
-
Genvid/Public/GenvidJsonUtils.h
Utility class for JSON conversion.
-
Genvid/Public/GenvidTypes.h
Used for specifying a mirror of types from the Genvid Native SDK (genvid.h)
-
Genvid/Public/GenvidWorldSettings.h
Class defining a specialization of AWorldSettings.
-
-
Private folder
-
Genvid/Public/GenvidPrivatePCH.h
Used for specifying optional precompiled headers for faster compiles.
-
Genvid/Public/GenvidModule.cpp
Used for including genvid module classes definitions.
-
Genvid/Public/GenvidStreamer.cpp
Implementation of the class events and streams accessible from c++ and Blueprint.
-
Genvid/Public/GenvidJsonUtils.cpp
Utility class for JSON conversion.
-
Genvid/Public/GenvidTypes.cpp
Used for specifying a mirror of types from the Genvid Native SDK (genvid.h).
-
Genvid/Public/GenvidWorldSettings.cpp
Class implementing a specialization of AWorldSettings.
-
-
-
class
UGenvidStreamer
¶ GenvidStreamer is the base class that allows you to easily create your own framework to manage streams, events and commands.
The events section is triggered automatically by
AGenvidWorldSettings
. The callback section is automatically triggered byUGenvidStreamer
. And the properties are the data settings used byUGenvidStreamer
.Events
-
virtual void
BeginPlay
()¶ Acted as a superset of the AActor BeginPlay. It’s the first function called by
AGenvidWorldSettings
.
-
void
Tick
(float deltaTime)¶ Acted as a superset of a tickable UObject. It’s called as long as the object is alive and it depends directly of
StreamingTickInterval
for the time interval.
-
virtual void
EndPlay
(const EEndPlayReason::Type EndPlayReason)¶ Acted as a superset of the AActor EndPlay. It’s the last function called by
AGenvidWorldSettings
.
-
virtual void
HandleMatchHasStarted
()¶ Triggered when entering into a match. It’s called after
BeginPlay()
and just before the match has started.
-
virtual void
HandleMatchHasEnded
()¶ Triggered when exiting a match. (Actors are still ticking). It’s called just before
EndPlay()
when the match has ended.
Callbacks
-
void
OnGenvidEventCallback
(const FString &EventId, const FGenvidEventSummary &summary)¶ Triggered at any time when an event is sent from the server.
-
void
OnGenvidCommandCallback
(const FString &CommandId, const FString &fullCommand)¶ Triggered at any time when a command is sent from the server.
Properties
-
TArray<FString>
StreamsToCreate
¶ Array of stream ids that contains all the streams you want to create.
-
TArray<FString>
EventsToSubscribe
¶ Array of event ids that contains all the events you want to subscribe to.
-
TArray<FString>
CommandsToSubscribe
¶ Array of command ids that contains all the command you want to subscribe to.
-
bool
bIsStreaming
¶ Readonly Variable to notify if the streaming is currently running.
-
float
StreamingTickInterval
¶ Sets the time interval of the ticking function.
-
bool
bCompressJsonString
¶ Compresses the data of your structure, From JSON to ZIP.
-
virtual void
-
class
AGenvidWorldSettings
: public AWorldSettings¶ The class is a superset of AWorldSettings. The goal of this class is to split streams in two parts.
The first part is to manage automatically the life cycle of the audio/video stream. The second part is to manage custom stream/events/commands of
UGenvidStreamer
objects.Before any
UGenvidStreamer
objects was called,AGenvidWorldSettings
automatically callsStartup()
. When the match has ended,AGenvidWorldSettings
automatically callsShutdown()
.To modify the properties you can access them in the “World Settings” window of the editor.
Functions
-
bool
Startup
()¶ The function dynamically loads the Genvid module and prepare the audio/video streams.
-
bool
Shutdown
()¶ The function stops all audio and video capture and unload the Genvid module.
Properties
-
bool
Enabled
¶ Enables or disables the Genvid SDK.
-
TArray<TSubclassOf<UGenvidStreamer>>
Streamer
¶ Container used to execute a blueprint script.
More than one script can be used at the same time.
-
bool
bIsStreaming
¶ Read-only variable to check if the audio/video streams are actually running.
-
bool