The PC SDK provides APIs to integrate additional services into games.
Additional services supported by PC SDK include custom event log, PC SDK version inquiry, over-immersion prevention notification, shutdown notification, tracking clue inquiry.
Games can send custom in-game events (game logs) to the Stove platform. Also, the game can query the semantic version of the PC SDK currently in use.
PC SDK semantic version inquiry can be obtained as a return value, not a callback.
The Over Immersion Prevention Alert delivers a warning phrase about over immersion in the game through a callback every hour.
Shutdown notification is a system that restricts children under the age of 18 from using the game at a specific time per day of the week by parents. When the requirements are met, notifications are delivered through callbacks up to 4 times.
In order to communicate with the PC SDK using the additional service API, the game must redefine the callback function connected to the UMyStovePCSDKObject
class below.
UCLASS()
class HELLOSTOVE_API UMyStoveSDKObject : public UStoveSDKObject
{
GENERATED_BODY()
public:
//StovePCSDK Event
void OnInitComplete() final;
void OnError(FStoveError Error) final;
void OnToken(FStoveToken Token) final;
void OnUser(FStoveUser User) final;
void OnOwnership(int Size, FStoveOwnership* Ownerships) final;
//Callback called when StashCustomEvent processing is complete
void OnStashCustomEvent(FStoveCustomEvent CustomEvent, int ParameterSize, FStoveCustomEventParameter* Parameters) final;
// ADD 2.6.0 Start
// Callback that is called every hour to prevent over-immersion
void OnOverImmersion(FStoveOverImmersion OverImmersion) final;
// Callback to be called on shutdown limit
void OnShutdown(FStoveShutdown Shutdown) final;
// 2.6.0 End
}
Link events by overriding the callback function of the 'UMyStoveSDKObject' class inherited from 'UStoveSDKObject' as in Connection 1) Config, Callback Settings
.
/* In the case of using only the Ownership function,
In addition to the mandatory implementation callbacks OnError and OnInitComplete
Connect by implementing an additional OnOwnership callback.*/
void UMyStoveSDKObject::OnInitComplete()
{
// Process contents after successful initialization
}
void UMyStoveSDKObject::OnError(FStoveError Error)
{
// handling of errors
}
void UMyStoveSDKObject::OnOwnership(int Size, FStoveOwnership* Ownerships)
{
// Process details after checking ownership
}
void UMyStoveSDKObject::OnStashCustomEvent(FStoveCustomEvent CustomEvent, int ParameterSize, FStoveCustomEventParameter* Parameters)
{
// After sending the logs, check the delivered contents
}
// ADD 2.6.0 Start
void UMyStoveSDKObject::OnOverImmersion(FStoveOverImmersion OverImmersion)
{
// Callback that is called every hour to prevent over-immersion
}
void UMyStoveSDKObject::OnShutdown(FStoveShutdown Shutdown)
{
// Implement if selective shutdown is required by law.
}
// 2.6.0 End
You are not required to implement the OnStashCustomEvent
, OnOverImmersion
, OnShutdown
callbacks. You only need to connect if your game uses the custom event log feature.
<aside> 💡 Warning
The OnOverImmersion
callback must be implemented in cases where game overimmersion/addiction precautions are required by law. The OnShutdown
callback must be implemented if a selective shutdown is required by law.
</aside>
Log custom events (game logs) with UMyStoveSDKObject::StoveSDKStashCustomEvent
function.
// input parameters
// const FString& Name: event name
// const FString& Category1: primary category name
// const FString& Category2 : 2nd category name
// const FString& SimpleValue : simple value
// const TArray<FStoveCustomEventParameter> Params: Detailed parameter information
// int paramsSize: Number of detailed parameter information
FStoveResult ErrorResult = UMyStoveSDKObject::StoveSDKStashCustomEvent("EVENT_NAME", "CATEGORY1", "CATEGORY2", 1.0f, params, PARAMS_SIZE);
if(ErrorResult.Result == StovePCResult::STOVE_PC_NO_ERROR)
{
/* handle success */
}
When the StoveSDKStashCustomEvent
function is successfully processed, the OnStashCustomEvent
callback is called.
The FStoveCustomEvent
structure passed to the callback contains the event name passed when calling the API, the primary category name, the secondary category name, and a simple value.
The FStoveCustomEventParameter
structure passed to the callback contains the parameter information passed when calling the API.
void UMyStoveSDKObject::OnStashCustomEvent(FStoveCustomEvent CustomEvent, int ParameterSize, FStoveCustomEventParameter* Parameters)
{
/*Add the 'walkthrough' codes here.*/
OnLog("[StashCustomEvent]");
OnLog(" - CustomEvent.Name : %s", *(CustomEvent.Name));
OnLog(" - CustomEvent.Category1 : %s", *(CustomEvent.Category1));
OnLog(" - CustomEvent.Category2 : %s", *(CustomEvent.Category2));
OnLog(" - CustomEvent.SimpleValue : %f", CustomEvent.SimpleValue);
for (int i = 0; i < ParameterSize; i++, Parameters++)
{
OnLog(" - Parameter[%d].Name : %s", i, *(Parameters->Name));
OnLog(" - Parameter[%d].Value : %s", i, *(Parameters->Value));
}
}