[GameLift][FlexMatch] Update session interface for clients to make matchmaking requests (#4450)
* [GameLift][FlexMatch] Update session interface for clients to make matchmaking requests Signed-off-by: Junbo Liang <junbo@amazon.com>
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/RTTI/ReflectContext.h>
|
||||
#include <AzCore/std/string/string.h>
|
||||
#include <AzFramework/Matchmaking/MatchmakingRequests.h>
|
||||
|
||||
namespace AzFramework
|
||||
{
|
||||
//! IMatchmakingRequests
|
||||
//! Pure virtual session interface class to abstract the details of session handling from application code.
|
||||
class IMatchmakingRequests
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(IMatchmakingRequests, "{BC0B74DA-A448-4F40-9B50-9D73142829D5}");
|
||||
|
||||
IMatchmakingRequests() = default;
|
||||
virtual ~IMatchmakingRequests() = default;
|
||||
|
||||
// Registers a player's acceptance or rejection of a proposed matchmaking.
|
||||
// @param acceptMatchRequest The request of AcceptMatch operation
|
||||
virtual void AcceptMatch(const AcceptMatchRequest& acceptMatchRequest) = 0;
|
||||
|
||||
// Create a game match for a group of players.
|
||||
// @param startMatchmakingRequest The request of StartMatchmaking operation
|
||||
// @return A unique identifier for a matchmaking ticket
|
||||
virtual AZStd::string StartMatchmaking(const StartMatchmakingRequest& startMatchmakingRequest) = 0;
|
||||
|
||||
// Cancels a matchmaking ticket that is currently being processed.
|
||||
// @param stopMatchmakingRequest The request of StopMatchmaking operation
|
||||
virtual void StopMatchmaking(const StopMatchmakingRequest& stopMatchmakingRequest) = 0;
|
||||
};
|
||||
|
||||
//! IMatchmakingAsyncRequests
|
||||
//! Async version of IMatchmakingRequests
|
||||
class IMatchmakingAsyncRequests
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(ISessionAsyncRequests, "{53513480-2D02-493C-B44E-96AA27F42429}");
|
||||
|
||||
IMatchmakingAsyncRequests() = default;
|
||||
virtual ~IMatchmakingAsyncRequests() = default;
|
||||
|
||||
// AcceptMatch Async
|
||||
// @param acceptMatchRequest The request of AcceptMatch operation
|
||||
virtual void AcceptMatchAsync(const AcceptMatchRequest& acceptMatchRequest) = 0;
|
||||
|
||||
// StartMatchmaking Async
|
||||
// @param startMatchmakingRequest The request of StartMatchmaking operation
|
||||
virtual void StartMatchmakingAsync(const StartMatchmakingRequest& startMatchmakingRequest) = 0;
|
||||
|
||||
// StopMatchmaking Async
|
||||
// @param stopMatchmakingRequest The request of StopMatchmaking operation
|
||||
virtual void StopMatchmakingAsync(const StopMatchmakingRequest& stopMatchmakingRequest) = 0;
|
||||
};
|
||||
} // namespace AzFramework
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/EBus/EBus.h>
|
||||
#include <AzCore/std/string/string.h>
|
||||
|
||||
namespace AzFramework
|
||||
{
|
||||
//! MatchmakingAsyncRequestNotifications
|
||||
//! The notifications correspond to matchmaking async requests
|
||||
class MatchmakingAsyncRequestNotifications
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
// Safeguard handler for multi-threaded use case
|
||||
using MutexType = AZStd::recursive_mutex;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// EBusTraits overrides
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Multiple;
|
||||
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// OnAcceptMatchAsyncComplete is fired once AcceptMatchAsync completes
|
||||
virtual void OnAcceptMatchAsyncComplete() = 0;
|
||||
|
||||
// OnStartMatchmakingAsyncComplete is fired once StartMatchmakingAsync completes
|
||||
// @param matchmakingTicketId The unique identifier for the matchmaking ticket
|
||||
virtual void OnStartMatchmakingAsyncComplete(const AZStd::string& matchmakingTicketId) = 0;
|
||||
|
||||
// OnStopMatchmakingAsyncComplete is fired once StopMatchmakingAsync completes
|
||||
virtual void OnStopMatchmakingAsyncComplete() = 0;
|
||||
};
|
||||
using MatchmakingAsyncRequestNotificationBus = AZ::EBus<MatchmakingAsyncRequestNotifications>;
|
||||
|
||||
//! MatchmakingNotifications
|
||||
//! The matchmaking notifications to listen for performing required operations
|
||||
class MatchAcceptanceNotifications
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
// Safeguard handler for multi-threaded use case
|
||||
using MutexType = AZStd::recursive_mutex;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// EBusTraits overrides
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Multiple;
|
||||
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// OnMatchAcceptance is fired when DescribeMatchmaking ticket status is REQUIRES_ACCEPTANCE
|
||||
virtual void OnMatchAcceptance() = 0;
|
||||
};
|
||||
using MatchAcceptanceNotificationBus = AZ::EBus<MatchAcceptanceNotifications>;
|
||||
} // namespace AzFramework
|
||||
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AzCore/RTTI/ReflectContext.h>
|
||||
#include <AzCore/Serialization/EditContext.h>
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
#include <AzFramework/Matchmaking/MatchmakingRequests.h>
|
||||
|
||||
namespace AzFramework
|
||||
{
|
||||
void AcceptMatchRequest::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
|
||||
{
|
||||
serializeContext->Class<AcceptMatchRequest>()
|
||||
->Version(0)
|
||||
->Field("acceptMatch", &AcceptMatchRequest::m_acceptMatch)
|
||||
->Field("playerIds", &AcceptMatchRequest::m_playerIds)
|
||||
->Field("ticketId", &AcceptMatchRequest::m_ticketId);
|
||||
|
||||
if (AZ::EditContext* editContext = serializeContext->GetEditContext())
|
||||
{
|
||||
editContext->Class<AcceptMatchRequest>("AcceptMatchRequest", "The container for AcceptMatch request parameters")
|
||||
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
|
||||
->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &AcceptMatchRequest::m_acceptMatch, "AcceptMatch",
|
||||
"Player response to accept or reject match")
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &AcceptMatchRequest::m_playerIds, "PlayerIds",
|
||||
"A list of unique identifiers for players delivering the response")
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &AcceptMatchRequest::m_ticketId, "TicketId",
|
||||
"A unique identifier for a matchmaking ticket");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void StartMatchmakingRequest::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
|
||||
{
|
||||
serializeContext->Class<StartMatchmakingRequest>()
|
||||
->Version(0)
|
||||
->Field("ticketId", &StartMatchmakingRequest::m_ticketId);
|
||||
|
||||
if (AZ::EditContext* editContext = serializeContext->GetEditContext())
|
||||
{
|
||||
editContext->Class<StartMatchmakingRequest>("StartMatchmakingRequest", "The container for StartMatchmaking request parameters")
|
||||
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
|
||||
->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &StartMatchmakingRequest::m_ticketId, "TicketId",
|
||||
"A unique identifier for a matchmaking ticket");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void StopMatchmakingRequest::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
|
||||
{
|
||||
serializeContext->Class<StopMatchmakingRequest>()
|
||||
->Version(0)
|
||||
->Field("ticketId", &StopMatchmakingRequest::m_ticketId);
|
||||
|
||||
if (AZ::EditContext* editContext = serializeContext->GetEditContext())
|
||||
{
|
||||
editContext->Class<StopMatchmakingRequest>("StopMatchmakingRequest", "The container for StopMatchmaking request parameters")
|
||||
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
|
||||
->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &StopMatchmakingRequest::m_ticketId, "TicketId",
|
||||
"A unique identifier for a matchmaking ticket");
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace AzFramework
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/RTTI/RTTI.h>
|
||||
#include <AzCore/std/string/string.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
class ReflectContext;
|
||||
}
|
||||
|
||||
namespace AzFramework
|
||||
{
|
||||
//! AcceptMatchRequest
|
||||
//! The container for AcceptMatch request parameters.
|
||||
struct AcceptMatchRequest
|
||||
{
|
||||
AZ_RTTI(AcceptMatchRequest, "{AD289D76-CEE2-424F-847E-E62AA83B7D79}");
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
|
||||
AcceptMatchRequest() = default;
|
||||
virtual ~AcceptMatchRequest() = default;
|
||||
|
||||
// Player response to accept or reject match
|
||||
bool m_acceptMatch;
|
||||
// A list of unique identifiers for players delivering the response
|
||||
AZStd::vector<AZStd::string> m_playerIds;
|
||||
// A unique identifier for a matchmaking ticket
|
||||
AZStd::string m_ticketId;
|
||||
};
|
||||
|
||||
//! StartMatchmakingRequest
|
||||
//! The container for StartMatchmaking request parameters.
|
||||
struct StartMatchmakingRequest
|
||||
{
|
||||
AZ_RTTI(StartMatchmakingRequest, "{70B47776-E8E7-4993-BEC3-5CAEC3D48E47}");
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
|
||||
StartMatchmakingRequest() = default;
|
||||
virtual ~StartMatchmakingRequest() = default;
|
||||
|
||||
// A unique identifier for a matchmaking ticket
|
||||
AZStd::string m_ticketId;
|
||||
};
|
||||
|
||||
//! StopMatchmakingRequest
|
||||
//! The container for StopMatchmaking request parameters.
|
||||
struct StopMatchmakingRequest
|
||||
{
|
||||
AZ_RTTI(StopMatchmakingRequest, "{6132E293-65EF-4DC2-A8A0-00269697229D}");
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
|
||||
StopMatchmakingRequest() = default;
|
||||
virtual ~StopMatchmakingRequest() = default;
|
||||
|
||||
// A unique identifier for a matchmaking ticket
|
||||
AZStd::string m_ticketId;
|
||||
};
|
||||
} // namespace AzFramework
|
||||
@@ -10,98 +10,11 @@
|
||||
|
||||
#include <AzCore/EBus/EBus.h>
|
||||
#include <AzCore/RTTI/ReflectContext.h>
|
||||
#include <AzCore/std/containers/unordered_map.h>
|
||||
#include <AzCore/std/string/string.h>
|
||||
#include <AzCore/Outcome/Outcome.h>
|
||||
#include <AzFramework/Session/SessionRequests.h>
|
||||
|
||||
namespace AzFramework
|
||||
{
|
||||
struct SessionConfig;
|
||||
|
||||
//! CreateSessionRequest
|
||||
//! The container for CreateSession request parameters.
|
||||
struct CreateSessionRequest
|
||||
{
|
||||
AZ_RTTI(CreateSessionRequest, "{E39C2A45-89C9-4CFB-B337-9734DC798930}");
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
|
||||
CreateSessionRequest() = default;
|
||||
virtual ~CreateSessionRequest() = default;
|
||||
|
||||
// A unique identifier for a player or entity creating the session.
|
||||
AZStd::string m_creatorId;
|
||||
|
||||
// A collection of custom properties for a session.
|
||||
AZStd::unordered_map<AZStd::string, AZStd::string> m_sessionProperties;
|
||||
|
||||
// A descriptive label that is associated with a session.
|
||||
AZStd::string m_sessionName;
|
||||
|
||||
// The maximum number of players that can be connected simultaneously to the session.
|
||||
uint64_t m_maxPlayer = 0;
|
||||
};
|
||||
|
||||
//! SearchSessionsRequest
|
||||
//! The container for SearchSessions request parameters.
|
||||
struct SearchSessionsRequest
|
||||
{
|
||||
AZ_RTTI(SearchSessionsRequest, "{B49207A8-8549-4ADB-B7D9-D7A4932F9B4B}");
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
|
||||
SearchSessionsRequest() = default;
|
||||
virtual ~SearchSessionsRequest() = default;
|
||||
|
||||
// String containing the search criteria for the session search. If no filter expression is included, the request returns results
|
||||
// for all active sessions.
|
||||
AZStd::string m_filterExpression;
|
||||
|
||||
// Instructions on how to sort the search results. If no sort expression is included, the request returns results in random order.
|
||||
AZStd::string m_sortExpression;
|
||||
|
||||
// The maximum number of results to return.
|
||||
uint8_t m_maxResult = 0;
|
||||
|
||||
// A token that indicates the start of the next sequential page of results.
|
||||
AZStd::string m_nextToken;
|
||||
};
|
||||
|
||||
//! SearchSessionsResponse
|
||||
//! The container for SearchSession request results.
|
||||
struct SearchSessionsResponse
|
||||
{
|
||||
AZ_RTTI(SearchSessionsResponse, "{F93DE7DC-D381-4E08-8A3B-0B08F7C38714}");
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
|
||||
SearchSessionsResponse() = default;
|
||||
virtual ~SearchSessionsResponse() = default;
|
||||
|
||||
// A collection of sessions that match the search criteria and sorted in specific order.
|
||||
AZStd::vector<SessionConfig> m_sessionConfigs;
|
||||
|
||||
// A token that indicates the start of the next sequential page of results.
|
||||
AZStd::string m_nextToken;
|
||||
};
|
||||
|
||||
//! JoinSessionRequest
|
||||
//! The container for JoinSession request parameters.
|
||||
struct JoinSessionRequest
|
||||
{
|
||||
AZ_RTTI(JoinSessionRequest, "{519769E8-3CDE-4385-A0D7-24DBB3685657}");
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
|
||||
JoinSessionRequest() = default;
|
||||
virtual ~JoinSessionRequest() = default;
|
||||
|
||||
// A unique identifier for the session.
|
||||
AZStd::string m_sessionId;
|
||||
|
||||
// A unique identifier for a player. Player IDs are developer-defined.
|
||||
AZStd::string m_playerId;
|
||||
|
||||
// Developer-defined information related to a player.
|
||||
AZStd::string m_playerData;
|
||||
};
|
||||
|
||||
//! ISessionRequests
|
||||
//! Pure virtual session interface class to abstract the details of session handling from application code.
|
||||
class ISessionRequests
|
||||
|
||||
+2
-1
@@ -6,9 +6,10 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AzCore/RTTI/ReflectContext.h>
|
||||
#include <AzCore/Serialization/EditContext.h>
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
#include <AzFramework/Session/ISessionRequests.h>
|
||||
#include <AzFramework/Session/SessionRequests.h>
|
||||
#include <AzFramework/Session/SessionConfig.h>
|
||||
|
||||
namespace AzFramework
|
||||
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/RTTI/RTTI.h>
|
||||
#include <AzCore/std/containers/unordered_map.h>
|
||||
#include <AzCore/std/string/string.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
class ReflectContext;
|
||||
}
|
||||
|
||||
namespace AzFramework
|
||||
{
|
||||
struct SessionConfig;
|
||||
|
||||
//! CreateSessionRequest
|
||||
//! The container for CreateSession request parameters.
|
||||
struct CreateSessionRequest
|
||||
{
|
||||
AZ_RTTI(CreateSessionRequest, "{E39C2A45-89C9-4CFB-B337-9734DC798930}");
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
|
||||
CreateSessionRequest() = default;
|
||||
virtual ~CreateSessionRequest() = default;
|
||||
|
||||
// A unique identifier for a player or entity creating the session.
|
||||
AZStd::string m_creatorId;
|
||||
|
||||
// A collection of custom properties for a session.
|
||||
AZStd::unordered_map<AZStd::string, AZStd::string> m_sessionProperties;
|
||||
|
||||
// A descriptive label that is associated with a session.
|
||||
AZStd::string m_sessionName;
|
||||
|
||||
// The maximum number of players that can be connected simultaneously to the session.
|
||||
uint64_t m_maxPlayer = 0;
|
||||
};
|
||||
|
||||
//! SearchSessionsRequest
|
||||
//! The container for SearchSessions request parameters.
|
||||
struct SearchSessionsRequest
|
||||
{
|
||||
AZ_RTTI(SearchSessionsRequest, "{B49207A8-8549-4ADB-B7D9-D7A4932F9B4B}");
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
|
||||
SearchSessionsRequest() = default;
|
||||
virtual ~SearchSessionsRequest() = default;
|
||||
|
||||
// String containing the search criteria for the session search. If no filter expression is included, the request returns results
|
||||
// for all active sessions.
|
||||
AZStd::string m_filterExpression;
|
||||
|
||||
// Instructions on how to sort the search results. If no sort expression is included, the request returns results in random order.
|
||||
AZStd::string m_sortExpression;
|
||||
|
||||
// The maximum number of results to return.
|
||||
uint8_t m_maxResult = 0;
|
||||
|
||||
// A token that indicates the start of the next sequential page of results.
|
||||
AZStd::string m_nextToken;
|
||||
};
|
||||
|
||||
//! SearchSessionsResponse
|
||||
//! The container for SearchSession request results.
|
||||
struct SearchSessionsResponse
|
||||
{
|
||||
AZ_RTTI(SearchSessionsResponse, "{F93DE7DC-D381-4E08-8A3B-0B08F7C38714}");
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
|
||||
SearchSessionsResponse() = default;
|
||||
virtual ~SearchSessionsResponse() = default;
|
||||
|
||||
// A collection of sessions that match the search criteria and sorted in specific order.
|
||||
AZStd::vector<SessionConfig> m_sessionConfigs;
|
||||
|
||||
// A token that indicates the start of the next sequential page of results.
|
||||
AZStd::string m_nextToken;
|
||||
};
|
||||
|
||||
//! JoinSessionRequest
|
||||
//! The container for JoinSession request parameters.
|
||||
struct JoinSessionRequest
|
||||
{
|
||||
AZ_RTTI(JoinSessionRequest, "{519769E8-3CDE-4385-A0D7-24DBB3685657}");
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
|
||||
JoinSessionRequest() = default;
|
||||
virtual ~JoinSessionRequest() = default;
|
||||
|
||||
// A unique identifier for the session.
|
||||
AZStd::string m_sessionId;
|
||||
|
||||
// A unique identifier for a player. Player IDs are developer-defined.
|
||||
AZStd::string m_playerId;
|
||||
|
||||
// Developer-defined information related to a player.
|
||||
AZStd::string m_playerData;
|
||||
};
|
||||
} // namespace AzFramework
|
||||
@@ -167,6 +167,10 @@ set(FILES
|
||||
Logging/MissingAssetLogger.cpp
|
||||
Logging/MissingAssetLogger.h
|
||||
Logging/MissingAssetNotificationBus.h
|
||||
Matchmaking/IMatchmakingRequests.h
|
||||
Matchmaking/MatchmakingRequests.cpp
|
||||
Matchmaking/MatchmakingRequests.h
|
||||
Matchmaking/MatchmakingNotifications.h
|
||||
Scene/Scene.h
|
||||
Scene/Scene.inl
|
||||
Scene/Scene.cpp
|
||||
@@ -181,8 +185,9 @@ set(FILES
|
||||
Script/ScriptRemoteDebugging.cpp
|
||||
Script/ScriptRemoteDebugging.h
|
||||
Session/ISessionHandlingRequests.h
|
||||
Session/ISessionRequests.cpp
|
||||
Session/ISessionRequests.h
|
||||
Session/SessionRequests.cpp
|
||||
Session/SessionRequests.h
|
||||
Session/SessionConfig.cpp
|
||||
Session/SessionConfig.h
|
||||
Session/SessionNotifications.h
|
||||
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzFramework/Matchmaking/MatchmakingRequests.h>
|
||||
|
||||
namespace AWSGameLift
|
||||
{
|
||||
//! AWSGameLiftAcceptMatchRequest
|
||||
//! GameLift accept match request which corresponds to Amazon GameLift
|
||||
//! Registers a player's acceptance or rejection of a proposed FlexMatch match.
|
||||
//! AcceptMatchRequest
|
||||
struct AWSGameLiftAcceptMatchRequest
|
||||
: public AzFramework::AcceptMatchRequest
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(AWSGameLiftAcceptMatchRequest, "{8372B297-88E8-4C13-B31D-BE87236CA416}", AzFramework::AcceptMatchRequest);
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
|
||||
AWSGameLiftAcceptMatchRequest() = default;
|
||||
virtual ~AWSGameLiftAcceptMatchRequest() = default;
|
||||
};
|
||||
} // namespace AWSGameLift
|
||||
+1
-1
@@ -8,7 +8,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzFramework/Session/ISessionRequests.h>
|
||||
#include <AzFramework/Session/SessionRequests.h>
|
||||
|
||||
namespace AWSGameLift
|
||||
{
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzFramework/Session/ISessionRequests.h>
|
||||
#include <AzFramework/Session/SessionRequests.h>
|
||||
|
||||
namespace AWSGameLift
|
||||
{
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzFramework/Session/ISessionRequests.h>
|
||||
#include <AzFramework/Session/SessionRequests.h>
|
||||
|
||||
namespace AWSGameLift
|
||||
{
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzFramework/Session/ISessionRequests.h>
|
||||
#include <AzFramework/Session/SessionRequests.h>
|
||||
|
||||
namespace AWSGameLift
|
||||
{
|
||||
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzFramework/Matchmaking/MatchmakingRequests.h>
|
||||
|
||||
namespace AWSGameLift
|
||||
{
|
||||
//! AWSGameLiftPlayerInformation
|
||||
//! Information on each player to be matched
|
||||
//! This information must include a player ID, and may contain player attributes and latency data to be used in the matchmaking process
|
||||
//! After a successful match, Player objects contain the name of the team the player is assigned to
|
||||
struct AWSGameLiftPlayerInformation
|
||||
{
|
||||
AZ_RTTI(AWSGameLiftPlayerInformation, "{B62C118E-C55D-4903-8ECB-E58E8CA613C4}");
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
|
||||
AWSGameLiftPlayerInformation() = default;
|
||||
virtual ~AWSGameLiftPlayerInformation() = default;
|
||||
|
||||
// A map of region names to latencies in millseconds, that indicates
|
||||
// the amount of latency that a player experiences when connected to AWS Regions
|
||||
AZStd::unordered_map<AZStd::string, int> m_latencyInMs;
|
||||
// A collection of key:value pairs containing player information for use in matchmaking
|
||||
// Player attribute keys must match the playerAttributes used in a matchmaking rule set
|
||||
// Example: {"skill": "{\"N\": \"23\"}", "gameMode": "{\"S\": \"deathmatch\"}"}
|
||||
AZStd::unordered_map<AZStd::string, AZStd::string> m_playerAttributes;
|
||||
// A unique identifier for a player
|
||||
AZStd::string m_playerId;
|
||||
// Name of the team that the player is assigned to in a match
|
||||
AZStd::string m_team;
|
||||
};
|
||||
|
||||
//! AWSGameLiftStartMatchmakingRequest
|
||||
//! GameLift start matchmaking request which corresponds to Amazon GameLift
|
||||
//! Uses FlexMatch to create a game match for a group of players based on custom matchmaking rules
|
||||
//! StartMatchmakingRequest
|
||||
struct AWSGameLiftStartMatchmakingRequest
|
||||
: public AzFramework::StartMatchmakingRequest
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(AWSGameLiftStartMatchmakingRequest, "{D273DF71-9C55-48C1-95F9-8D7B66B9CF3E}", AzFramework::StartMatchmakingRequest);
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
|
||||
AWSGameLiftStartMatchmakingRequest() = default;
|
||||
virtual ~AWSGameLiftStartMatchmakingRequest() = default;
|
||||
|
||||
// Name of the matchmaking configuration to use for this request
|
||||
AZStd::string m_configurationName;
|
||||
// Information on each player to be matched
|
||||
AZStd::vector<AWSGameLiftPlayerInformation> m_players;
|
||||
};
|
||||
} // namespace AWSGameLift
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzFramework/Matchmaking/MatchmakingRequests.h>
|
||||
|
||||
namespace AWSGameLift
|
||||
{
|
||||
//! AWSGameLiftStopMatchmakingRequest
|
||||
//! GameLift stop matchmaking request which corresponds to Amazon GameLift
|
||||
//! Cancels a matchmaking ticket or match backfill ticket that is currently being processed.
|
||||
//! StopMatchmakingRequest
|
||||
struct AWSGameLiftStopMatchmakingRequest
|
||||
: public AzFramework::StopMatchmakingRequest
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(AWSGameLiftStopMatchmakingRequest, "{2766BC03-9F84-4346-A52B-49129BBAF38B}", AzFramework::StopMatchmakingRequest);
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
|
||||
AWSGameLiftStopMatchmakingRequest() = default;
|
||||
virtual ~AWSGameLiftStopMatchmakingRequest() = default;
|
||||
};
|
||||
} // namespace AWSGameLift
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <AzCore/EBus/EBus.h>
|
||||
#include <AzCore/RTTI/BehaviorContext.h>
|
||||
#include <AzCore/std/string/string.h>
|
||||
#include <AzFramework/Matchmaking/IMatchmakingRequests.h>
|
||||
#include <AzFramework/Session/ISessionRequests.h>
|
||||
|
||||
namespace AWSGameLift
|
||||
@@ -71,4 +72,26 @@ namespace AWSGameLift
|
||||
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
|
||||
};
|
||||
using AWSGameLiftSessionRequestBus = AZ::EBus<AzFramework::ISessionRequests, AWSGameLiftSessionRequests>;
|
||||
|
||||
// IMatchmakingAsyncRequests EBus wrapper for scripting
|
||||
class AWSGameLiftMatchmakingAsyncRequests
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
using MutexType = AZStd::recursive_mutex;
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
|
||||
};
|
||||
using AWSGameLiftMatchmakingAsyncRequestBus = AZ::EBus<AzFramework::IMatchmakingAsyncRequests, AWSGameLiftMatchmakingAsyncRequests>;
|
||||
|
||||
// IMatchmakingRequests EBus wrapper for scripting
|
||||
class AWSGameLiftMatchmakingRequests
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
using MutexType = AZStd::recursive_mutex;
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
|
||||
};
|
||||
using AWSGameLiftMatchmakingRequestBus = AZ::EBus<AzFramework::IMatchmakingRequests, AWSGameLiftMatchmakingRequests>;
|
||||
} // namespace AWSGameLift
|
||||
|
||||
@@ -112,6 +112,16 @@ namespace AWSGameLift
|
||||
return AZ::Uuid::CreateRandom().ToString<AZStd::string>(includeBrackets, includeDashes);
|
||||
}
|
||||
|
||||
void AWSGameLiftClientManager::AcceptMatch(const AzFramework::AcceptMatchRequest& acceptMatchRequest)
|
||||
{
|
||||
AZ_UNUSED(acceptMatchRequest);
|
||||
}
|
||||
|
||||
void AWSGameLiftClientManager::AcceptMatchAsync(const AzFramework::AcceptMatchRequest& acceptMatchRequest)
|
||||
{
|
||||
AZ_UNUSED(acceptMatchRequest);
|
||||
}
|
||||
|
||||
AZStd::string AWSGameLiftClientManager::CreateSession(const AzFramework::CreateSessionRequest& createSessionRequest)
|
||||
{
|
||||
AZStd::string result = "";
|
||||
@@ -349,6 +359,28 @@ namespace AWSGameLift
|
||||
return response;
|
||||
}
|
||||
|
||||
AZStd::string AWSGameLiftClientManager::StartMatchmaking(const AzFramework::StartMatchmakingRequest& startMatchmakingRequest)
|
||||
{
|
||||
AZ_UNUSED(startMatchmakingRequest);
|
||||
|
||||
return AZStd::string{};
|
||||
}
|
||||
|
||||
void AWSGameLiftClientManager::StartMatchmakingAsync(const AzFramework::StartMatchmakingRequest& startMatchmakingRequest)
|
||||
{
|
||||
AZ_UNUSED(startMatchmakingRequest);
|
||||
}
|
||||
|
||||
void AWSGameLiftClientManager::StopMatchmaking(const AzFramework::StopMatchmakingRequest& stopMatchmakingRequest)
|
||||
{
|
||||
AZ_UNUSED(stopMatchmakingRequest);
|
||||
}
|
||||
|
||||
void AWSGameLiftClientManager::StopMatchmakingAsync(const AzFramework::StopMatchmakingRequest& stopMatchmakingRequest)
|
||||
{
|
||||
AZ_UNUSED(stopMatchmakingRequest);
|
||||
}
|
||||
|
||||
void AWSGameLiftClientManager::SetGameLiftClient(AZStd::shared_ptr<Aws::GameLift::GameLiftClient> gameliftClient)
|
||||
{
|
||||
m_gameliftClient.swap(gameliftClient);
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/std/smart_ptr/shared_ptr.h>
|
||||
#include <AzFramework/Matchmaking/MatchmakingNotifications.h>
|
||||
|
||||
#include <Request/IAWSGameLiftRequests.h>
|
||||
|
||||
namespace Aws
|
||||
@@ -26,6 +28,54 @@ namespace AWSGameLift
|
||||
struct AWSGameLiftJoinSessionRequest;
|
||||
struct AWSGameLiftSearchSessionsRequest;
|
||||
|
||||
// MatchAcceptanceNotificationBus EBus handler for scripting
|
||||
class AWSGameLiftMatchAcceptanceNotificationBusHandler
|
||||
: public AzFramework::MatchAcceptanceNotificationBus::Handler
|
||||
, public AZ::BehaviorEBusHandler
|
||||
{
|
||||
public:
|
||||
AZ_EBUS_BEHAVIOR_BINDER(
|
||||
AWSGameLiftMatchAcceptanceNotificationBusHandler,
|
||||
"{CBE057D3-F5CE-46D3-B02D-8A6A1446B169}",
|
||||
AZ::SystemAllocator,
|
||||
OnMatchAcceptance);
|
||||
|
||||
void OnMatchAcceptance() override
|
||||
{
|
||||
Call(FN_OnMatchAcceptance);
|
||||
}
|
||||
};
|
||||
|
||||
// MatchmakingAsyncRequestNotificationBus EBus handler for scripting
|
||||
class AWSGameLiftMatchmakingAsyncRequestNotificationBusHandler
|
||||
: public AzFramework::MatchmakingAsyncRequestNotificationBus::Handler
|
||||
, public AZ::BehaviorEBusHandler
|
||||
{
|
||||
public:
|
||||
AZ_EBUS_BEHAVIOR_BINDER(
|
||||
AWSGameLiftMatchmakingAsyncRequestNotificationBusHandler,
|
||||
"{2045EE8F-2AB7-4ED0-9614-3496A1A43677}",
|
||||
AZ::SystemAllocator,
|
||||
OnAcceptMatchAsyncComplete,
|
||||
OnStartMatchmakingAsyncComplete,
|
||||
OnStopMatchmakingAsyncComplete);
|
||||
|
||||
void OnAcceptMatchAsyncComplete() override
|
||||
{
|
||||
Call(FN_OnAcceptMatchAsyncComplete);
|
||||
}
|
||||
|
||||
void OnStartMatchmakingAsyncComplete(const AZStd::string& matchmakingTicketId) override
|
||||
{
|
||||
Call(FN_OnStartMatchmakingAsyncComplete, matchmakingTicketId);
|
||||
}
|
||||
|
||||
void OnStopMatchmakingAsyncComplete() override
|
||||
{
|
||||
Call(FN_OnStopMatchmakingAsyncComplete);
|
||||
}
|
||||
};
|
||||
|
||||
// SessionAsyncRequestNotificationBus EBus handler for scripting
|
||||
class AWSGameLiftSessionAsyncRequestNotificationBusHandler
|
||||
: public AzFramework::SessionAsyncRequestNotificationBus::Handler
|
||||
@@ -66,6 +116,8 @@ namespace AWSGameLift
|
||||
//! GameLift client manager to support game and player session related client requests
|
||||
class AWSGameLiftClientManager
|
||||
: public AWSGameLiftRequestBus::Handler
|
||||
, public AWSGameLiftMatchmakingAsyncRequestBus::Handler
|
||||
, public AWSGameLiftMatchmakingRequestBus::Handler
|
||||
, public AWSGameLiftSessionAsyncRequestBus::Handler
|
||||
, public AWSGameLiftSessionRequestBus::Handler
|
||||
{
|
||||
@@ -91,12 +143,22 @@ namespace AWSGameLift
|
||||
bool ConfigureGameLiftClient(const AZStd::string& region) override;
|
||||
AZStd::string CreatePlayerId(bool includeBrackets, bool includeDashes) override;
|
||||
|
||||
// AWSGameLiftMatchmakingAsyncRequestBus interface implementation
|
||||
void AcceptMatchAsync(const AzFramework::AcceptMatchRequest& acceptMatchRequest) override;
|
||||
void StartMatchmakingAsync(const AzFramework::StartMatchmakingRequest& startMatchmakingRequest) override;
|
||||
void StopMatchmakingAsync(const AzFramework::StopMatchmakingRequest& stopMatchmakingRequest) override;
|
||||
|
||||
// AWSGameLiftSessionAsyncRequestBus interface implementation
|
||||
void CreateSessionAsync(const AzFramework::CreateSessionRequest& createSessionRequest) override;
|
||||
void JoinSessionAsync(const AzFramework::JoinSessionRequest& joinSessionRequest) override;
|
||||
void SearchSessionsAsync(const AzFramework::SearchSessionsRequest& searchSessionsRequest) const override;
|
||||
void LeaveSessionAsync() override;
|
||||
|
||||
// AWSGameLiftMatchmakingRequestBus interface implementation
|
||||
void AcceptMatch(const AzFramework::AcceptMatchRequest& acceptMatchRequest) override;
|
||||
AZStd::string StartMatchmaking(const AzFramework::StartMatchmakingRequest& startMatchmakingRequest) override;
|
||||
void StopMatchmaking(const AzFramework::StopMatchmakingRequest& stopMatchmakingRequest) override;
|
||||
|
||||
// AWSGameLiftSessionRequestBus interface implementation
|
||||
AZStd::string CreateSession(const AzFramework::CreateSessionRequest& createSessionRequest) override;
|
||||
bool JoinSession(const AzFramework::JoinSessionRequest& joinSessionRequest) override;
|
||||
|
||||
+76
-37
@@ -13,10 +13,13 @@
|
||||
|
||||
#include <AWSGameLiftClientManager.h>
|
||||
#include <AWSGameLiftClientSystemComponent.h>
|
||||
#include <Request/AWSGameLiftAcceptMatchRequest.h>
|
||||
#include <Request/AWSGameLiftCreateSessionOnQueueRequest.h>
|
||||
#include <Request/AWSGameLiftCreateSessionRequest.h>
|
||||
#include <Request/AWSGameLiftJoinSessionRequest.h>
|
||||
#include <Request/AWSGameLiftSearchSessionsRequest.h>
|
||||
#include <Request/AWSGameLiftStartMatchmakingRequest.h>
|
||||
#include <Request/AWSGameLiftStopMatchmakingRequest.h>
|
||||
|
||||
#include <aws/gamelift/GameLiftClient.h>
|
||||
|
||||
@@ -29,18 +32,13 @@ namespace AWSGameLift
|
||||
|
||||
void AWSGameLiftClientSystemComponent::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
ReflectCreateSessionRequest(context);
|
||||
AWSGameLiftCreateSessionOnQueueRequest::Reflect(context);
|
||||
AWSGameLiftCreateSessionRequest::Reflect(context);
|
||||
AWSGameLiftJoinSessionRequest::Reflect(context);
|
||||
AWSGameLiftSearchSessionsRequest::Reflect(context);
|
||||
ReflectSearchSessionsResponse(context);
|
||||
ReflectGameLiftMatchmaking(context);
|
||||
ReflectGameLiftSession(context);
|
||||
|
||||
if (AZ::SerializeContext* serialize = azrtti_cast<AZ::SerializeContext*>(context))
|
||||
{
|
||||
serialize->Class<AWSGameLiftClientSystemComponent, AZ::Component>()
|
||||
->Version(0)
|
||||
;
|
||||
->Version(1);
|
||||
|
||||
if (AZ::EditContext* editContext = serialize->GetEditContext())
|
||||
{
|
||||
@@ -50,8 +48,7 @@ namespace AWSGameLift
|
||||
"Create the GameLift client manager that handles communication between game clients and the GameLift service.")
|
||||
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
|
||||
->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("System"))
|
||||
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
|
||||
;
|
||||
->Attribute(AZ::Edit::Attributes::AutoExpand, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,33 +60,7 @@ namespace AWSGameLift
|
||||
{{{"Region", ""}}})
|
||||
->Event("CreatePlayerId", &AWSGameLiftRequestBus::Events::CreatePlayerId,
|
||||
{{{"IncludeBrackets", ""},
|
||||
{"IncludeDashes", ""}}})
|
||||
;
|
||||
behaviorContext->EBus<AWSGameLiftSessionAsyncRequestBus>("AWSGameLiftSessionAsyncRequestBus")
|
||||
->Attribute(AZ::Script::Attributes::Category, "AWSGameLift")
|
||||
->Event("CreateSessionAsync", &AWSGameLiftSessionAsyncRequestBus::Events::CreateSessionAsync,
|
||||
{{{"CreateSessionRequest", ""}}})
|
||||
->Event("JoinSessionAsync", &AWSGameLiftSessionAsyncRequestBus::Events::JoinSessionAsync,
|
||||
{{{"JoinSessionRequest", ""}}})
|
||||
->Event("SearchSessionsAsync", &AWSGameLiftSessionAsyncRequestBus::Events::SearchSessionsAsync,
|
||||
{{{"SearchSessionsRequest", ""}}})
|
||||
->Event("LeaveSessionAsync", &AWSGameLiftSessionAsyncRequestBus::Events::LeaveSessionAsync)
|
||||
;
|
||||
behaviorContext
|
||||
->EBus<AzFramework::SessionAsyncRequestNotificationBus>("AWSGameLiftSessionAsyncRequestNotificationBus")
|
||||
->Attribute(AZ::Script::Attributes::Category, "AWSGameLift")
|
||||
->Handler<AWSGameLiftSessionAsyncRequestNotificationBusHandler>()
|
||||
;
|
||||
behaviorContext->EBus<AWSGameLiftSessionRequestBus>("AWSGameLiftSessionRequestBus")
|
||||
->Attribute(AZ::Script::Attributes::Category, "AWSGameLift")
|
||||
->Event("CreateSession", &AWSGameLiftSessionRequestBus::Events::CreateSession,
|
||||
{{{"CreateSessionRequest", ""}}})
|
||||
->Event("JoinSession", &AWSGameLiftSessionRequestBus::Events::JoinSession,
|
||||
{{{"JoinSessionRequest", ""}}})
|
||||
->Event("SearchSessions", &AWSGameLiftSessionRequestBus::Events::SearchSessions,
|
||||
{{{"SearchSessionsRequest", ""}}})
|
||||
->Event("LeaveSession", &AWSGameLiftSessionRequestBus::Events::LeaveSession)
|
||||
;
|
||||
{"IncludeDashes", ""}}});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,6 +97,74 @@ namespace AWSGameLift
|
||||
{
|
||||
m_gameliftClientManager->DeactivateManager();
|
||||
}
|
||||
|
||||
void AWSGameLiftClientSystemComponent::ReflectGameLiftMatchmaking(AZ::ReflectContext* context)
|
||||
{
|
||||
AWSGameLiftAcceptMatchRequest::Reflect(context);
|
||||
AWSGameLiftStartMatchmakingRequest::Reflect(context);
|
||||
AWSGameLiftStopMatchmakingRequest::Reflect(context);
|
||||
|
||||
if (AZ::BehaviorContext* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
|
||||
{
|
||||
behaviorContext->EBus<AWSGameLiftMatchmakingAsyncRequestBus>("AWSGameLiftMatchmakingAsyncRequestBus")
|
||||
->Attribute(AZ::Script::Attributes::Category, "AWSGameLift")
|
||||
->Event("AcceptMatchAsync", &AWSGameLiftMatchmakingAsyncRequestBus::Events::AcceptMatchAsync,
|
||||
{ { { "AcceptMatchRequest", "" } } })
|
||||
->Event("StartMatchmakingAsync", &AWSGameLiftMatchmakingAsyncRequestBus::Events::StartMatchmakingAsync,
|
||||
{ { { "StartMatchmakingRequest", "" } } })
|
||||
->Event("StopMatchmakingAsync", &AWSGameLiftMatchmakingAsyncRequestBus::Events::StopMatchmakingAsync,
|
||||
{ { { "StopMatchmakingRequest", "" } } });
|
||||
|
||||
behaviorContext->EBus<AzFramework::MatchmakingAsyncRequestNotificationBus>("AWSGameLiftMatchmakingAsyncRequestNotificationBus")
|
||||
->Attribute(AZ::Script::Attributes::Category, "AWSGameLift")
|
||||
->Handler<AWSGameLiftMatchmakingAsyncRequestNotificationBusHandler>();
|
||||
|
||||
behaviorContext->EBus<AWSGameLiftMatchmakingRequestBus>("AWSGameLiftMatchmakingRequestBus")
|
||||
->Attribute(AZ::Script::Attributes::Category, "AWSGameLift")
|
||||
->Event("AcceptMatch", &AWSGameLiftMatchmakingRequestBus::Events::AcceptMatch, { { { "AcceptMatchRequest", "" } } })
|
||||
->Event("StartMatchmaking", &AWSGameLiftMatchmakingRequestBus::Events::StartMatchmaking,
|
||||
{ { { "StartMatchmakingRequest", "" } } })
|
||||
->Event("StopMatchmaking", &AWSGameLiftMatchmakingRequestBus::Events::StopMatchmaking,
|
||||
{ { { "StopMatchmakingRequest", "" } } });
|
||||
|
||||
behaviorContext->EBus<AzFramework::MatchAcceptanceNotificationBus>("AWSGameLiftMatchAcceptanceNotificationBus")
|
||||
->Attribute(AZ::Script::Attributes::Category, "AWSGameLift")
|
||||
->Handler<AWSGameLiftMatchAcceptanceNotificationBusHandler>();
|
||||
}
|
||||
}
|
||||
|
||||
void AWSGameLiftClientSystemComponent::ReflectGameLiftSession(AZ::ReflectContext* context)
|
||||
{
|
||||
ReflectCreateSessionRequest(context);
|
||||
AWSGameLiftCreateSessionOnQueueRequest::Reflect(context);
|
||||
AWSGameLiftCreateSessionRequest::Reflect(context);
|
||||
AWSGameLiftJoinSessionRequest::Reflect(context);
|
||||
AWSGameLiftSearchSessionsRequest::Reflect(context);
|
||||
ReflectSearchSessionsResponse(context);
|
||||
|
||||
if (AZ::BehaviorContext* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
|
||||
{
|
||||
behaviorContext->EBus<AWSGameLiftSessionAsyncRequestBus>("AWSGameLiftSessionAsyncRequestBus")
|
||||
->Attribute(AZ::Script::Attributes::Category, "AWSGameLift")
|
||||
->Event("CreateSessionAsync", &AWSGameLiftSessionAsyncRequestBus::Events::CreateSessionAsync,
|
||||
{ { { "CreateSessionRequest", "" } } })
|
||||
->Event("JoinSessionAsync", &AWSGameLiftSessionAsyncRequestBus::Events::JoinSessionAsync, { { { "JoinSessionRequest", "" } } })
|
||||
->Event("SearchSessionsAsync", &AWSGameLiftSessionAsyncRequestBus::Events::SearchSessionsAsync,
|
||||
{ { { "SearchSessionsRequest", "" } } })
|
||||
->Event("LeaveSessionAsync", &AWSGameLiftSessionAsyncRequestBus::Events::LeaveSessionAsync);
|
||||
|
||||
behaviorContext->EBus<AzFramework::SessionAsyncRequestNotificationBus>("AWSGameLiftSessionAsyncRequestNotificationBus")
|
||||
->Attribute(AZ::Script::Attributes::Category, "AWSGameLift")
|
||||
->Handler<AWSGameLiftSessionAsyncRequestNotificationBusHandler>();
|
||||
|
||||
behaviorContext->EBus<AWSGameLiftSessionRequestBus>("AWSGameLiftSessionRequestBus")
|
||||
->Attribute(AZ::Script::Attributes::Category, "AWSGameLift")
|
||||
->Event("CreateSession", &AWSGameLiftSessionRequestBus::Events::CreateSession, { { { "CreateSessionRequest", "" } } })
|
||||
->Event("JoinSession", &AWSGameLiftSessionRequestBus::Events::JoinSession, { { { "JoinSessionRequest", "" } } })
|
||||
->Event("SearchSessions", &AWSGameLiftSessionRequestBus::Events::SearchSessions, { { { "SearchSessionsRequest", "" } } })
|
||||
->Event("LeaveSession", &AWSGameLiftSessionRequestBus::Events::LeaveSession);
|
||||
}
|
||||
}
|
||||
|
||||
void AWSGameLiftClientSystemComponent::ReflectCreateSessionRequest(AZ::ReflectContext* context)
|
||||
{
|
||||
|
||||
@@ -43,6 +43,9 @@ namespace AWSGameLift
|
||||
void SetGameLiftClientManager(AZStd::unique_ptr<AWSGameLiftClientManager> gameliftClientManager);
|
||||
|
||||
private:
|
||||
static void ReflectGameLiftMatchmaking(AZ::ReflectContext* context);
|
||||
static void ReflectGameLiftSession(AZ::ReflectContext* context);
|
||||
|
||||
static void ReflectCreateSessionRequest(AZ::ReflectContext* context);
|
||||
static void ReflectSearchSessionsResponse(AZ::ReflectContext* context);
|
||||
|
||||
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AzCore/RTTI/BehaviorContext.h>
|
||||
#include <AzCore/Serialization/EditContext.h>
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
|
||||
#include <Request/AWSGameLiftAcceptMatchRequest.h>
|
||||
|
||||
namespace AWSGameLift
|
||||
{
|
||||
void AWSGameLiftAcceptMatchRequest::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
AzFramework::AcceptMatchRequest::Reflect(context);
|
||||
|
||||
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
|
||||
{
|
||||
serializeContext->Class<AWSGameLiftAcceptMatchRequest, AzFramework::AcceptMatchRequest>()
|
||||
->Version(0);
|
||||
|
||||
if (AZ::EditContext* editContext = serializeContext->GetEditContext())
|
||||
{
|
||||
editContext->Class<AWSGameLiftAcceptMatchRequest>("AWSGameLiftAcceptMatchRequest", "")
|
||||
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
|
||||
->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly);
|
||||
}
|
||||
}
|
||||
|
||||
if (AZ::BehaviorContext* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
|
||||
{
|
||||
behaviorContext->Class<AWSGameLiftAcceptMatchRequest>("AWSGameLiftAcceptMatchRequest")
|
||||
->Attribute(AZ::Script::Attributes::Storage, AZ::Script::Attributes::StorageType::Value)
|
||||
->Property("AcceptMatch", BehaviorValueProperty(&AWSGameLiftAcceptMatchRequest::m_acceptMatch))
|
||||
->Property("PlayerIds", BehaviorValueProperty(&AWSGameLiftAcceptMatchRequest::m_playerIds))
|
||||
->Property("TicketId", BehaviorValueProperty(&AWSGameLiftAcceptMatchRequest::m_ticketId));
|
||||
}
|
||||
}
|
||||
} // namespace AWSGameLift
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AzCore/RTTI/BehaviorContext.h>
|
||||
#include <AzCore/Serialization/EditContext.h>
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
|
||||
#include <Request/AWSGameLiftStartMatchmakingRequest.h>
|
||||
|
||||
namespace AWSGameLift
|
||||
{
|
||||
void AWSGameLiftPlayerInformation::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
|
||||
{
|
||||
serializeContext->Class<AWSGameLiftPlayerInformation>()
|
||||
->Version(0)
|
||||
->Field("latencyInMs", &AWSGameLiftPlayerInformation::m_latencyInMs)
|
||||
->Field("playerAttributes", &AWSGameLiftPlayerInformation::m_playerAttributes)
|
||||
->Field("playerId", &AWSGameLiftPlayerInformation::m_playerId)
|
||||
->Field("team", &AWSGameLiftPlayerInformation::m_team);
|
||||
|
||||
if (AZ::EditContext* editContext = serializeContext->GetEditContext())
|
||||
{
|
||||
editContext->Class<AWSGameLiftPlayerInformation>("AWSGameLiftPlayerInformation", "")
|
||||
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
|
||||
->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
|
||||
->DataElement(
|
||||
AZ::Edit::UIHandlers::Default, &AWSGameLiftPlayerInformation::m_latencyInMs, "LatencyInMs",
|
||||
"A set of values, expressed in milliseconds, that indicates the amount of latency that"
|
||||
"a player experiences when connected to AWS Regions")
|
||||
->DataElement(
|
||||
AZ::Edit::UIHandlers::Default, &AWSGameLiftPlayerInformation::m_playerAttributes, "PlayerAttributes",
|
||||
"A collection of key:value pairs containing player information for use in matchmaking")
|
||||
->DataElement(
|
||||
AZ::Edit::UIHandlers::Default, &AWSGameLiftPlayerInformation::m_playerId, "PlayerId",
|
||||
"A unique identifier for a player")
|
||||
->DataElement(
|
||||
AZ::Edit::UIHandlers::Default, &AWSGameLiftPlayerInformation::m_team, "Team",
|
||||
"Name of the team that the player is assigned to in a match");
|
||||
}
|
||||
}
|
||||
|
||||
if (AZ::BehaviorContext* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
|
||||
{
|
||||
behaviorContext->Class<AWSGameLiftPlayerInformation>("AWSGameLiftPlayerInformation")
|
||||
->Attribute(AZ::Script::Attributes::Storage, AZ::Script::Attributes::StorageType::Value)
|
||||
->Property("LatencyInMs", BehaviorValueProperty(&AWSGameLiftPlayerInformation::m_latencyInMs))
|
||||
->Property("PlayerAttributes", BehaviorValueProperty(&AWSGameLiftPlayerInformation::m_playerAttributes))
|
||||
->Property("PlayerId", BehaviorValueProperty(&AWSGameLiftPlayerInformation::m_playerId))
|
||||
->Property("Team", BehaviorValueProperty(&AWSGameLiftPlayerInformation::m_team));
|
||||
}
|
||||
}
|
||||
|
||||
void AWSGameLiftStartMatchmakingRequest::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
AzFramework::StartMatchmakingRequest::Reflect(context);
|
||||
AWSGameLiftPlayerInformation::Reflect(context);
|
||||
|
||||
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
|
||||
{
|
||||
serializeContext->Class<AWSGameLiftStartMatchmakingRequest, AzFramework::StartMatchmakingRequest>()
|
||||
->Version(0)
|
||||
->Field("configurationName", &AWSGameLiftStartMatchmakingRequest::m_configurationName)
|
||||
->Field("players", &AWSGameLiftStartMatchmakingRequest::m_players);
|
||||
|
||||
if (AZ::EditContext* editContext = serializeContext->GetEditContext())
|
||||
{
|
||||
editContext->Class<AWSGameLiftStartMatchmakingRequest>("AWSGameLiftStartMatchmakingRequest", "")
|
||||
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
|
||||
->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &AWSGameLiftStartMatchmakingRequest::m_configurationName, "ConfigurationName",
|
||||
"Name of the matchmaking configuration to use for this request")
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &AWSGameLiftStartMatchmakingRequest::m_players, "Players",
|
||||
"Information on each player to be matched.");
|
||||
}
|
||||
}
|
||||
|
||||
if (AZ::BehaviorContext* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
|
||||
{
|
||||
behaviorContext->Class<AWSGameLiftStartMatchmakingRequest>("AWSGameLiftStartMatchmakingRequest")
|
||||
->Attribute(AZ::Script::Attributes::Storage, AZ::Script::Attributes::StorageType::Value)
|
||||
->Property("TicketId", BehaviorValueProperty(&AWSGameLiftStartMatchmakingRequest::m_ticketId))
|
||||
->Property("ConfigurationName", BehaviorValueProperty(&AWSGameLiftStartMatchmakingRequest::m_configurationName))
|
||||
->Property("Players", BehaviorValueProperty(&AWSGameLiftStartMatchmakingRequest::m_players));
|
||||
}
|
||||
}
|
||||
} // namespace AWSGameLift
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AzCore/RTTI/BehaviorContext.h>
|
||||
#include <AzCore/Serialization/EditContext.h>
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
|
||||
#include <Request/AWSGameLiftStopMatchmakingRequest.h>
|
||||
|
||||
namespace AWSGameLift
|
||||
{
|
||||
void AWSGameLiftStopMatchmakingRequest::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
AzFramework::StopMatchmakingRequest::Reflect(context);
|
||||
|
||||
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
|
||||
{
|
||||
serializeContext->Class<AWSGameLiftStopMatchmakingRequest, AzFramework::StopMatchmakingRequest>()
|
||||
->Version(0);
|
||||
|
||||
if (AZ::EditContext* editContext = serializeContext->GetEditContext())
|
||||
{
|
||||
editContext->Class<AWSGameLiftStopMatchmakingRequest>("AWSGameLiftStopMatchmakingRequest", "")
|
||||
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
|
||||
->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly);
|
||||
}
|
||||
}
|
||||
|
||||
if (AZ::BehaviorContext* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
|
||||
{
|
||||
behaviorContext->Class<AWSGameLiftStopMatchmakingRequest>("AWSGameLiftStopMatchmakingRequest")
|
||||
->Attribute(AZ::Script::Attributes::Storage, AZ::Script::Attributes::StorageType::Value)
|
||||
->Property("TicketId", BehaviorValueProperty(&AWSGameLiftStopMatchmakingRequest::m_ticketId));
|
||||
}
|
||||
}
|
||||
} // namespace AWSGameLift
|
||||
@@ -7,10 +7,13 @@
|
||||
#
|
||||
|
||||
set(FILES
|
||||
Include/Request/AWSGameLiftAcceptMatchRequest.h
|
||||
Include/Request/AWSGameLiftCreateSessionOnQueueRequest.h
|
||||
Include/Request/AWSGameLiftCreateSessionRequest.h
|
||||
Include/Request/AWSGameLiftJoinSessionRequest.h
|
||||
Include/Request/AWSGameLiftSearchSessionsRequest.h
|
||||
Include/Request/AWSGameLiftStartMatchmakingRequest.h
|
||||
Include/Request/AWSGameLiftStopMatchmakingRequest.h
|
||||
Include/Request/IAWSGameLiftRequests.h
|
||||
Source/Activity/AWSGameLiftActivityUtils.cpp
|
||||
Source/Activity/AWSGameLiftActivityUtils.h
|
||||
@@ -28,8 +31,11 @@ set(FILES
|
||||
Source/AWSGameLiftClientManager.h
|
||||
Source/AWSGameLiftClientSystemComponent.cpp
|
||||
Source/AWSGameLiftClientSystemComponent.h
|
||||
Source/Request/AWSGameLiftAcceptMatchRequest.cpp
|
||||
Source/Request/AWSGameLiftCreateSessionOnQueueRequest.cpp
|
||||
Source/Request/AWSGameLiftCreateSessionRequest.cpp
|
||||
Source/Request/AWSGameLiftJoinSessionRequest.cpp
|
||||
Source/Request/AWSGameLiftSearchSessionsRequest.cpp
|
||||
Source/Request/AWSGameLiftStartMatchmakingRequest.cpp
|
||||
Source/Request/AWSGameLiftStopMatchmakingRequest.cpp
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user