GEM Communication Functions
In 99.9% of cases an Experience should not have to manually invoke these, but for the sake of thoroughness a description of what they are and do is being included.
The GEMResponse Struct¶
This is a standard struct that all of the GEM REST Communication Functions will return. Different parts of the struct will be populated depending on the GEM query that has been sent.
Variables¶
bool IsValidResponse: Returns True if the response from GEM is valid and has no error codes.
int ErrorCode: The error code returned by GEM if there is an error. A Valid response will have an error code of 0.
EDeviceState DeviceState: The state of the queried Device ID. (Unknown, Unrecognized, Quarantined, SelfAssign, Prep, Onboard, InExperience, PostExperience)
bool bZoneIsFree: Returns True if the queried Zone is free.
int GroupID: The Group assignment of the queried device.
FString UserID: The GEM User ID that is currently assigned to the queried Device ID.
FString Language: The locale code chosen for the queried User ID.
int AvatarIndex: The index of the Avatar chosen by they queried UserID.
float PlayerHeight: The height in meters of the queried UserID.
EProgressState UserState: The progress state of the queried UserID (Unknown, SuitUp, Onboard, InExperience, or Complete)
FString SessionName: The name of the Session for the queried UserID
FString SessionAddress: The IP address for the server for the queried UserID.
int SessionPort: The port for the server for the queried UserID.
The GEM Rest Communication Functions¶
GetIsZoneFree (int ZoneIndex): Queries GEM to determine if the specified Zone is free for the group to move into. Will populate bZoneIsFree in the GEM Return Struct. Called automatically by the ExperienceManagerComponent. In most situations an experience should not have to manually invoke this call, but it could be used to pre-confirm that a Zone is free and invoke in-game stalling activities if it is not.
SetCurrentZone (int ZoneIndex): Informs GEM which Stage Zone the group is now in. Called automatically by the ExperienceManagerComponent once all players are in the first Game Zone of the new Stage Zone. An experience should never have to manually invoke this call.
FreePreviousZone (int ZoneIndex): Informs GEM that the Stage Zone the group was previously in is now free. Called automatically by the ExperienceManagerComponent once all players are in the First Game Zone of the new Stage Zone. An experience should never have to manually invoke this call.
UpdateGhostLocation(FString PlayerID, FVector2D GhostLocation, int OverlappedZoneIndex, EBoundsState BoundsState): Informs GEM that a player is out of their Stage Zone, their location on the stage, the Stage Zone that they are in, if any, and their Bounds State. This is called automatically by the ExperienceManagerComponent. An experience should never have to manually invoke this call.
SetPlayerExited(FString PlayerId, bool ProperExit): Informs GEM that a player has disconnected from the game server, and whether this disconnection was intentional or not. This is called automatically by the ExperienceManagerComponent. An experience should never have to manually invoke this call.
GetDeviceState(): Queries GEM for the state of the current Device. The return will populate the DeviceState variable of the GEM Return Struct. Called by the Client in the Client Startup Level. It should not be necessary for an experience to manually invoke this call.
GetUserInfo(FString UserID): Queries GEM for the User Info of the specified User ID. Populates the UserState, Avatar Index, PlayerHeight and Language variables of the GEM Response struct. Called by the Client in the Client Startup Level. It should not be necessary for an experience to manually invoke this call.
SetUserHeight(int UserId, float UserHeight): Sets the height (in meters) of the specified User ID (allows for skipping redoing the calibration step if a player is re-connecting to a server). Called automatically in the Client Startup Level. It should not be necessary for an experience to manually invoke this call.
RegisterGameServer(int GroupID, FString SessionName, FString SessionPassword, FString SessionIp, int SessionPort): Registers the game server with GEM. Called automatically in the GEM Online Subsystem when the GEM Game Session calls the OSS Create Session interface. An experience should never manually invoke this call.
FindGEMSession(FString ClientID): Queries GEM to find the appropriate game server for the specified GEM User ID. Called in the GEM Online Subsystem when the client calls the standard OSS Find Sessions interface, which occurs in the Client Startup Level. An experience should never manually invoke this call.