Navigation
API > API/Plugins > API/Plugins/MLAdapter
Container for agents that exist in the world. Ticks the agents. Finds avatars for the agents.
| Name | UMLAdapterSession |
| Type | class |
| Header File | /Engine/Plugins/AI/MLAdapter/Source/MLAdapter/Public/Sessions/MLAdapterSession.h |
| Include Path | #include "Sessions/MLAdapterSession.h" |
Syntax
UCLASS ()
class UMLAdapterSession : public UObject
Inheritance Hierarchy
- UObjectBase → UObjectBaseUtility → UObject → UMLAdapterSession
Derived Classes
Structs
| Name | Remarks |
|---|---|
| FWorldTicker |
Typedefs
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| FOnAgentAvatarChangedDelegate | TMulticastDelegate_TwoParams< void, UMLAdapterAgent &, AActor * > | Sessions/MLAdapterSession.h | |
| FOnBeginAgentRemove | TMulticastDelegate_OneParam< void, UMLAdapterAgent & > | Sessions/MLAdapterSession.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FMLAdapter::FAgentID AddAgent () |
Agent/Avatar management. | Sessions/MLAdapterSession.h | |
FMLAdapter::FAgentID AddAgent
(
const FMLAdapterAgentConfig& InConfig |
Add an agent using the specified config. | Sessions/MLAdapterSession.h | |
void BindAvatar
(
UMLAdapterAgent& Agent, |
Sets a new avatar on the agent after clearing any existing avatar. | Sessions/MLAdapterSession.h | |
void ClearAvatar
(
UMLAdapterAgent& Agent |
Remove the existing avatar from the given agent. | Sessions/MLAdapterSession.h | |
virtual void Close() |
Mark the session as inactive and cleanup all agents. | Sessions/MLAdapterSession.h | |
virtual void ConfigureAsClient () |
This is where Session can add Client-side-specific functions by calling UMLAdapterManager::Get().AddClientFunctionBind. | Sessions/MLAdapterSession.h | |
virtual void ConfigureAsServer() |
This is where Session can add Authority-side-specific functions by calling UMLAdapterManager::Get().AddServerFunctionBind | Sessions/MLAdapterSession.h | |
void EnableActionDuration
(
FMLAdapter::FAgentID AgentID, |
Enable/disable the action durations with the specified time duration in seconds. | Sessions/MLAdapterSession.h | |
const UMLAdapterAgent * FindAgentByAvatar
(
AActor& Avatar |
Find an agent that is controlling the given avatar if one exists. Returns nullptr if not. | Sessions/MLAdapterSession.h | |
void FindAvatars
(
UWorld& World |
Finds avatar in given World for every avatar-less agent in AwaitingAvatar | Sessions/MLAdapterSession.h | |
UMLAdapterAgent * GetAgent
(
FMLAdapter::FAgentID AgentID |
Returns the agent corresponding to the given ID. Returns nullptr if the ID is invalid. | Sessions/MLAdapterSession.h | |
int32 GetAgentsCount() |
Sessions/MLAdapterSession.h | ||
UGameInstance * GetGameInstance() |
Sessions/MLAdapterSession.h | ||
FMLAdapter::FAgentID GetNextAgentID
(
FMLAdapter::FAgentID ReferenceAgentID |
Sessions/MLAdapterSession.h | ||
FOnAgentAvatarChangedDelegate GetOnAgentAvatarChanged() |
Sessions/MLAdapterSession.h | ||
FOnBeginAgentRemove GetOnBeginAgentRemove() |
Sessions/MLAdapterSession.h | ||
float GetTimestamp() |
Get the world time in seconds at the most recent time this session ticked. | Sessions/MLAdapterSession.h | |
virtual UWorld * GetWorld() |
Get this session's cached world. | Sessions/MLAdapterSession.h | |
bool IsAgentReady
(
FMLAdapter::FAgentID AgentID |
Returns true if the agent with the given ID has a valid avatar assigned. | Sessions/MLAdapterSession.h | |
bool IsDone() |
A session is done if the SimulationState == Finished or the game mode's match has ended. | Sessions/MLAdapterSession.h | |
bool IsReady() |
A session is ready if the SimulationState == InProgress or the game mode's match has started but not ended. | Sessions/MLAdapterSession.h | |
virtual void OnActorSpawned
(
AActor* InActor |
If there are agents waiting for an avatar, then check if a newly spawned actor fits the agent. | Sessions/MLAdapterSession.h | |
virtual void OnGameModeInitialized
(
AGameModeBase& GameModeBase |
Sessions/MLAdapterSession.h | ||
virtual void OnGameModeMatchStateSet
(
FName InMatchState |
Sessions/MLAdapterSession.h | ||
virtual void OnGameModePostLogin
(
AGameModeBase* GameMode, |
Sessions/MLAdapterSession.h | ||
virtual void OnPostWorldInit
(
UWorld& World |
Sessions/MLAdapterSession.h | ||
virtual void OnWorldCleanup
(
UWorld& World, |
Sessions/MLAdapterSession.h | ||
virtual void Open() |
Mark the session as active. | Sessions/MLAdapterSession.h | |
void RemoveAgent
(
FMLAdapter::FAgentID AgentID |
Remove the agent with the given ID from this session. | Sessions/MLAdapterSession.h | |
void RemoveAvatars
(
UWorld* World |
Processes Agents and removes all agent avatars belonging to World. | Sessions/MLAdapterSession.h | |
bool RequestAvatarForAgent
(
FMLAdapter::FAgentID& AgentID, |
Calls RequestAvatarForAgent(UMLAdapterAgent& Agent, ...) after looking up the agent by its ID. | Sessions/MLAdapterSession.h | |
virtual bool RequestAvatarForAgent
(
UMLAdapterAgent& Agent, |
Finds a suitable avatar in InWorld (or CachedWorld, if InWorld is null) for given agent, as specified by FMLAdapterAgentConfig.AvatarClass and confirmed by Agent->IsSuitableAvatar call. | Sessions/MLAdapterSession.h | |
virtual void ResetWorld
(
FMLAdapter::FAgentID AgentID |
Using FMLAdapter::InvalidAgentID for AgentID will reset all agents. | Sessions/MLAdapterSession.h | |
void SetManualWorldTickEnabled
(
bool bEnable |
If true, the world's ticking will be controlled by the remote client. | Sessions/MLAdapterSession.h | |
virtual void SetWorld
(
UWorld* NewWorld |
Sets the world that this session will use to find avatars for agents | Sessions/MLAdapterSession.h | |
virtual void Tick
(
float DeltaTime |
Call all agents' Sense(), Think(), and Act() methods. | Sessions/MLAdapterSession.h | |
bool TryResetActionDuration
(
FMLAdapter::FAgentID AgentID |
Resets the action duration flag if it has elapsed. | Sessions/MLAdapterSession.h |
Overridden from UObject
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void BeginDestroy() |
Sessions/MLAdapterSession.h | ||
virtual void PostInitProperties() |
Sessions/MLAdapterSession.h |
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void SetGameMode
(
AGameModeBase* GameModeBase |
Debug | Sessions/MLAdapterSession.h |
Static
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
static uint32 HashAvatar
(
const AActor& Avatar |
Sessions/MLAdapterSession.h |