You are using an unsupported browser. Please update your browser to the latest version on or before July 31, 2020.
close
You are viewing the article in preview mode. It is not live at the moment.
CompleteSession() Function
print icon

The CompleteSession() function should be called every time the user completes a session. It:

  • Completes the current session.
  • Auto-generates an xAPI statement and sends it to the PIXO Platform as a PIXOVR_SESSION_COMPLETE event.
  • Adds the given context extensions to the xAPI Statement context if it's not null.
  • Returns false if there is no logged in user or current session.

Blueprint Example

Parameters

The CompleteSession() function has one required parameter:

  • InSessionData:FSessionData — Use this parameter to pass the basic data that the Platform uses to complete the reporting dashboard for finished sessions. Failure to include any of this data will result in the dashboard displaying the session report as being "incomplete". More information can be found in the SessionData section.

Handling Response

  • OnRequestComplete and OnStaticRequestComplete with the type EApexRequestType::CompleteSession is called when the session was completed successfully.

  • OnRequestFail and OnStaticRequestFail with the type EApexRequestType::CompleteSession is called when the session was not started, unable to be completed otherwise or when the server is not able to be reached.

SessionData

FSessionData is a custom structure that stores end of session data, as well as content and result extension data.

 

The FSessionData is used for two purposes, both of which are automatic but are explained here for completeness. First, many of the required properties of the Result object in the generated xAPI statement get populated with data from the FSessionData. Secondly, it is used to populate both the Result.Extension and Context.Extension within the FXAPIStatement.

 

The Example Code section below demonstrates how this additional top level data is included.

Members

The following members are defined for FSessionData:

  • Complete:bool — TRUE indicates the user made it all the way through to an expected completion point.

    • FALSE indicates they quit early, usually through a menu option to quit or return to lobby.

  • Success:bool — TRUE indicates they achieved a high enough score or otherwise performed the necessary tasks to pass the module.

    • FALSE indicates they did not.

  • Score:float — The final score the user achieved on the module.

  • ScoreScaled:float — Usually the "score" value divided by the "max" value. The value can range from -1 to 1.

  • ScoreMin:float — The lowest possible score in the module (often 0, but it depends on the nature of your module).

  • ScoreMax:float — The highest possible score a user could achieve in your module

  • Duration:int — How long, in seconds, the session lasted.

  • AdditionalContextData:FXAPIExtension — An extension to the Context part of the xAPI Statement.

  • AdditionalResultData:FXAPIExtension — An extension to the Result part of the xAPI Statement.

Example Code

float Score = 85;
float Scaled = .85;
float Min = 0;
float Max = 100;
int Duration = 120;
bool Completed = true;
bool Success = true;
 
FSessionData EndSessionData;
EndSessionData.Score = Score;
EndSessionData.ScoreScaled = Scaled;
EndSessionData.ScoreMin = Min;
EndSessionData.ScoreMax = Max;
EndSessionData.Duration = Duration;
EndSessionData.Complete = Completed;
EndSessionData.Success = Success;
EndSessionData.AdditionalResultData.AddCustomString("https://pixovr.com/xapi/extension/score_average", "99.99");
EndSessionData.AdditionalResultData.AddNumber("expected_score_prediction", 100);
 
UApexAPI* ApexAPI = GetGameInstance()->GetSubsystem<UApexAPI>();
ApexAPI->CompleteSession(ContextExtension);

 


Next Article: Send Session Event() Function

Previous Article: JoinSession() Function

Feedback
0 out of 0 found this helpful

scroll to top icon