Skip to content
This repository has been archived by the owner on Jan 18, 2022. It is now read-only.

Commit

Permalink
Release 0.4.2 RC (#927)
Browse files Browse the repository at this point in the history
* Bugfix/increase ops tick rate (#914)

* [UNR-1350] Bugfix: GenerateSchemaAndSnapshots: Run full schema gen once, then generate snapshots (#926)

* Run full schema gen once, then generate snapshots

* update changelog

* Update changelog

* Wrap launch config path with quotes in order to properly launch (#905)

* Wrap launch config path with quotes in order to properly launch

* Update CHANGELOG.md

* [UNR-1303] Rename namespace improbable to SpatialGDK (#876)

* Renamed improbable namespace to SpatialGDK

* Removed legacy redefinition of IMPROBABLE_DLL_API for C++ SDK

* Remove dead code related to generated C++ SDK code namespaces

* Revert accidental change to schema generation code

* Updated docs for non-unreal-server-worker-types to use new namespace

* Consistency fixes (#880)

* Consistency fixes

* Fix name shadowing

* UNR-1375: Save deduplicated schema names in schema db (#919)

* Keep track of Schema Name collisions globally, including names of previously generated types
* Added Changelog entry

* [UNR-1371] Bugfix: Do not generate schema for assets in 'Directories to Never Cook' (#934)

* Avoid Loading Assets & Selecting Classes that are in packages that are in UProjectPackagingSettings::DirectoriesToNeverCook

* Added Changelog

* PR Comments

* Changelog typo

* Add explicit check for != nullptr)

* FindByPredicate -> ContainsByPredicate

* [UNR 1415] Bugfix: Readonly Schema Database crashes editor during generation (#942)

Try to load schema db first in schema gen. Check file exists & is writable, fail schema gen if not writable or asset loading fails

* Update CHANGELOG.md
  • Loading branch information
m-samiec authored and oblm committed May 20, 2019
1 parent 3284cb8 commit 0959d3e
Show file tree
Hide file tree
Showing 59 changed files with 396 additions and 272 deletions.
19 changes: 16 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,22 @@ All notable changes to the SpatialOS Game Development Kit for Unreal will be doc
The format of this Changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased] - yyyy-mm-dd
## [`0.4.2`](https://github.com/spatialos/UnrealGDK/releases/tag/0.4.2) - 2019-05-20

### New Known Issues:
- `BeginPlay()` is not called on all `WorldSettings` actors [#937](https://github.com/spatialos/UnrealGDK/issues/937)
- Replicated properties within `DEBUG` or `WITH_EDITORONLY_DATA` macros are not supported [#939](https://github.com/spatialos/UnrealGDK/issues/939)
- Client connections will be closed by the `ServerWorker` when using Blueprint or C++ breakpoints during play-in-editor sessions [#940](https://github.com/spatialos/UnrealGDK/issues/940)
- Clients that connect after a Startup Actor (with `bNetLoadOnClient = true`) will not delete the Actor [#941](https://github.com/spatialos/UnrealGDK/issues/941)
- Generating schema while asset manager is asynchronously loading causes editor to crash [#944](https://github.com/spatialos/UnrealGDK/issues/944)

### Bug fixes:
- Adjusted dispatcher tickrate to reduce latency
- GenerateSchemaAndSnapshots commandlet no longer runs a full schema generation for each map.
- Launching SpatialOS would fail if there was a space in the full directory path.
- Fixed an issue with schema name collisions.
- Fixed an issue where schema generation was not respecting "Directories to never cook".
- Fixed an issue causing the editor to crash during schema generation if the database is readonly.

## [`0.4.1`](https://github.com/spatialos/UnrealGDK/releases/tag/0.4.1) - 2019-05-01

Expand All @@ -13,8 +28,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [`0.4.0`](https://github.com/spatialos/UnrealGDK/releases/tag/0.4.0) - 2019-04-30

### New Known Issues:

### Features:
- The GDK now uses SpatialOS `13.6.2`.
- Added this Changelog
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,10 @@ public:
Schema_Object* UnrealAuthoritativeComponentDataObject = Schema_GetComponentDataFields(UnrealAuthoritativeComponentData.schema_type);
Schema_AddInt32(UnrealAuthoritativeComponentDataObject, 1, 1); // set other_counter field to 1 initially
Components.Add(improbable::Position(improbable::Origin).CreatePositionData());
Components.Add(improbable::Metadata(TEXT("TestEntity")).CreateMetadataData());
Components.Add(improbable::Persistence().CreatePersistenceData());
Components.Add(improbable::EntityAcl(AnyWorkerPermission, ComponentWriteAcl).CreateEntityAclData());
Components.Add(SpatialGDK::Position(SpatialGDK::Origin).CreatePositionData());
Components.Add(SpatialGDK::Metadata(TEXT("TestEntity")).CreateMetadataData());
Components.Add(SpatialGDK::Persistence().CreatePersistenceData());
Components.Add(SpatialGDK::EntityAcl(AnyWorkerPermission, ComponentWriteAcl).CreateEntityAclData());
Components.Add(NonUnrealAuthoritativeComponentData);
Components.Add(UnrealAuthoritativeComponentData);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ void USpatialActorChannel::DeleteEntityIfAuthoritative()
return;
}

bool bHasAuthority = NetDriver->IsAuthoritativeDestructionAllowed() && NetDriver->StaticComponentView->GetAuthority(EntityId, improbable::Position::ComponentId) == WORKER_AUTHORITY_AUTHORITATIVE;
bool bHasAuthority = NetDriver->IsAuthoritativeDestructionAllowed() && NetDriver->StaticComponentView->GetAuthority(EntityId, SpatialGDK::Position::ComponentId) == WORKER_AUTHORITY_AUTHORITATIVE;

UE_LOG(LogSpatialActorChannel, Log, TEXT("Delete entity request on %lld. Has authority: %d"), EntityId, (int)bHasAuthority);

Expand Down Expand Up @@ -816,7 +816,7 @@ void USpatialActorChannel::ServerProcessOwnershipChange()
return;
}

FString NewOwnerWorkerAttribute = improbable::GetOwnerWorkerAttribute(Actor);
FString NewOwnerWorkerAttribute = SpatialGDK::GetOwnerWorkerAttribute(Actor);

if (bFirstTick || SavedOwnerWorkerAttribute != NewOwnerWorkerAttribute)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "EngineClasses/SpatialNetBitReader.h"
#include "EngineClasses/SpatialNetBitWriter.h"

namespace improbable
namespace SpatialGDK
{

bool FSpatialNetDeltaSerializeInfo::DeltaSerializeRead(USpatialNetDriver* NetDriver, FSpatialNetBitReader& Reader, UObject* Object, int32 ArrayIndex, UProperty* ParentProperty, UScriptStruct* NetDeltaStruct)
Expand Down Expand Up @@ -70,4 +70,4 @@ void SpatialFastArrayNetSerializeCB::NetSerializeStruct(UScriptStruct* Struct, F
}
}

}
} // namespace SpatialGDK
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ FArchive& FSpatialNetBitReader::operator<<(UObject*& Value)
// it's part of a streaming level that hasn't been streamed in. Native Unreal networking sets reference to nullptr and continues.
// So we do the same.
FString FullPath;
improbable::GetFullPathFromUnrealObjectReference(ObjectRef, FullPath);
SpatialGDK::GetFullPathFromUnrealObjectReference(ObjectRef, FullPath);
UE_LOG(LogSpatialNetBitReader, Verbose, TEXT("Object ref did not map to valid object. Streaming level not loaded or actor deleted. Will be set to nullptr: %s %s"),
*ObjectRef.ToString(), FullPath.IsEmpty() ? TEXT("[NO PATH]") : *FullPath);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ FNetworkGUID FSpatialNetGUIDCache::AssignNewEntityActorNetGUID(AActor* Actor, Wo
}

const FClassInfo& Info = SpatialNetDriver->ClassInfoManager->GetOrCreateClassInfoByClass(Actor->GetClass());
const SubobjectToOffsetMap& SubobjectToOffset = improbable::CreateOffsetMapFromActor(Actor, Info);
const SubobjectToOffsetMap& SubobjectToOffset = SpatialGDK::CreateOffsetMapFromActor(Actor, Info);

for (auto& Pair : SubobjectToOffset)
{
Expand Down Expand Up @@ -369,7 +369,7 @@ void FSpatialNetGUIDCache::RemoveEntityNetGUID(Worker_EntityId EntityId)
// Remove actor subobjects.
USpatialNetDriver* SpatialNetDriver = Cast<USpatialNetDriver>(Driver);

improbable::UnrealMetadata* UnrealMetadata = SpatialNetDriver->StaticComponentView->GetComponentData<improbable::UnrealMetadata>(EntityId);
SpatialGDK::UnrealMetadata* UnrealMetadata = SpatialNetDriver->StaticComponentView->GetComponentData<SpatialGDK::UnrealMetadata>(EntityId);

// There are times when the Editor is quitting out of PIE that UnrealMetadata is nullptr.
// Due to GetNativeEntityClass using LoadObject, if we are shutting down and garbage collecting, this will crash the editor.
Expand All @@ -381,7 +381,7 @@ void FSpatialNetGUIDCache::RemoveEntityNetGUID(Worker_EntityId EntityId)

const FClassInfo& Info = SpatialNetDriver->ClassInfoManager->GetOrCreateClassInfoByClass(UnrealMetadata->GetNativeEntityClass());

improbable::TSchemaOption<FUnrealObjectRef>& StablyNamedRefOption = UnrealMetadata->StablyNamedRef;
SpatialGDK::TSchemaOption<FUnrealObjectRef>& StablyNamedRefOption = UnrealMetadata->StablyNamedRef;

for (auto& SubobjectInfoPair : Info.SubobjectInfo)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "Settings/LevelEditorPlaySettings.h"
#include "SpatialGDKEditorToolbar.h"

namespace improbable
namespace SpatialGDK
{

struct EditorWorkerController
Expand Down Expand Up @@ -96,6 +96,6 @@ struct EditorWorkerController
FDelegateHandle SpatialShutdownHandle;
};

} // namespace improbable
} // namespace SpatialGDK

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "Interop/Connection/OutgoingMessages.h"

namespace improbable
namespace SpatialGDK
{

void FEntityQueryRequest::TraverseConstraint(Worker_Constraint* Constraint)
Expand Down Expand Up @@ -52,4 +52,4 @@ void FEntityQueryRequest::TraverseConstraint(Worker_Constraint* Constraint)
}
}

} // namespace improbable
} // namespace SpatialGDK
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

DEFINE_LOG_CATEGORY(LogSpatialWorkerConnection);

using namespace improbable;
using namespace SpatialGDK;

#if WITH_EDITOR
static EditorWorkerController WorkerController;
Expand Down Expand Up @@ -320,7 +320,7 @@ Worker_RequestId USpatialWorkerConnection::SendEntityQueryRequest(const Worker_E
return NextRequestId++;
}

void USpatialWorkerConnection::SendMetrics(const improbable::Metrics& Metrics)
void USpatialWorkerConnection::SendMetrics(const SpatialMetrics& Metrics)
{
QueueOutgoingMessage<FMetrics>(Metrics);
}
Expand Down Expand Up @@ -436,7 +436,15 @@ void USpatialWorkerConnection::InitializeOpsProcessingThread()

void USpatialWorkerConnection::QueueLatestOpList()
{
OpListQueue.Enqueue(Worker_Connection_GetOpList(WorkerConnection, 0));
Worker_OpList* OpList = Worker_Connection_GetOpList(WorkerConnection, 0);
if (OpList->op_count > 0)
{
OpListQueue.Enqueue(OpList);
}
else
{
Worker_OpList_Destroy(OpList);
}
}

void USpatialWorkerConnection::ProcessOutgoingMessages()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

DEFINE_LOG_CATEGORY(LogGlobalStateManager);

using namespace improbable;
using namespace SpatialGDK;

void UGlobalStateManager::Init(USpatialNetDriver* InNetDriver, FTimerManager* InTimerManager)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

DEFINE_LOG_CATEGORY(LogSnapshotManager);

using namespace improbable;
using namespace SpatialGDK;

void USnapshotManager::Init(USpatialNetDriver* InNetDriver)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ void USpatialClassInfoManager::CreateClassInfoForClass(UClass* Class)
return;
}

TArray<UFunction*> RelevantClassFunctions = improbable::GetClassRPCFunctions(Class);
TArray<UFunction*> RelevantClassFunctions = SpatialGDK::GetClassRPCFunctions(Class);

for (UFunction* RemoteFunction : RelevantClassFunctions)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

DEFINE_LOG_CATEGORY(LogSpatialPlayerSpawner);

using namespace improbable;
using namespace SpatialGDK;

void USpatialPlayerSpawner::Init(USpatialNetDriver* InNetDriver, FTimerManager* InTimerManager)
{
Expand Down
46 changes: 23 additions & 23 deletions SpatialGDK/Source/SpatialGDK/Private/Interop/SpatialReceiver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

DEFINE_LOG_CATEGORY(LogSpatialReceiver);

using namespace improbable;
using namespace SpatialGDK;

void USpatialReceiver::Init(USpatialNetDriver* InNetDriver, FTimerManager* InTimerManager)
{
Expand Down Expand Up @@ -156,7 +156,7 @@ void USpatialReceiver::OnAddComponent(Worker_AddComponentOp& Op)
Op.data.component_id, Op.entity_id);
return;
}
PendingAddComponents.Emplace(Op.entity_id, Op.data.component_id, MakeUnique<improbable::DynamicComponent>(Op.data));
PendingAddComponents.Emplace(Op.entity_id, Op.data.component_id, MakeUnique<DynamicComponent>(Op.data));
}

void USpatialReceiver::OnRemoveEntity(Worker_RemoveEntityOp& Op)
Expand Down Expand Up @@ -326,10 +326,10 @@ void USpatialReceiver::ReceiveActor(Worker_EntityId EntityId)
checkf(NetDriver, TEXT("We should have a NetDriver whilst processing ops."));
checkf(NetDriver->GetWorld(), TEXT("We should have a World whilst processing ops."));

improbable::SpawnData* SpawnData = StaticComponentView->GetComponentData<improbable::SpawnData>(EntityId);
improbable::UnrealMetadata* UnrealMetadata = StaticComponentView->GetComponentData<improbable::UnrealMetadata>(EntityId);
SpawnData* SpawnDataComp = StaticComponentView->GetComponentData<SpawnData>(EntityId);
UnrealMetadata* UnrealMetadataComp = StaticComponentView->GetComponentData<UnrealMetadata>(EntityId);

if (UnrealMetadata == nullptr)
if (UnrealMetadataComp == nullptr)
{
// Not an Unreal entity
return;
Expand Down Expand Up @@ -366,7 +366,7 @@ void USpatialReceiver::ReceiveActor(Worker_EntityId EntityId)
*EntityActor->GetName());

// Assume SimulatedProxy until we've been delegated Authority
bool bAuthority = StaticComponentView->GetAuthority(EntityId, improbable::Position::ComponentId) == WORKER_AUTHORITY_AUTHORITATIVE;
bool bAuthority = StaticComponentView->GetAuthority(EntityId, Position::ComponentId) == WORKER_AUTHORITY_AUTHORITATIVE;
EntityActor->Role = bAuthority ? ROLE_Authority : ROLE_SimulatedProxy;
EntityActor->RemoteRole = bAuthority ? ROLE_SimulatedProxy : ROLE_Authority;
if (bAuthority)
Expand All @@ -383,7 +383,7 @@ void USpatialReceiver::ReceiveActor(Worker_EntityId EntityId)
}
else
{
EntityActor = TryGetOrCreateActor(UnrealMetadata, SpawnData);
EntityActor = TryGetOrCreateActor(UnrealMetadataComp, SpawnDataComp);

if (EntityActor == nullptr)
{
Expand Down Expand Up @@ -624,14 +624,14 @@ void USpatialReceiver::CleanupDeletedEntity(Worker_EntityId EntityId)
NetDriver->RemoveActorChannel(EntityId);
}

AActor* USpatialReceiver::TryGetOrCreateActor(improbable::UnrealMetadata* UnrealMetadata, improbable::SpawnData* SpawnData)
AActor* USpatialReceiver::TryGetOrCreateActor(UnrealMetadata* UnrealMetadataComp, SpawnData* SpawnDataComp)
{
if (UnrealMetadata->StablyNamedRef.IsSet())
if (UnrealMetadataComp->StablyNamedRef.IsSet())
{
if (NetDriver->IsServer() || UnrealMetadata->bNetStartup.GetValue())
if (NetDriver->IsServer() || UnrealMetadataComp->bNetStartup.GetValue())
{
// This Actor already exists in the map, get it from the package map.
const FUnrealObjectRef& StablyNamedRef = UnrealMetadata->StablyNamedRef.GetValue();
const FUnrealObjectRef& StablyNamedRef = UnrealMetadataComp->StablyNamedRef.GetValue();
AActor* StaticActor = Cast<AActor>(PackageMap->GetObjectFromUnrealObjectRef(StablyNamedRef));
// An unintended side effect of GetObjectFromUnrealObjectRef is that this ref
// will be registered with this Actor. It can be the case that this Actor is not
Expand All @@ -643,17 +643,17 @@ AActor* USpatialReceiver::TryGetOrCreateActor(improbable::UnrealMetadata* Unreal
}
}

return CreateActor(UnrealMetadata, SpawnData);
return CreateActor(UnrealMetadataComp, SpawnDataComp);
}

// This function is only called for client and server workers who did not spawn the Actor
AActor* USpatialReceiver::CreateActor(improbable::UnrealMetadata* UnrealMetadata, improbable::SpawnData* SpawnData)
AActor* USpatialReceiver::CreateActor(UnrealMetadata* UnrealMetadataComp, SpawnData* SpawnDataComp)
{
UClass* ActorClass = UnrealMetadata->GetNativeEntityClass();
UClass* ActorClass = UnrealMetadataComp->GetNativeEntityClass();

if (ActorClass == nullptr)
{
UE_LOG(LogSpatialReceiver, Error, TEXT("Could not load class %s when spawning entity!"), *UnrealMetadata->ClassPath);
UE_LOG(LogSpatialReceiver, Error, TEXT("Could not load class %s when spawning entity!"), *UnrealMetadataComp->ClassPath);
return nullptr;
}

Expand All @@ -668,10 +668,10 @@ AActor* USpatialReceiver::CreateActor(improbable::UnrealMetadata* UnrealMetadata
// If we're checking out a player controller, spawn it via "USpatialNetDriver::AcceptNewPlayer"
if (NetDriver->IsServer() && ActorClass->IsChildOf(APlayerController::StaticClass()))
{
checkf(!UnrealMetadata->OwnerWorkerAttribute.IsEmpty(), TEXT("A player controller entity must have an owner worker attribute."));
checkf(!UnrealMetadataComp->OwnerWorkerAttribute.IsEmpty(), TEXT("A player controller entity must have an owner worker attribute."));

FString URLString = FURL().ToString();
URLString += TEXT("?workerAttribute=") + UnrealMetadata->OwnerWorkerAttribute;
URLString += TEXT("?workerAttribute=") + UnrealMetadataComp->OwnerWorkerAttribute;

// TODO: Once we can checkout PlayerController and PlayerState atomically, we can grab the UniqueId and online subsystem type from PlayerState. UNR-933
UNetConnection* Connection = NetDriver->AcceptNewPlayer(FURL(nullptr, *URLString, TRAVEL_Absolute), FUniqueNetIdRepl(), FName(), true);
Expand All @@ -687,20 +687,20 @@ AActor* USpatialReceiver::CreateActor(improbable::UnrealMetadata* UnrealMetadata
SpawnInfo.bRemoteOwned = !NetDriver->IsServer();
SpawnInfo.bNoFail = true;

FVector SpawnLocation = FRepMovement::RebaseOntoLocalOrigin(SpawnData->Location, NetDriver->GetWorld()->OriginLocation);
FVector SpawnLocation = FRepMovement::RebaseOntoLocalOrigin(SpawnDataComp->Location, NetDriver->GetWorld()->OriginLocation);

AActor* NewActor = NetDriver->GetWorld()->SpawnActorAbsolute(ActorClass, FTransform(SpawnData->Rotation, SpawnLocation), SpawnInfo);
AActor* NewActor = NetDriver->GetWorld()->SpawnActorAbsolute(ActorClass, FTransform(SpawnDataComp->Rotation, SpawnLocation), SpawnInfo);
check(NewActor);

// Imitate the behavior in UPackageMapClient::SerializeNewActor.
const float Epsilon = 0.001f;
if (!SpawnData->Velocity.Equals(FVector::ZeroVector, Epsilon))
if (!SpawnDataComp->Velocity.Equals(FVector::ZeroVector, Epsilon))
{
NewActor->PostNetReceiveVelocity(SpawnData->Velocity);
NewActor->PostNetReceiveVelocity(SpawnDataComp->Velocity);
}
if (!SpawnData->Scale.Equals(FVector::OneVector, Epsilon))
if (!SpawnDataComp->Scale.Equals(FVector::OneVector, Epsilon))
{
NewActor->SetActorScale3D(SpawnData->Scale);
NewActor->SetActorScale3D(SpawnDataComp->Scale);
}

// Don't have authority over Actor until SpatialOS delegates authority
Expand Down

0 comments on commit 0959d3e

Please sign in to comment.