Genvid Client/Server for Unreal Engine
To follow the Genvid MILE SDK architecture you need to use two classes based on:
APlayerController
AGameState
These two classes will help you integrate the Client/Server architecture.
How It Works
The client-owned PlayerController sends a Remote Procedure Call (RPC) to the server with authority (through the GenvidEvents and GenvidCommands Components).
The server receives the RPC and triggers the corresponding custom event. Then it sends an RPC to all connected clients from the GameState class (Multicast).
Client Side
To allow an owner without authority (client) to send an RPC to the server,
use a PlayerController
-based class provided by Unreal Engine 4 & 5.
This is the only place where an RPC can be made from the client to the server.
You need to add your Genvid Streams/Events/Commands to your PlayerController-class, as described in the Instantiation section.
Note
Don’t forget to check the Replicated
checkbox to enable the Client/Server
flow. See Genvid Event Parameters.
Server Side
To allow an owner with authority (server) to send an RPC to all connected
clients, use the GameState
-based class provided by Unreal Engine 4 & 5.
This is one place where an RPC can be made from the server to a client.
To make send an RPC from the server:
In your
GameState
class, create a custom event for eachGenvidEvent
andGenvidCommand
in your GenvidEvents and GenvidCommands.Note
Take care of the custom event parameters signature.
GameState
should have the same than those created in GenvidEvents and GenvidCommands.Set the replicate mode to Multicast and Reliable.
With these settings, the server will send an RPC to all connected clients.
At this stage, you’re always in the GameState but on the client side. You can now call your code.
To complete the loop, call the GameState custom-event from the GenvidEvents or GenvidCommands components attached to the PlayerController.