Skip to main content

Server Battle API Reference

Battle session is the foundation of battle service. Battle session instances can be created through services such as Lobby / Matchmaking / World or via the PGOS HTTP API, and placed in online or local DS via the DS Hosting service. The battle session also manages data such as the players in the game and the DS access information.

API List

APIDescription
UpdateBattleRecordNow, there is no need to manually establish the association between battle session id and player ids, as PGOS will automatically complete this task.
SetBattleTagsSet tags for a battle session record.
UpdateBattleDataUpdate the data of battle
UpdateBattleBriefUpdate the brief of battle
UpdateBattleDetailUpdate the detail of battle.
DeleteBattleDataDelete the data of the specified key of battle

API Details

UpdateBattleRecord

Now, there is no need to manually establish the association between battle session id and player ids, as PGOS will automatically complete this task.

Deprecated, use SetBattleTags instead.

/**
* Now, there is no need to manually establish the association between battle session id and player ids, as PGOS will automatically complete this task.
* [DEPRECATED!!!] UpdateBattleRecord was declared deprecated, consider using SetBattleTags instead.
*
* @param BattleSessionId The id of battle session.
* @param PlayerIds IDs of all players in the battle, array cannot be empty.
* @param Tags The tags of battle.
* @param ResultCallback The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject.
*/
void UpdateBattleRecord(
const FString& BattleSessionId,
const TArray<FString>& PlayerIds,
const TArray<FString>& Tags,
TFunction<void(const FPgosResult& Ret)> ResultCallback) const;

Parameters:

ParamTypeDescription
BattleSessionIdconst FString&The id of battle session.
PlayerIdsconst TArray<FString>&IDs of all players in the battle, array cannot be empty.
Tagsconst TArray<FString>&The tags of battle.
ResultCallbackTFunction<void(const FPgosResult& Ret)>The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject.

Return: void

SetBattleTags

Set tags for a battle session record.

/**
* Set tags for a battle session record.
*
* @param ResultCallback The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject.
*/
void SetBattleTags(
const FPgosServerSetBattleTagsParams& Params,
TFunction<void(const FPgosResult& Ret)> ResultCallback) const;

Parameters:

ParamTypeDescription
Paramsconst FPgosServerSetBattleTagsParams&
ResultCallbackTFunction<void(const FPgosResult& Ret)>The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject.

Return: void

UpdateBattleData

Update the data of battle

/**
* Update the data of battle
*
* @param BattleSessionId The id of battle session.
* @param RecordData The data of battle.
* @param ResultCallback The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject.
*/
void UpdateBattleData(
const FString& BattleSessionId,
const TMap<FString, FString>& RecordData,
TFunction<void(const FPgosResult& Ret)> ResultCallback) const;

Parameters:

ParamTypeDescription
BattleSessionIdconst FString&The id of battle session.
RecordDataconst TMap<FString, FString>&The data of battle.
ResultCallbackTFunction<void(const FPgosResult& Ret)>The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject.

Return: void

UpdateBattleBrief

Update the brief of battle

/**
* Update the brief of battle
*
* @param BattleSessionId The id of battle session.
* @param Brief The data of battle.
* @param ResultCallback The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject.
*/
void UpdateBattleBrief(
const FString& BattleSessionId,
const FString& Brief,
TFunction<void(const FPgosResult& Ret)> ResultCallback) const;

Parameters:

ParamTypeDescription
BattleSessionIdconst FString&The id of battle session.
Briefconst FString&The data of battle.
ResultCallbackTFunction<void(const FPgosResult& Ret)>The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject.

Return: void

UpdateBattleDetail

Update the detail of battle.

/**
* Update the detail of battle.
*
* @param BattleSessionId The id of battle session.
* @param Detail The data of battle.
* @param ResultCallback The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject.
*/
void UpdateBattleDetail(
const FString& BattleSessionId,
const FString& Detail,
TFunction<void(const FPgosResult& Ret)> ResultCallback) const;

Parameters:

ParamTypeDescription
BattleSessionIdconst FString&The id of battle session.
Detailconst FString&The data of battle.
ResultCallbackTFunction<void(const FPgosResult& Ret)>The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject.

Return: void

DeleteBattleData

Delete the data of the specified key of battle

/**
* Delete the data of the specified key of battle
*
* @param BattleSessionId The id of battle session.
* @param Keys The specified keys to be deleted, if the keys is empty, nothing will happen.
* @param ResultCallback The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject.
*/
void DeleteBattleData(
const FString& BattleSessionId,
const TArray<FString>& Keys,
TFunction<void(const FPgosResult& Ret, const FPgosServerDelBattleDataRsp* Data)> ResultCallback) const;

Parameters:

ParamTypeDescription
BattleSessionIdconst FString&The id of battle session.
Keysconst TArray<FString>&The specified keys to be deleted, if the keys is empty, nothing will happen.
ResultCallbackTFunction<void(const FPgosResult& Ret, const FPgosServerDelBattleDataRsp* Data)>The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject.

Return: void