PICO Unreal Platform SDK
Pico_Matchmaking.h
1// Copyright® 2015-2023 PICO Technology Co., Ltd. All rights reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "OnlineSubsystemPico.h"
7#include "UObject/NoExportTypes.h"
8#include "OnlineSubsystemPicoNames.h"
9#include "PPF_Platform.h"
10#include "Pico_Matchmaking.generated.h"
11//
12
13
14DECLARE_LOG_CATEGORY_EXTERN(PicoMatchmaking, Log, All);
15
16class UPico_User;
17class UPico_DataStore;
18class UPico_UserArray;
19class UPico_Room;
20
30
31
35DECLARE_MULTICAST_DELEGATE_FourParams(FMatchmakingMatchFoundNotify, bool, /*bIsError*/ int, /*ErrorCode*/ const FString&, /*ErrorMessage*/ UPico_Room* /*Room*/);
36DECLARE_MULTICAST_DELEGATE_ThreeParams(FMatchmakingCancelNotify, bool, /*bIsError*/ int, /*ErrorCode*/ const FString& /*ErrorMessage*/);
37
38DECLARE_DYNAMIC_DELEGATE_ThreeParams(FMatchmakingReportResultsInsecure, bool, bIsError, int, ErrorCode, const FString&, ErrorMessage);
39DECLARE_DYNAMIC_DELEGATE_FourParams(FMatchmakingGetStats, bool, bIsError, int, ErrorCode, const FString&, ErrorMessage, UPico_MatchmakingStats*, MatchmakingStats);
40DECLARE_DYNAMIC_DELEGATE_FourParams(FMatchmakingBrowse2, bool, bIsError, int, ErrorCode, const FString&, ErrorMessage, UPico_MatchmakingBrowseResult*, MatchmakingBrowseResult);
41DECLARE_DYNAMIC_DELEGATE_FourParams(FMatchmakingBrowse2CustomPage, bool, bIsError, int, ErrorCode, const FString&, ErrorMessage, UPico_MatchmakingBrowseResult*, MatchmakingBrowseResult);
42DECLARE_DYNAMIC_DELEGATE_ThreeParams(FMatchmakingCancel, bool, bIsError, int, ErrorCode, const FString&, ErrorMessage);
43DECLARE_DYNAMIC_DELEGATE_FourParams(FMatchmakingCreateAndEnqueueRoom2, bool, bIsError, int, ErrorCode, const FString&, ErrorMessage, UPico_MatchmakingEnqueueResultAndRoom*, MatchmakingEnqueueResultAndRoom);
44DECLARE_DYNAMIC_DELEGATE_FourParams(FMatchmakingEnqueue2, bool, bIsError, int, ErrorCode, const FString&, ErrorMessage, UPico_MatchmakingEnqueueResult*, MatchmakingEnqueueResult);
45DECLARE_DYNAMIC_DELEGATE_FourParams(FMatchmakingGetAdminSnapshot, bool, bIsError, int, ErrorCode, const FString&, ErrorMessage, UPico_MatchmakingAdminSnapshot*, MatchmakingAdminSnapshot);
46DECLARE_DYNAMIC_DELEGATE_ThreeParams(FMatchmakingStartMatch, bool, bIsError, int, ErrorCode, const FString&, ErrorMessage);
47// FRoom_LaunchInvitableUserFlow
48// FRoom_GetNextRoomArrayPage
49
61class ONLINESUBSYSTEMPICO_API FPicoMatchmakingInterface
62{
63private:
64 FOnlineSubsystemPico& PicoSubsystem;
65
66public:
67 FPicoMatchmakingInterface(FOnlineSubsystemPico& InSubsystem);
69
70 FDelegateHandle MatchmakingMatchFoundHandle;
71 void OnMatchmakingMatchFoundNotification(ppfMessageHandle Message, bool bIsError);
72
73 FDelegateHandle MatchmakingCancelHandle;
74 void OnMatchmakingCancelNotification(ppfMessageHandle Message, bool bIsError);
75
76 FMatchmakingMatchFoundNotify MatchmakingMatchFoundNotify;
77 FMatchmakingCancelNotify MatchmakingCancelNotify;
78
79 FMatchmakingReportResultsInsecure ReportResultsInsecureDelegate;
80 FMatchmakingGetStats GetStatsDelegate;
81 FMatchmakingBrowse2 Browse2Delegate;
82 FMatchmakingBrowse2CustomPage Browse2CustomPageDelegate;
83 FMatchmakingCancel CancelDelegate;
84 FMatchmakingCreateAndEnqueueRoom2 CreateAndEnqueueRoom2Delegate;
85 FMatchmakingEnqueue2 Enqueue2Delegate;
86 FMatchmakingGetAdminSnapshot GetAdminSnapshotDelegate;
87 FMatchmakingStartMatch StartMatchDelegate;
88
101 bool ReportResultsInsecure(const FString& RoomID, const TMap<FString, int>& Data, FMatchmakingReportResultsInsecure InDelegate);
102
117 bool GetStats(const FString& Pool, uint32 MaxLevel, EMatchmakingStatApproach Approach = EMatchmakingStatApproach::Trailing, FMatchmakingGetStats InDelegate = FMatchmakingGetStats());
118
133 bool Browse2(const FString& Pool, FPicoMatchmakingOptions MatchmakingOptions, FMatchmakingBrowse2 InDelegate);
134
149 bool Browse2CustomPage(const FString& Pool, FPicoMatchmakingOptions MatchmakingOptions, int PageIndex, int PageSize, FMatchmakingBrowse2CustomPage InDelegate);
150
165 bool Cancel(FMatchmakingCancel InDelegate);
166
180 bool CreateAndEnqueueRoom2(const FString& Pool, FPicoMatchmakingOptions MatchmakingOptions, FMatchmakingCreateAndEnqueueRoom2 InDelegate);
181
199 bool Enqueue2(const FString& pool, FPicoMatchmakingOptions MatchmakingOptions, FMatchmakingEnqueue2 InDelegate);
200
215 bool GetAdminSnapshot(FMatchmakingGetAdminSnapshot InDelegate);
216
233 bool StartMatch(const FString& RoomId, FMatchmakingStartMatch InDelegate);
234private:
235 ppfMatchmakingOptions* GetppfMatchmakingOptions(FPicoMatchmakingOptions PicoMatchmakingOptions);
236 ppfMatchmakingStatApproach GetppfMatchmakingStatApproach(EMatchmakingStatApproach MatchmakingStatApproach);
237 ppfID GetppfID(const FString& StringID);
238};
239
255UCLASS()
256class ONLINESUBSYSTEMPICO_API UOnlinePicoMatchmakingFunction : public UBlueprintFunctionLibrary
257{
258 GENERATED_BODY()
259
260
261public:
269 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Matchmaking")
270 static void ReportResultsInsecure(UObject* WorldContextObject, const FString& RoomID, const TMap<FString, int>& Data, FMatchmakingReportResultsInsecure InDelegate);
271
281 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Matchmaking")
282 // static void GetStats(UObject* WorldContextObject, const FString& Pool, int32 MaxLevel, EMatchmakingStatApproach approach = EMatchmakingStatApproach::Trailing, const FMatchmakingGetStats& InDelegate = FMatchmakingGetStats());
283 static void GetStats(UObject* WorldContextObject, const FString& Pool, int32 MaxLevel, EMatchmakingStatApproach approach, FMatchmakingGetStats InDelegate);
284
294 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Matchmaking")
295 static void Browse2(UObject* WorldContextObject, const FString& Pool, FPicoMatchmakingOptions MatchmakingOptions, FMatchmakingBrowse2 InDelegate);
296
306 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Matchmaking")
307 static void Browse2CustomPage(UObject* WorldContextObject, const FString& Pool, FPicoMatchmakingOptions MatchmakingOptions, int PageIndex, int PageSize, FMatchmakingBrowse2CustomPage InDelegate);
308
319 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Matchmaking")
320 static void Cancel(UObject* WorldContextObject, FMatchmakingCancel InDelegate);
321
330 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Matchmaking")
331 static void CreateAndEnqueueRoom2(UObject* WorldContextObject, const FString& Pool, FPicoMatchmakingOptions MatchmakingOptions, FMatchmakingCreateAndEnqueueRoom2 InDelegate);
332
345 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Matchmaking")
346 static void Enqueue2(UObject* WorldContextObject, const FString& Pool, FPicoMatchmakingOptions MatchmakingOptions, FMatchmakingEnqueue2 InDelegate);
347
358 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Matchmaking")
359 static void GetAdminSnapshot(UObject* WorldContextObject, FMatchmakingGetAdminSnapshot InDelegate);
360
372 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Matchmaking")
373 static void StartMatch(UObject* WorldContextObject, const FString& RoomId, FMatchmakingStartMatch InDelegate);
374};
375
380UCLASS(BlueprintType)
381class ONLINESUBSYSTEMPICO_API UPico_MatchmakingStats : public UObject
382{
383 GENERATED_BODY()
384private:
385 unsigned int DrawCount;
386 unsigned int LossCount;
387 unsigned int SkillLevel;
388 double SkillMean;
389 double SkillStandardDeviation;
390 unsigned int WinCount;
391
392public:
393 void InitParams(ppfMatchmakingStatsHandle InHandle);
394
396 UFUNCTION(BlueprintPure, Category = "Pico Platform|Matchmaking|Matchmaking Stats")
397 int32 GetDrawCount();
398
400 UFUNCTION(BlueprintPure, Category = "Pico Platform|Matchmaking|Matchmaking Stats")
401 int32 GetLossCount();
402
404 UFUNCTION(BlueprintPure, Category = "Pico Platform|Matchmaking|Matchmaking Stats")
405 int32 GetSkillLevel();
406
408 UFUNCTION(BlueprintPure, Category = "Pico Platform|Matchmaking|Matchmaking Stats")
409 float GetSkillMean();
410
412 UFUNCTION(BlueprintPure, Category = "Pico Platform|Matchmaking|Matchmaking Stats")
413 float GetSkillStandardDeviation();
414
416 UFUNCTION(BlueprintPure, Category = "Pico Platform|Matchmaking|Matchmaking Stats")
417 int32 GetWinCount();
418
419 UFUNCTION(BlueprintPure, Category = "Pico Platform|Matchmaking|Matchmaking Stats")
420 FString GetDebugString();
421};
422
424UCLASS(BlueprintType)
425class ONLINESUBSYSTEMPICO_API UPico_MatchmakingBrowseResult : public UObject
426{
427 GENERATED_BODY()
428private:
429 UPROPERTY()
430 UPico_MatchmakingEnqueueResult* EnqueueResult;
431 UPROPERTY()
432
433 UPico_MatchmakingRoomList* MatchmakingRooms;
434public:
435 void InitParams(ppfMatchmakingBrowseResultHandle InHandle);
436
438 UFUNCTION(BlueprintPure, Category = "Pico Platform|Matchmaking|Matchmaking Browse Result")
439 UPico_MatchmakingEnqueueResult* GetMatchmakingEnqueueResult();
440
442 UFUNCTION(BlueprintPure, Category = "Pico Platform|Matchmaking|Matchmaking Browse Result")
443 UPico_MatchmakingRoomList* GetMatchmakingRooms();
444
445 UFUNCTION(BlueprintPure, Category = "Pico Platform|Matchmaking|Matchmaking Browse Result")
446 FString GetDebugString();
447};
448
450UCLASS(BlueprintType)
451class ONLINESUBSYSTEMPICO_API UPico_MatchmakingRoomList : public UObject
452{
453 GENERATED_BODY()
454private:
455 UPROPERTY()
456 TArray<UPico_MatchmakingRoom*> MatchmakingRoomArray;
457 int32 Size = 0;
458 int32 TotalSize = 0;
459public:
460 void InitParams(ppfMatchmakingRoomArrayHandle InHandle);
461
463 UFUNCTION(BlueprintPure, Category = "Pico Platform|Matchmaking|Matchmaking Room Array")
464 UPico_MatchmakingRoom* GetElement(int32 Index);
465
466
468 UFUNCTION(BlueprintPure, Category = "Pico Platform|Matchmaking|Matchmaking Room Array")
469 int32 GetSize();
470
471 UFUNCTION(BlueprintPure, Category = "Pico Platform|Matchmaking|Matchmaking Room Array")
472 int32 GetTotalSize();
473
474 UFUNCTION(BlueprintPure, Category = "Pico Platform|Matchmaking|Matchmaking Room Array")
475 FString GetDebugString();
476};
477
479UCLASS(BlueprintType)
480class ONLINESUBSYSTEMPICO_API UPico_MatchmakingRoom : public UObject
481{
482 GENERATED_BODY()
483private:
484 UPROPERTY()
485 UPico_Room* Room;
486 unsigned int PingTime;
487 bool HasPingTime;
488
489public:
490 void InitParams(ppfMatchmakingRoomHandle InHandle);
491
493 UFUNCTION(BlueprintPure, Category = "Pico Platform|Matchmaking|Matchmaking Room")
494 UPico_Room* GetRoom();
495
497 UFUNCTION(BlueprintPure, Category = "Pico Platform|Matchmaking|Matchmaking Room")
498 int32 GetPingTime();
499
501 UFUNCTION(BlueprintPure, Category = "Pico Platform|Matchmaking|Matchmaking Room")
502 bool GetHasPingTime();
503
504 UFUNCTION(BlueprintPure, Category = "Pico Platform|Matchmaking|Matchmaking Room")
505 FString GetDebugString();
506};
507
509UCLASS(BlueprintType)
510class ONLINESUBSYSTEMPICO_API UPico_MatchmakingEnqueueResultAndRoom : public UObject
511{
512 GENERATED_BODY()
513
514private:
515 UPROPERTY()
516 UPico_MatchmakingEnqueueResult* MatchmakingEnqueueResult;
517 UPROPERTY()
518 UPico_Room* Room;
519
520public:
521 void InitParams(ppfMatchmakingEnqueueResultAndRoomHandle InHandle);
522
524 UFUNCTION(BlueprintPure, Category = "Pico Platform|Matchmaking|Matchmaking Enqueue Result And Room")
525 UPico_MatchmakingEnqueueResult* GetMatchmakingEnqueueResult();
526
528 UFUNCTION(BlueprintPure, Category = "Pico Platform|Matchmaking|Matchmaking Enqueue Result And Room")
529 UPico_Room* GetRoom();
530
531 UFUNCTION(BlueprintPure, Category = "Pico Platform|Matchmaking|Matchmaking Enqueue Result And Room")
532 FString GetDebugString();
533};
534
536UCLASS(BlueprintType)
537class ONLINESUBSYSTEMPICO_API UPico_MatchmakingEnqueueResult : public UObject
538{
539 GENERATED_BODY()
540
541private:
542 UPROPERTY()
543 UPico_MatchmakingAdminSnapshot* AdminSnapshotOptional;
544 unsigned int AverageWait;
545 unsigned int MatchesInLastHourCount;
546 unsigned int MaxExpectedWait;
547 FString Pool;
548 unsigned int RecentMatchPercentage;
549
550public:
551 void InitParams(ppfMatchmakingEnqueueResultHandle InHandle);
552
554 UFUNCTION(BlueprintPure, Category = "Pico Platform|Matchmaking|Matchmaking Enqueue Result")
555 UPico_MatchmakingAdminSnapshot* GetAdminSnapshotOptional();
556
558 UFUNCTION(BlueprintPure, Category = "Pico Platform|Matchmaking|Matchmaking Enqueue Result")
559 int32 GetAverageWait();
560
562 UFUNCTION(BlueprintPure, Category = "Pico Platform|Matchmaking|Matchmaking Enqueue Result")
563 int32 GetMatchesInLastHourCount();
564
566 UFUNCTION(BlueprintPure, Category = "Pico Platform|Matchmaking|Matchmaking Enqueue Result")
567 int32 GetMaxExpectedWait();
568
570 UFUNCTION(BlueprintPure, Category = "Pico Platform|Matchmaking|Matchmaking Enqueue Result")
571 FString GetPool();
572
574 UFUNCTION(BlueprintPure, Category = "Pico Platform|Matchmaking|Matchmaking Enqueue Result")
575 int32 GetRecentMatchPercentage();
576
577 UFUNCTION(BlueprintPure, Category = "Pico Platform|Matchmaking|Matchmaking Enqueue Result")
578 FString GetDebugString();
579};
580
582UCLASS(BlueprintType)
583class ONLINESUBSYSTEMPICO_API UPico_MatchmakingAdminSnapshot : public UObject
584{
585 GENERATED_BODY()
586
587private:
588 UPROPERTY()
590 double MyCurrentThreshold;
591
592public:
593 void InitParams(ppfMatchmakingAdminSnapshotHandle InHandle);
594
596 UFUNCTION(BlueprintPure, Category = "Pico Platform|Matchmaking|Matchmaking Admin Snapshot")
598
599 UFUNCTION(BlueprintPure, Category = "Pico Platform|Matchmaking|Matchmaking Admin Snapshot")
600 float GetMyCurrentThreshold();
601
603 UFUNCTION(BlueprintPure, Category = "Pico Platform|Matchmaking|Matchmaking Admin Snapshot")
604 FString GetDebugString();
605};
606
608UCLASS(BlueprintType)
609class ONLINESUBSYSTEMPICO_API UPico_MatchmakingAdminSnapshotCandidateList : public UObject
610{
611 GENERATED_BODY()
612private:
613 UPROPERTY()
614 TArray<UPico_MatchmakingAdminSnapshotCandidate*> MatchmakingAdminSnapshotCandidateArray;
615 int32 TotalSize = 0;
616 int32 Size = 0;
617public:
618 void InitParams(ppfMatchmakingAdminSnapshotCandidateArrayHandle InHandle);
619
621 UFUNCTION(BlueprintPure, Category = "Pico Platform|Matchmaking|Matchmaking AdminSnapshot Candidate Array")
623
624 UFUNCTION(BlueprintPure, Category = "Pico Platform|Matchmaking|Matchmaking AdminSnapshot Candidate Array")
625 int32 GetTotalSize();
626
628 UFUNCTION(BlueprintPure, Category = "Pico Platform|Matchmaking|Matchmaking AdminSnapshot Candidate Array")
629 int32 GetSize();
630
631 UFUNCTION(BlueprintPure, Category = "Pico Platform|Matchmaking|Matchmaking AdminSnapshot Candidate Array")
632 FString GetDebugString();
633};
634
636UCLASS(BlueprintType)
637class ONLINESUBSYSTEMPICO_API UPico_MatchmakingAdminSnapshotCandidate : public UObject
638{
639 GENERATED_BODY()
640
641private:
642 bool CanMatch;
643 double MyTotalScore;
644 double TheirCurrentThreshold;
645
646public:
647 void InitParams(ppfMatchmakingAdminSnapshotCandidateHandle InHandle);
648
650 UFUNCTION(BlueprintPure, Category = "Pico Platform|Matchmaking|Matchmaking Admin Snapshot Candidate")
651 bool GetCanMatch();
652
654 UFUNCTION(BlueprintPure, Category = "Pico Platform|Matchmaking|Matchmaking Admin Snapshot Candidate")
655 float GetMyTotalScore();
656
658 UFUNCTION(BlueprintPure, Category = "Pico Platform|Matchmaking|Matchmaking Admin Snapshot Candidate")
659 float GetTheirCurrentThreshold();
660
661 UFUNCTION(BlueprintPure, Category = "Pico Platform|Matchmaking|Matchmaking Admin Snapshot Candidate")
662 FString GetDebugString();
663};
PicoMatchmakingInterface class.
Definition: Pico_Matchmaking.h:62
bool Cancel(FMatchmakingCancel InDelegate)
Cancels a matchmaking request. Call this function to cancel an enqueue request before a match is made...
bool GetAdminSnapshot(FMatchmakingGetAdminSnapshot InDelegate)
Debugs the state of the current matchmaking pool queue.
bool Browse2(const FString &Pool, FPicoMatchmakingOptions MatchmakingOptions, FMatchmakingBrowse2 InDelegate)
Gets rooms by matchmakinging pool name. The user can join the room with RoomService....
bool Browse2CustomPage(const FString &Pool, FPicoMatchmakingOptions MatchmakingOptions, int PageIndex, int PageSize, FMatchmakingBrowse2CustomPage InDelegate)
Gets rooms by matchmakinging pool name and specify the page number and the number of pages per page.
bool CreateAndEnqueueRoom2(const FString &Pool, FPicoMatchmakingOptions MatchmakingOptions, FMatchmakingCreateAndEnqueueRoom2 InDelegate)
Creates a matchmaking room, then enqueues and joins it.
bool ReportResultsInsecure(const FString &RoomID, const TMap< FString, int > &Data, FMatchmakingReportResultsInsecure InDelegate)
Reports the result of a skill-rating match.
bool StartMatch(const FString &RoomId, FMatchmakingStartMatch InDelegate)
Reports that a skill-rating match has started. You can use this method after joining the room.
bool Enqueue2(const FString &pool, FPicoMatchmakingOptions MatchmakingOptions, FMatchmakingEnqueue2 InDelegate)
Enqueues for an available matchmaking room to join. When the server finds a match,...
bool GetStats(const FString &Pool, uint32 MaxLevel, EMatchmakingStatApproach Approach=EMatchmakingStatApproach::Trailing, FMatchmakingGetStats InDelegate=FMatchmakingGetStats())
Gets the matchmaking statistics for the current user.
OnlinePicoMatchmaking Blueprint Function class.
Definition: Pico_Matchmaking.h:257
UPico_DataStore class.
Definition: Pico_DataStore.h:18
UPico_MatchmakingAdminSnapshotCandidate class.
Definition: Pico_Matchmaking.h:638
UPico_MatchmakingAdminSnapshotCandidateList class.
Definition: Pico_Matchmaking.h:610
UPico_MatchmakingAdminSnapshot class.
Definition: Pico_Matchmaking.h:584
UPico_MatchmakingBrowseResult class.
Definition: Pico_Matchmaking.h:426
UPico_MatchmakingEnqueueResultAndRoom class.
Definition: Pico_Matchmaking.h:511
UPico_MatchmakingEnqueueResult class.
Definition: Pico_Matchmaking.h:538
UPico_MatchmakingRoom class.
Definition: Pico_Matchmaking.h:481
UPico_MatchmakingRoomList class.
Definition: Pico_Matchmaking.h:452
UPico_MatchmakingStats class.
Definition: Pico_Matchmaking.h:382
UPico_Room class.
Definition: Pico_Room.h:638
UPico_UserArray class.
Definition: Pico_User.h:539
UPico_User class.
Definition: Pico_User.h:451
EMatchmakingStatApproach
Matchmaking stat approach.
Definition: OnlineSubsystemPicoNames.h:806
Matchmaking options.
Definition: OnlineSubsystemPicoNames.h:790