Genvid Blueprint Class for Unreal Engine
Preparing your game
To simplify integrating the Genvid MILE SDK into your Unreal project, you can now create some Blueprint Classes directly from the editor.
These five classes will help you integrate the video, audio, streams, events, and commands:
GenvidAudio
GenvidVideo
GenvidStreams
GenvidEvents
GenvidCommands
GenvidRequests
The GenvidSession
class manages these five classes, while the
GenvidSessionManager
class manages the GenvidSession
.
The following diagram summarizes the relationships between these Blueprints. See Genvid Module Design for a more detailed version.
Note
We designed the Genvid Module to potentially handle
multiple sessions in the future. For now, a GenvidSessionManager
instance may only contain a single GenvidSession
based on the current
Genvid MILE SDK design.
You create your own Blueprint assets based on each one’s matching C++ class:
GenvidSessionManager
After you create all your Blueprint assets, set the session class you want to
use in GenvidSessionManager
.
Caution
Make sure you have only one GenvidSessionManager
instance. Select the
way that works best for your implementation. For example, you can declare it
in a class derived from UGameInstance
.
GenvidSession
Next, select the GenvidSession
Blueprint and set the child classes that you
want to use for the session.
GenvidVideo
After setting up the session, open the Genvid Video
Blueprint. In the
Details panel, set the video Stream Name, the
Video Mode, and a Video Source (if required by your
selected video mode).
Note
The Automatic video mode captures the rendered window’s swapchain and sends it to the Genvid MILE SDK.
The Texture video mode lets you set any object derived from a UTexture
class.
GenvidAudio
Open the Genvid Audio
Blueprint. In the Details
panel, set the audio Stream Name, the Audio Format, and
the Audio Mode.
Note
- The
Audio Format
setting selects the sound quality sent to the Genvid MILE SDK.
The Audio Mode
setting selects which type of capture you want to use.
For now, only WASAPI
is available, which captures all the audio
generated by the game machine.
GenvidStreams
Open the Genvid Streams
Blueprint. You create the stream(s) you need in the
Event Graph panel.
Use the GenvidStream
structure to create a stream. Type Make
GenvidStream in the All Possible Actions context menu to add it
to the Event Graph.
Select Name, Framerate, and the stream events you want.
Caution
You need to explicitly call the MatchHasStarted
and MatchHasEnded
functions from UGenvidSessionManager
to trigger Stream (Match
Started) and Stream (Match Ended).
For each stream event you select:
Add a custom event.
Add a node to the function you want to call from your custom event.
Add the stream to the
Streams
variable.
Note
The Framerate
property is only available for the event Stream
(Tick)
.
Set the Framerate
property to 0 to call the event only one time.
Caution
If you select a stream event in the GenvidStream Pin Options but you don’t link a custom event to it, the Blueprint won’t compile. Uncheck the stream event to fix that.
GenvidEvents
Open the Genvid Events
Blueprint. You can create any events you need in the
Event Graph panel.
Use the GenvidEvent
structure to create an event.
Type Make GenvidEvent in the All Actions for this Blueprint contextual menu to add it to the Event Graph.
- For each event you create:
Set the event Name.
Activate the Client/Server mode checking the box Replicated.
Link a custom event to the Delegate pin.
Add a node to the function you want to call from your custom event.
Add the event to the
Events
variable.
Remember to implement your created events in your website. You can find examples on the event generation page. The web.js file in our Web Sample also illustrates this in more detail.
Note
The replicated option in GenvidEvents allow you to call the delegate directly from the server. It’s useful if you want to use Remote Procedure Calls.
GenvidCommands
Open the Genvid Commands Blueprint. You can create the command(s) you need in the Event Graph panel.
Use the GenvidCommand
structure to create a command.
Type Make GenvidCommand in the All Actions for this Blueprint context menu to add it to the Event Graph.
For each command you create:
Set the command Name.
Activate the Client/Server mode checking the box Replicated.
Link a custom event to the Delegate pin.
Add a node to the function you want to call from your custom event.
Add the command to the
Commands
variable.
Remember to implement your created commands in your website. You can find examples on the sendCommands page. The web-admin.js file in our Web Sample also illustrates this in more detail.
Note
The replicated option in GenvidCommands allow you to call the delegate directly from the server. It’s useful if you want to use Remote Procedure Calls.
GenvidRequests
Open the Genvid Requests Blueprint. You can create the request(s) you need in the Event Graph panel.
Use the GenvidRequest
structure to create a request.
Type Make GenvidRequest in the All Actions for this Blueprint context menu to add it to the Event Graph.
For each request you create:
Set the request Topic.
Link a custom request to the Delegate pin.
Add a node to the function you want to call from your custom request.
Add the request to the
Requests
variable.Construct your reply and send it using the
SubmitRequestReply
function.
Remember to implement your created requests in your website. You can find examples on the sendRequestGetState page. The web-admin.js file in our Web Sample also illustrates this in more detail.
Starting Genvid Module
Instantiation
The first thing to do is instantiate the GenvidSessionManager
.
One way to do this is:
Declare it in a
UGameInstance
-based class.Call the
Initialize()
function when the application starts.Call the
Terminate()
function when the application stops.
Note
This implementation is one example of how to instantiate and terminate the
GenvidSessionManager
. You can select the best way based on your
implementation.
Once you initialize GenvidSessionManager
, add a new Blueprint class based
on APlayerController
.
Click on Add Component and select the class you want to use in your Genvid Session:
Note
Ensure you have set your PlayerController
class in your GameMode
class Classes section.
Your Genvid Module is now ready.
See the Genvid Client/Server for Unreal Engine section for information on adapting your present code.