Add random seeds to config file
This commit is contained in:
parent
d120439346
commit
f84c96c793
|
@ -27,6 +27,9 @@ NumberOfPedestrians=15
|
|||
; Index of the weather/lighting presets to use. If negative, the default presets
|
||||
; of the map will be used.
|
||||
WeatherId=-1
|
||||
; Seeds for the pseudo-random number generators.
|
||||
SeedVehicles=123456789
|
||||
SeedPedestrians=123456789
|
||||
|
||||
[CARLA/SceneCapture]
|
||||
; Names of the scene capture cameras to attach to the player, comma-separated,
|
||||
|
|
|
@ -116,6 +116,7 @@ void ACarlaGameModeBase::BeginPlay()
|
|||
// Setup other vehicles.
|
||||
if (VehicleSpawner != nullptr) {
|
||||
VehicleSpawner->SetNumberOfVehicles(CarlaSettings.NumberOfVehicles);
|
||||
VehicleSpawner->SetSeed(CarlaSettings.SeedVehicles);
|
||||
} else {
|
||||
UE_LOG(LogCarla, Error, TEXT("Missing vehicle spawner actor!"));
|
||||
}
|
||||
|
@ -123,6 +124,7 @@ void ACarlaGameModeBase::BeginPlay()
|
|||
// Setup walkers.
|
||||
if (WalkerSpawner != nullptr) {
|
||||
WalkerSpawner->SetNumberOfWalkers(CarlaSettings.NumberOfPedestrians);
|
||||
WalkerSpawner->SetSeed(CarlaSettings.SeedPedestrians);
|
||||
} else {
|
||||
UE_LOG(LogCarla, Error, TEXT("Missing walker spawner actor!"));
|
||||
}
|
||||
|
|
|
@ -92,6 +92,8 @@ static void LoadSettingsFromConfig(
|
|||
ConfigFile.GetInt(S_CARLA_LEVELSETTINGS, TEXT("NumberOfVehicles"), Settings.NumberOfVehicles);
|
||||
ConfigFile.GetInt(S_CARLA_LEVELSETTINGS, TEXT("NumberOfPedestrians"), Settings.NumberOfPedestrians);
|
||||
ConfigFile.GetInt(S_CARLA_LEVELSETTINGS, TEXT("WeatherId"), Settings.WeatherId);
|
||||
ConfigFile.GetInt(S_CARLA_LEVELSETTINGS, TEXT("SeedVehicles"), Settings.SeedVehicles);
|
||||
ConfigFile.GetInt(S_CARLA_LEVELSETTINGS, TEXT("SeedPedestrians"), Settings.SeedPedestrians);
|
||||
Settings.WeatherDescriptions.Empty();
|
||||
ADynamicWeather::LoadWeatherDescriptionsFromFile(Settings.WeatherDescriptions);
|
||||
check(Settings.WeatherDescriptions.Num() > 0);
|
||||
|
@ -189,6 +191,8 @@ void UCarlaSettings::LogSettings() const
|
|||
UE_LOG(LogCarla, Log, TEXT("Number Of Vehicles = %d"), NumberOfVehicles);
|
||||
UE_LOG(LogCarla, Log, TEXT("Number Of Pedestrians = %d"), NumberOfPedestrians);
|
||||
UE_LOG(LogCarla, Log, TEXT("Weather Id = %d"), WeatherId);
|
||||
UE_LOG(LogCarla, Log, TEXT("Seed Vehicle Spawner = %d"), SeedVehicles);
|
||||
UE_LOG(LogCarla, Log, TEXT("Seed Pedestrian Spawner = %d"), SeedPedestrians);
|
||||
UE_LOG(LogCarla, Log, TEXT("Found %d available weather settings."), WeatherDescriptions.Num());
|
||||
for (auto i = 0; i < WeatherDescriptions.Num(); ++i) {
|
||||
UE_LOG(LogCarla, Log, TEXT(" * %d - %s"), i, *WeatherDescriptions[i].Name);
|
||||
|
|
|
@ -94,6 +94,14 @@ public:
|
|||
UPROPERTY(Category = "Level Settings", VisibleAnywhere)
|
||||
TArray<FWeatherDescription> WeatherDescriptions;
|
||||
|
||||
/** Random seed for the pedestrian spawner. */
|
||||
UPROPERTY(Category = "Level Settings", VisibleAnywhere)
|
||||
int32 SeedPedestrians = 123456789;
|
||||
|
||||
/** Random seed for the vehicle spawner. */
|
||||
UPROPERTY(Category = "Level Settings", VisibleAnywhere)
|
||||
int32 SeedVehicles = 123456789;
|
||||
|
||||
/// @}
|
||||
// ===========================================================================
|
||||
/// @name Scene Capture
|
||||
|
|
|
@ -25,7 +25,7 @@ protected:
|
|||
virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
|
||||
#endif // WITH_EDITOR
|
||||
|
||||
protected:
|
||||
public:
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
URandomEngine *GetRandomEngine()
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include "RandomEngine.generated.h"
|
||||
|
||||
UCLASS()
|
||||
UCLASS(Blueprintable,BlueprintType)
|
||||
class URandomEngine : public UObject
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
|
Loading…
Reference in New Issue