CARLA
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
ACarlaGameModeBase Class Reference

Base class for the CARLA Game Mode. More...

#include <CarlaGameModeBase.h>

+ Inheritance diagram for ACarlaGameModeBase:
+ Collaboration diagram for ACarlaGameModeBase:

Public Member Functions

 ACarlaGameModeBase (const FObjectInitializer &ObjectInitializer)
 
void ApplyTextureToActor (AActor *Actor, UTexture2D *Texture, const carla::rpc::MaterialParameter &TextureParam)
 
void CheckForEmptyMeshes ()
 
UTexture2D * CreateUETexture (const carla::rpc::TextureColor &Texture)
 
UTexture2D * CreateUETexture (const carla::rpc::TextureFloatColor &Texture)
 
void DebugShowSignals (bool enable)
 
void EnableEnvironmentObjects (const TSet< uint64 > &EnvObjectIds, bool Enable)
 
void EnableOverlapEvents ()
 
AActorFindActorByName (const FString &ActorName)
 
TArray< FBoundingBoxGetAllBBsOfLevel (uint8 TagQueried=0xFF) const
 
const UCarlaEpisodeGetCarlaEpisode () const
 
TArray< FEnvironmentObjectGetEnvironmentObjects (uint8 QueriedTag=0xFF) const
 
const FString GetFullMapPath () const
 
ALargeMapManagerGetLMManager () const
 
const boost::optional< carla::road::Map > & GetMap () const
 
TArray< FString > GetNamesOfAllActors ()
 
const FString GetRelativeMapPath () const
 
const TArray< FTransform > & GetSpawnPointsTransforms () const
 
ATrafficLightManagerGetTrafficLightManager ()
 
ULevel * GetULevelFromName (FString LevelName)
 
void LoadMapLayer (int32 MapLayers)
 
void OnLoadStreamLevel ()
 
void OnUnloadStreamLevel ()
 
void UnLoadMapLayer (int32 MapLayers)
 

Protected Member Functions

void BeginPlay () override
 
void EndPlay (const EEndPlayReason::Type EndPlayReason) override
 
void InitGame (const FString &MapName, const FString &Options, FString &ErrorMessage) override
 
void RestartPlayer (AController *NewPlayer) override
 
void Tick (float DeltaSeconds) override
 

Private Member Functions

void ConvertMapLayerMaskToMapNames (int32 MapLayer, TArray< FName > &OutLevelNames)
 
void GenerateSpawnPoints ()
 
void OnEpisodeSettingsChanged (const FEpisodeSettings &Settings)
 
void ParseOpenDrive ()
 
void RegisterEnvironmentObjects ()
 
void SpawnActorFactories ()
 
void StoreSpawnPoints ()
 

Private Attributes

TSet< TSubclassOf< ACarlaActorFactory > > ActorFactories
 List of actor spawners that will be used to define and spawn the actors available in game. More...
 
TArray< ACarlaActorFactory * > ActorFactoryInstances
 
UCarlaSettingsDelegateCarlaSettingsDelegate = nullptr
 
UCarlaEpisodeEpisode = nullptr
 
UCarlaGameInstanceGameInstance = nullptr
 
int32 LatentInfoUUID = 0
 
ALargeMapManagerLMManager = nullptr
 
boost::optional< carla::road::MapMap
 
UObjectRegisterObjectRegister = nullptr
 
FDelegateHandle OnEpisodeSettingsChangeHandle
 
int PendingLevelsToLoad = 0
 
int PendingLevelsToUnLoad = 0
 
bool ReadyToRegisterObjects = false
 
ACarlaRecorderRecorder = nullptr
 
TArray< FTransform > SpawnPointsTransforms
 
UTaggerDelegateTaggerDelegate = nullptr
 
ATrafficLightManagerTrafficLightManager = nullptr
 
TSubclassOf< AWeatherWeatherClass
 The class of Weather to spawn. More...
 

Detailed Description

Base class for the CARLA Game Mode.

Definition at line 35 of file CarlaGameModeBase.h.

Constructor & Destructor Documentation

◆ ACarlaGameModeBase()

ACarlaGameModeBase::ACarlaGameModeBase ( const FObjectInitializer &  ObjectInitializer)

Member Function Documentation

◆ ApplyTextureToActor()

void ACarlaGameModeBase::ApplyTextureToActor ( AActor Actor,
UTexture2D *  Texture,
const carla::rpc::MaterialParameter TextureParam 
)

Definition at line 323 of file CarlaGameModeBase.cpp.

Referenced by FCarlaServer::FPimpl::BindActions().

+ Here is the caller graph for this function:

◆ BeginPlay()

void ACarlaGameModeBase::BeginPlay ( )
overrideprotected

◆ CheckForEmptyMeshes()

void ACarlaGameModeBase::CheckForEmptyMeshes ( )

Definition at line 484 of file CarlaGameModeBase.cpp.

◆ ConvertMapLayerMaskToMapNames()

void ACarlaGameModeBase::ConvertMapLayerMaskToMapNames ( int32  MapLayer,
TArray< FName > &  OutLevelNames 
)
private

Definition at line 703 of file CarlaGameModeBase.cpp.

References carla::rpc::All, and carla::rpc::MapLayerToString().

Referenced by LoadMapLayer(), and UnLoadMapLayer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CreateUETexture() [1/2]

UTexture2D * ACarlaGameModeBase::CreateUETexture ( const carla::rpc::TextureColor Texture)

Definition at line 277 of file CarlaGameModeBase.cpp.

References carla::sensor::data::Color::a, carla::rpc::Texture< T >::At(), carla::sensor::data::Color::b, carla::sensor::data::Color::g, carla::rpc::Texture< T >::GetHeight(), carla::rpc::Texture< T >::GetWidth(), and carla::sensor::data::Color::r.

Referenced by FCarlaServer::FPimpl::BindActions().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CreateUETexture() [2/2]

UTexture2D * ACarlaGameModeBase::CreateUETexture ( const carla::rpc::TextureFloatColor Texture)

Definition at line 300 of file CarlaGameModeBase.cpp.

References carla::sensor::data::Color::a, carla::rpc::Texture< T >::At(), carla::sensor::data::Color::b, carla::sensor::data::Color::g, carla::rpc::Texture< T >::GetHeight(), carla::rpc::Texture< T >::GetWidth(), and carla::sensor::data::Color::r.

+ Here is the call graph for this function:

◆ DebugShowSignals()

void ACarlaGameModeBase::DebugShowSignals ( bool  enable)

Definition at line 524 of file CarlaGameModeBase.cpp.

References carla::geom::Math::GenerateRange(), carla::geom::Rotation::GetUpVector(), and Map.

+ Here is the call graph for this function:

◆ EnableEnvironmentObjects()

void ACarlaGameModeBase::EnableEnvironmentObjects ( const TSet< uint64 > &  EnvObjectIds,
bool  Enable 
)

Definition at line 646 of file CarlaGameModeBase.cpp.

References UObjectRegister::EnableEnvironmentObjects(), and ObjectRegister.

Referenced by FCarlaServer::FPimpl::BindActions().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ EnableOverlapEvents()

void ACarlaGameModeBase::EnableOverlapEvents ( )

Definition at line 499 of file CarlaGameModeBase.cpp.

References ATagger::GetTagOfTaggedComponent().

Referenced by BeginPlay().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ EndPlay()

void ACarlaGameModeBase::EndPlay ( const EEndPlayReason::Type  EndPlayReason)
overrideprotected

Definition at line 384 of file CarlaGameModeBase.cpp.

References CarlaSettingsDelegate, UCarlaEpisode::EndPlay(), Episode, GameInstance, UCarlaGameInstance::NotifyEndEpisode(), FCarlaStaticDelegates::OnEpisodeSettingsChange, OnEpisodeSettingsChangeHandle, and UCarlaSettingsDelegate::Reset().

+ Here is the call graph for this function:

◆ FindActorByName()

AActor * ACarlaGameModeBase::FindActorByName ( const FString &  ActorName)

Definition at line 262 of file CarlaGameModeBase.cpp.

Referenced by FCarlaServer::FPimpl::BindActions().

+ Here is the caller graph for this function:

◆ GenerateSpawnPoints()

void ACarlaGameModeBase::GenerateSpawnPoints ( )
private

Definition at line 437 of file CarlaGameModeBase.cpp.

References Map, and SpawnPointsTransforms.

Referenced by StoreSpawnPoints().

+ Here is the caller graph for this function:

◆ GetAllBBsOfLevel()

TArray< FBoundingBox > ACarlaGameModeBase::GetAllBBsOfLevel ( uint8  TagQueried = 0xFF) const

Definition at line 624 of file CarlaGameModeBase.cpp.

References UBoundingBoxCalculator::GetBoundingBoxOfActors().

Referenced by FCarlaServer::FPimpl::BindActions().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetCarlaEpisode()

const UCarlaEpisode& ACarlaGameModeBase::GetCarlaEpisode ( ) const
inline

Definition at line 43 of file CarlaGameModeBase.h.

◆ GetEnvironmentObjects()

TArray<FEnvironmentObject> ACarlaGameModeBase::GetEnvironmentObjects ( uint8  QueriedTag = 0xFF) const
inline

Definition at line 73 of file CarlaGameModeBase.h.

Referenced by FCarlaServer::FPimpl::BindActions().

+ Here is the caller graph for this function:

◆ GetFullMapPath()

const FString ACarlaGameModeBase::GetFullMapPath ( ) const

Definition at line 69 of file CarlaGameModeBase.cpp.

References GetRelativeMapPath().

Referenced by FCarlaServer::FPimpl::BindActions(), and UOpenDrive::GetXODR().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetLMManager()

ALargeMapManager* ACarlaGameModeBase::GetLMManager ( ) const
inline

Definition at line 99 of file CarlaGameModeBase.h.

Referenced by FCarlaServer::FPimpl::BindActions(), URayTracer::CastRay(), UCarlaStatics::GetLargeMapManager(), and URayTracer::ProjectPoint().

+ Here is the caller graph for this function:

◆ GetMap()

const boost::optional<carla::road::Map>& ACarlaGameModeBase::GetMap ( ) const
inline

Definition at line 49 of file CarlaGameModeBase.h.

Referenced by AOpenDriveGenerator::GenerateRoadMesh(), AOpenDriveGenerator::GenerateSpawnPoints(), ATrafficLightManager::GetMap(), AOpenDriveGenerator::IsOpenDriveValid(), FTrafficSignData::RestoreActorData(), and FTrafficLightData::RestoreActorData().

+ Here is the caller graph for this function:

◆ GetNamesOfAllActors()

TArray< FString > ACarlaGameModeBase::GetNamesOfAllActors ( )

Definition at line 245 of file CarlaGameModeBase.cpp.

Referenced by FCarlaServer::FPimpl::BindActions().

+ Here is the caller graph for this function:

◆ GetRelativeMapPath()

const FString ACarlaGameModeBase::GetRelativeMapPath ( ) const

Definition at line 60 of file CarlaGameModeBase.cpp.

Referenced by GetFullMapPath().

+ Here is the caller graph for this function:

◆ GetSpawnPointsTransforms()

const TArray<FTransform>& ACarlaGameModeBase::GetSpawnPointsTransforms ( ) const
inline

Definition at line 65 of file CarlaGameModeBase.h.

Referenced by UCarlaEpisode::GetRecommendedSpawnPoints().

+ Here is the caller graph for this function:

◆ GetTrafficLightManager()

ATrafficLightManager * ACarlaGameModeBase::GetTrafficLightManager ( )

Definition at line 464 of file CarlaGameModeBase.cpp.

References GetULevelFromName(), and TrafficLightManager.

Referenced by BeginPlay().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetULevelFromName()

ULevel * ACarlaGameModeBase::GetULevelFromName ( FString  LevelName)

Definition at line 745 of file CarlaGameModeBase.cpp.

Referenced by GetTrafficLightManager(), ATrafficLightManager::RegisterLightComponentFromOpenDRIVE(), ATrafficLightManager::SpawnSignals(), and ATrafficLightManager::SpawnTrafficLights().

+ Here is the caller graph for this function:

◆ InitGame()

void ACarlaGameModeBase::InitGame ( const FString &  MapName,
const FString &  Options,
FString &  ErrorMessage 
)
overrideprotected

◆ LoadMapLayer()

void ACarlaGameModeBase::LoadMapLayer ( int32  MapLayers)

Definition at line 653 of file CarlaGameModeBase.cpp.

References ConvertMapLayerMaskToMapNames(), LatentInfoUUID, and PendingLevelsToLoad.

Referenced by BeginPlay(), and FCarlaServer::FPimpl::BindActions().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OnEpisodeSettingsChanged()

void ACarlaGameModeBase::OnEpisodeSettingsChanged ( const FEpisodeSettings Settings)
private

Definition at line 790 of file CarlaGameModeBase.cpp.

References CarlaSettingsDelegate, FEpisodeSettings::MaxCullingDistance, and UCarlaSettingsDelegate::SetAllActorsDrawDistance().

Referenced by InitGame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OnLoadStreamLevel()

void ACarlaGameModeBase::OnLoadStreamLevel ( )

Definition at line 768 of file CarlaGameModeBase.cpp.

References PendingLevelsToLoad, ReadyToRegisterObjects, RegisterEnvironmentObjects(), and ATagger::TagActorsInLevel().

+ Here is the call graph for this function:

◆ OnUnloadStreamLevel()

void ACarlaGameModeBase::OnUnloadStreamLevel ( )

Definition at line 780 of file CarlaGameModeBase.cpp.

References PendingLevelsToUnLoad, ReadyToRegisterObjects, and RegisterEnvironmentObjects().

+ Here is the call graph for this function:

◆ ParseOpenDrive()

void ACarlaGameModeBase::ParseOpenDrive ( )
private

Definition at line 451 of file CarlaGameModeBase.cpp.

References Episode, UOpenDrive::GetXODR(), carla::opendrive::OpenDriveParser::Load(), Map, and UCarlaEpisode::MapGeoReference.

Referenced by InitGame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RegisterEnvironmentObjects()

void ACarlaGameModeBase::RegisterEnvironmentObjects ( )
private

Definition at line 638 of file CarlaGameModeBase.cpp.

References ObjectRegister, and UObjectRegister::RegisterObjects().

Referenced by BeginPlay(), OnLoadStreamLevel(), and OnUnloadStreamLevel().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RestartPlayer()

void ACarlaGameModeBase::RestartPlayer ( AController NewPlayer)
overrideprotected

Definition at line 167 of file CarlaGameModeBase.cpp.

References UCarlaSettingsDelegate::ApplyQualityLevelPreRestart(), and CarlaSettingsDelegate.

+ Here is the call graph for this function:

◆ SpawnActorFactories()

void ACarlaGameModeBase::SpawnActorFactories ( )
private

Definition at line 399 of file CarlaGameModeBase.cpp.

References ActorFactories, ActorFactoryInstances, Episode, and UCarlaEpisode::RegisterActorFactory().

Referenced by InitGame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ StoreSpawnPoints()

void ACarlaGameModeBase::StoreSpawnPoints ( )
private

Definition at line 422 of file CarlaGameModeBase.cpp.

References GenerateSpawnPoints(), and SpawnPointsTransforms.

Referenced by InitGame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Tick()

void ACarlaGameModeBase::Tick ( float  DeltaSeconds)
overrideprotected
Todo:
Recorder should not tick here, FCarlaEngine should do it.

Definition at line 373 of file CarlaGameModeBase.cpp.

References Recorder.

◆ UnLoadMapLayer()

void ACarlaGameModeBase::UnLoadMapLayer ( int32  MapLayers)

Definition at line 678 of file CarlaGameModeBase.cpp.

References ConvertMapLayerMaskToMapNames(), LatentInfoUUID, and PendingLevelsToUnLoad.

Referenced by FCarlaServer::FPimpl::BindActions().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ ActorFactories

TSet<TSubclassOf<ACarlaActorFactory> > ACarlaGameModeBase::ActorFactories
private

List of actor spawners that will be used to define and spawn the actors available in game.

Definition at line 168 of file CarlaGameModeBase.h.

Referenced by SpawnActorFactories().

◆ ActorFactoryInstances

TArray<ACarlaActorFactory *> ACarlaGameModeBase::ActorFactoryInstances
private

Definition at line 174 of file CarlaGameModeBase.h.

Referenced by SpawnActorFactories().

◆ CarlaSettingsDelegate

UCarlaSettingsDelegate* ACarlaGameModeBase::CarlaSettingsDelegate = nullptr
private

◆ Episode

UCarlaEpisode* ACarlaGameModeBase::Episode = nullptr
private

◆ GameInstance

UCarlaGameInstance* ACarlaGameModeBase::GameInstance = nullptr
private

Definition at line 144 of file CarlaGameModeBase.h.

Referenced by BeginPlay(), EndPlay(), and InitGame().

◆ LatentInfoUUID

int32 ACarlaGameModeBase::LatentInfoUUID = 0
private

Definition at line 192 of file CarlaGameModeBase.h.

Referenced by LoadMapLayer(), and UnLoadMapLayer().

◆ LMManager

ALargeMapManager* ACarlaGameModeBase::LMManager = nullptr
private

Definition at line 179 of file CarlaGameModeBase.h.

Referenced by BeginPlay(), and InitGame().

◆ Map

boost::optional<carla::road::Map> ACarlaGameModeBase::Map
private

◆ ObjectRegister

UObjectRegister* ACarlaGameModeBase::ObjectRegister = nullptr
private

◆ OnEpisodeSettingsChangeHandle

FDelegateHandle ACarlaGameModeBase::OnEpisodeSettingsChangeHandle
private

Definition at line 181 of file CarlaGameModeBase.h.

Referenced by EndPlay(), and InitGame().

◆ PendingLevelsToLoad

int ACarlaGameModeBase::PendingLevelsToLoad = 0
private

Definition at line 185 of file CarlaGameModeBase.h.

Referenced by BeginPlay(), LoadMapLayer(), and OnLoadStreamLevel().

◆ PendingLevelsToUnLoad

int ACarlaGameModeBase::PendingLevelsToUnLoad = 0
private

Definition at line 186 of file CarlaGameModeBase.h.

Referenced by OnUnloadStreamLevel(), and UnLoadMapLayer().

◆ ReadyToRegisterObjects

bool ACarlaGameModeBase::ReadyToRegisterObjects = false
private

Definition at line 188 of file CarlaGameModeBase.h.

Referenced by BeginPlay(), OnLoadStreamLevel(), and OnUnloadStreamLevel().

◆ Recorder

ACarlaRecorder* ACarlaGameModeBase::Recorder = nullptr
private

Definition at line 156 of file CarlaGameModeBase.h.

Referenced by ACarlaGameModeBase(), BeginPlay(), InitGame(), and Tick().

◆ SpawnPointsTransforms

TArray<FTransform> ACarlaGameModeBase::SpawnPointsTransforms
private

Definition at line 171 of file CarlaGameModeBase.h.

Referenced by GenerateSpawnPoints(), and StoreSpawnPoints().

◆ TaggerDelegate

UTaggerDelegate* ACarlaGameModeBase::TaggerDelegate = nullptr
private

Definition at line 147 of file CarlaGameModeBase.h.

Referenced by ACarlaGameModeBase(), BeginPlay(), and InitGame().

◆ TrafficLightManager

ATrafficLightManager* ACarlaGameModeBase::TrafficLightManager = nullptr
private

Definition at line 177 of file CarlaGameModeBase.h.

Referenced by GetTrafficLightManager().

◆ WeatherClass

TSubclassOf<AWeather> ACarlaGameModeBase::WeatherClass
private

The class of Weather to spawn.

Definition at line 163 of file CarlaGameModeBase.h.

Referenced by InitGame().


The documentation for this class was generated from the following files: