Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SpatialOS 14.1 Support #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ void ExternalSchemaInterface::SerializeAndSendComponentUpdate(Worker_EntityId En
{
Worker_ComponentUpdate SerializedUpdate = {};
SerializedUpdate.component_id = ComponentId;
SerializedUpdate.schema_type = Schema_CreateComponentUpdate(ComponentId);
SerializedUpdate.schema_type = Schema_CreateComponentUpdate();
Update.Serialize(SerializedUpdate.schema_type);
SpatialWorkerConnection->SendComponentUpdate(EntityId, &SerializedUpdate);
}
Expand All @@ -21,7 +21,8 @@ Worker_RequestId ExternalSchemaInterface::SerializeAndSendCommandRequest(Worker_
{
Worker_CommandRequest SerializedRequest = {};
SerializedRequest.component_id = ComponentId;
SerializedRequest.schema_type = Schema_CreateCommandRequest(ComponentId, CommandIndex);
SerializedRequest.command_index = CommandIndex;
SerializedRequest.schema_type = Schema_CreateCommandRequest();
Schema_Object* RequestObject = Schema_GetCommandRequestObject(SerializedRequest.schema_type);
Request.Serialize(RequestObject);
return SpatialWorkerConnection->SendCommandRequest(EntityId, &SerializedRequest, CommandIndex);
Expand All @@ -31,7 +32,8 @@ void ExternalSchemaInterface::SerializeAndSendCommandResponse(Worker_RequestId R
{
Worker_CommandResponse SerializedResponse = {};
SerializedResponse.component_id = ComponentId;
SerializedResponse.schema_type = Schema_CreateCommandResponse(ComponentId, CommandIndex);
SerializedResponse.command_index = CommandIndex;
SerializedResponse.schema_type = Schema_CreateCommandResponse();
Schema_Object* ResponseObject = Schema_GetCommandResponseObject(SerializedResponse.schema_type);
Response.Serialize(ResponseObject);
return SpatialWorkerConnection->SendCommandResponse(RequestId, &SerializedResponse);
Expand Down Expand Up @@ -182,12 +184,12 @@ USpatialDispatcher::FCallbackId ExternalSchemaInterface::OnCommandResponse(const
{
return SpatialDispatcher->OnCommandResponse(1901, [Callback](const Worker_CommandResponseOp& Op)
{
if (Op.command_id == 1)
if (Op.response.command_index == 1)
{
auto Response = Op.status_code == Worker_StatusCode::WORKER_STATUS_CODE_SUCCESS ?
::improbable::database_sync::DatabaseSyncService::Commands::GetItem::Response(::improbable::database_sync::DatabaseSyncService::Commands::GetItem::Response::Type::Deserialize(Schema_GetCommandResponseObject(Op.response.schema_type))) :
::improbable::database_sync::DatabaseSyncService::Commands::GetItem::Response();
Callback(::improbable::database_sync::DatabaseSyncService::Commands::GetItem::ResponseOp(Op.entity_id, Op.request_id, Op.status_code, Op.message, Op.command_id, Response));
Callback(::improbable::database_sync::DatabaseSyncService::Commands::GetItem::ResponseOp(Op.entity_id, Op.request_id, Op.status_code, Op.message, Op.response.command_index, Response));
}
});
}
Expand Down Expand Up @@ -215,12 +217,12 @@ USpatialDispatcher::FCallbackId ExternalSchemaInterface::OnCommandResponse(const
{
return SpatialDispatcher->OnCommandResponse(1901, [Callback](const Worker_CommandResponseOp& Op)
{
if (Op.command_id == 2)
if (Op.response.command_index == 2)
{
auto Response = Op.status_code == Worker_StatusCode::WORKER_STATUS_CODE_SUCCESS ?
::improbable::database_sync::DatabaseSyncService::Commands::GetItems::Response(::improbable::database_sync::DatabaseSyncService::Commands::GetItems::Response::Type::Deserialize(Schema_GetCommandResponseObject(Op.response.schema_type))) :
::improbable::database_sync::DatabaseSyncService::Commands::GetItems::Response();
Callback(::improbable::database_sync::DatabaseSyncService::Commands::GetItems::ResponseOp(Op.entity_id, Op.request_id, Op.status_code, Op.message, Op.command_id, Response));
Callback(::improbable::database_sync::DatabaseSyncService::Commands::GetItems::ResponseOp(Op.entity_id, Op.request_id, Op.status_code, Op.message, Op.response.command_index, Response));
}
});
}
Expand Down Expand Up @@ -248,12 +250,12 @@ USpatialDispatcher::FCallbackId ExternalSchemaInterface::OnCommandResponse(const
{
return SpatialDispatcher->OnCommandResponse(1901, [Callback](const Worker_CommandResponseOp& Op)
{
if (Op.command_id == 3)
if (Op.response.command_index == 3)
{
auto Response = Op.status_code == Worker_StatusCode::WORKER_STATUS_CODE_SUCCESS ?
::improbable::database_sync::DatabaseSyncService::Commands::Increment::Response(::improbable::database_sync::DatabaseSyncService::Commands::Increment::Response::Type::Deserialize(Schema_GetCommandResponseObject(Op.response.schema_type))) :
::improbable::database_sync::DatabaseSyncService::Commands::Increment::Response();
Callback(::improbable::database_sync::DatabaseSyncService::Commands::Increment::ResponseOp(Op.entity_id, Op.request_id, Op.status_code, Op.message, Op.command_id, Response));
Callback(::improbable::database_sync::DatabaseSyncService::Commands::Increment::ResponseOp(Op.entity_id, Op.request_id, Op.status_code, Op.message, Op.response.command_index, Response));
}
});
}
Expand Down Expand Up @@ -281,12 +283,12 @@ USpatialDispatcher::FCallbackId ExternalSchemaInterface::OnCommandResponse(const
{
return SpatialDispatcher->OnCommandResponse(1901, [Callback](const Worker_CommandResponseOp& Op)
{
if (Op.command_id == 4)
if (Op.response.command_index == 4)
{
auto Response = Op.status_code == Worker_StatusCode::WORKER_STATUS_CODE_SUCCESS ?
::improbable::database_sync::DatabaseSyncService::Commands::Decrement::Response(::improbable::database_sync::DatabaseSyncService::Commands::Decrement::Response::Type::Deserialize(Schema_GetCommandResponseObject(Op.response.schema_type))) :
::improbable::database_sync::DatabaseSyncService::Commands::Decrement::Response();
Callback(::improbable::database_sync::DatabaseSyncService::Commands::Decrement::ResponseOp(Op.entity_id, Op.request_id, Op.status_code, Op.message, Op.command_id, Response));
Callback(::improbable::database_sync::DatabaseSyncService::Commands::Decrement::ResponseOp(Op.entity_id, Op.request_id, Op.status_code, Op.message, Op.response.command_index, Response));
}
});
}
Expand Down Expand Up @@ -314,12 +316,12 @@ USpatialDispatcher::FCallbackId ExternalSchemaInterface::OnCommandResponse(const
{
return SpatialDispatcher->OnCommandResponse(1901, [Callback](const Worker_CommandResponseOp& Op)
{
if (Op.command_id == 5)
if (Op.response.command_index == 5)
{
auto Response = Op.status_code == Worker_StatusCode::WORKER_STATUS_CODE_SUCCESS ?
::improbable::database_sync::DatabaseSyncService::Commands::SetParent::Response(::improbable::database_sync::DatabaseSyncService::Commands::SetParent::Response::Type::Deserialize(Schema_GetCommandResponseObject(Op.response.schema_type))) :
::improbable::database_sync::DatabaseSyncService::Commands::SetParent::Response();
Callback(::improbable::database_sync::DatabaseSyncService::Commands::SetParent::ResponseOp(Op.entity_id, Op.request_id, Op.status_code, Op.message, Op.command_id, Response));
Callback(::improbable::database_sync::DatabaseSyncService::Commands::SetParent::ResponseOp(Op.entity_id, Op.request_id, Op.status_code, Op.message, Op.response.command_index, Response));
}
});
}
Expand Down Expand Up @@ -347,12 +349,12 @@ USpatialDispatcher::FCallbackId ExternalSchemaInterface::OnCommandResponse(const
{
return SpatialDispatcher->OnCommandResponse(1901, [Callback](const Worker_CommandResponseOp& Op)
{
if (Op.command_id == 6)
if (Op.response.command_index == 6)
{
auto Response = Op.status_code == Worker_StatusCode::WORKER_STATUS_CODE_SUCCESS ?
::improbable::database_sync::DatabaseSyncService::Commands::Create::Response(::improbable::database_sync::DatabaseSyncService::Commands::Create::Response::Type::Deserialize(Schema_GetCommandResponseObject(Op.response.schema_type))) :
::improbable::database_sync::DatabaseSyncService::Commands::Create::Response();
Callback(::improbable::database_sync::DatabaseSyncService::Commands::Create::ResponseOp(Op.entity_id, Op.request_id, Op.status_code, Op.message, Op.command_id, Response));
Callback(::improbable::database_sync::DatabaseSyncService::Commands::Create::ResponseOp(Op.entity_id, Op.request_id, Op.status_code, Op.message, Op.response.command_index, Response));
}
});
}
Expand Down Expand Up @@ -380,12 +382,12 @@ USpatialDispatcher::FCallbackId ExternalSchemaInterface::OnCommandResponse(const
{
return SpatialDispatcher->OnCommandResponse(1901, [Callback](const Worker_CommandResponseOp& Op)
{
if (Op.command_id == 7)
if (Op.response.command_index == 7)
{
auto Response = Op.status_code == Worker_StatusCode::WORKER_STATUS_CODE_SUCCESS ?
::improbable::database_sync::DatabaseSyncService::Commands::Delete::Response(::improbable::database_sync::DatabaseSyncService::Commands::Delete::Response::Type::Deserialize(Schema_GetCommandResponseObject(Op.response.schema_type))) :
::improbable::database_sync::DatabaseSyncService::Commands::Delete::Response();
Callback(::improbable::database_sync::DatabaseSyncService::Commands::Delete::ResponseOp(Op.entity_id, Op.request_id, Op.status_code, Op.message, Op.command_id, Response));
Callback(::improbable::database_sync::DatabaseSyncService::Commands::Delete::ResponseOp(Op.entity_id, Op.request_id, Op.status_code, Op.message, Op.response.command_index, Response));
}
});
}
Expand Down Expand Up @@ -413,12 +415,12 @@ USpatialDispatcher::FCallbackId ExternalSchemaInterface::OnCommandResponse(const
{
return SpatialDispatcher->OnCommandResponse(1901, [Callback](const Worker_CommandResponseOp& Op)
{
if (Op.command_id == 8)
if (Op.response.command_index == 8)
{
auto Response = Op.status_code == Worker_StatusCode::WORKER_STATUS_CODE_SUCCESS ?
::improbable::database_sync::DatabaseSyncService::Commands::Batch::Response(::improbable::database_sync::DatabaseSyncService::Commands::Batch::Response::Type::Deserialize(Schema_GetCommandResponseObject(Op.response.schema_type))) :
::improbable::database_sync::DatabaseSyncService::Commands::Batch::Response();
Callback(::improbable::database_sync::DatabaseSyncService::Commands::Batch::ResponseOp(Op.entity_id, Op.request_id, Op.status_code, Op.message, Op.command_id, Response));
Callback(::improbable::database_sync::DatabaseSyncService::Commands::Batch::ResponseOp(Op.entity_id, Op.request_id, Op.status_code, Op.message, Op.response.command_index, Response));
}
});
}
Expand Down Expand Up @@ -446,12 +448,12 @@ USpatialDispatcher::FCallbackId ExternalSchemaInterface::OnCommandResponse(const
{
return SpatialDispatcher->OnCommandResponse(1901, [Callback](const Worker_CommandResponseOp& Op)
{
if (Op.command_id == 9)
if (Op.response.command_index == 9)
{
auto Response = Op.status_code == Worker_StatusCode::WORKER_STATUS_CODE_SUCCESS ?
::improbable::database_sync::DatabaseSyncService::Commands::AssociatePathWithClient::Response(::improbable::database_sync::DatabaseSyncService::Commands::AssociatePathWithClient::Response::Type::Deserialize(Schema_GetCommandResponseObject(Op.response.schema_type))) :
::improbable::database_sync::DatabaseSyncService::Commands::AssociatePathWithClient::Response();
Callback(::improbable::database_sync::DatabaseSyncService::Commands::AssociatePathWithClient::ResponseOp(Op.entity_id, Op.request_id, Op.status_code, Op.message, Op.command_id, Response));
Callback(::improbable::database_sync::DatabaseSyncService::Commands::AssociatePathWithClient::ResponseOp(Op.entity_id, Op.request_id, Op.status_code, Op.message, Op.response.command_index, Response));
}
});
}
Expand Down Expand Up @@ -479,12 +481,12 @@ USpatialDispatcher::FCallbackId ExternalSchemaInterface::OnCommandResponse(const
{
return SpatialDispatcher->OnCommandResponse(1901, [Callback](const Worker_CommandResponseOp& Op)
{
if (Op.command_id == 10)
if (Op.response.command_index == 10)
{
auto Response = Op.status_code == Worker_StatusCode::WORKER_STATUS_CODE_SUCCESS ?
::improbable::database_sync::DatabaseSyncService::Commands::GetMetrics::Response(::improbable::database_sync::DatabaseSyncService::Commands::GetMetrics::Response::Type::Deserialize(Schema_GetCommandResponseObject(Op.response.schema_type))) :
::improbable::database_sync::DatabaseSyncService::Commands::GetMetrics::Response();
Callback(::improbable::database_sync::DatabaseSyncService::Commands::GetMetrics::ResponseOp(Op.entity_id, Op.request_id, Op.status_code, Op.message, Op.command_id, Response));
Callback(::improbable::database_sync::DatabaseSyncService::Commands::GetMetrics::ResponseOp(Op.entity_id, Op.request_id, Op.status_code, Op.message, Op.response.command_index, Response));
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ bool UDeploymentSnapshotTemplate::WriteToSnapshotOutput(Worker_SnapshotOutputStr
// Serialize Session component data
Worker_ComponentData SessionComponentData{};
SessionComponentData.component_id = 1000;
SessionComponentData.schema_type = Schema_CreateComponentData(1000);
SessionComponentData.schema_type = Schema_CreateComponentData();
Schema_Object* SessionComponentDataObject = Schema_GetComponentDataFields(SessionComponentData.schema_type);
Schema_AddInt32(SessionComponentDataObject, 1, 1);

Worker_ComponentData DeploymentComponentData{};
DeploymentComponentData.component_id = 1001;
DeploymentComponentData.schema_type = Schema_CreateComponentData(1001);
DeploymentComponentData.schema_type = Schema_CreateComponentData();

Components.Add(SpatialGDK::Position(SpatialGDK::Origin).CreatePositionData());
Components.Add(SpatialGDK::Metadata(TEXT("Session")).CreateMetadataData());
Expand All @@ -46,7 +46,8 @@ bool UDeploymentSnapshotTemplate::WriteToSnapshotOutput(Worker_SnapshotOutputStr
SessionEntity.component_count = Components.Num();
SessionEntity.components = Components.GetData();

bool success = Worker_SnapshotOutputStream_WriteEntity(OutputStream, &SessionEntity) != 0;
Worker_SnapshotOutputStream_WriteEntity(OutputStream, &SessionEntity);
bool success = Worker_SnapshotOutputStream_GetState(OutputStream).stream_state == Worker_StreamState::WORKER_STREAM_STATE_GOOD;
if (success) {
NextEntityId++;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ void USpatialSessionStateComponent::SendStateUpdate(EGDKSessionProgress SessionP
Worker_EntityId target_entity_id = SessionEntityId;
Worker_ComponentUpdate component_update = {};
component_update.component_id = SessionComponentId;
component_update.schema_type = Schema_CreateComponentUpdate(SessionComponentId);
component_update.schema_type = Schema_CreateComponentUpdate();
Schema_Object* fields_object = Schema_GetComponentUpdateFields(component_update.schema_type);
Schema_AddInt32(fields_object, 1, SessionState);
SpatialNetDriver->Connection->SendComponentUpdate(target_entity_id, &component_update);
Expand Down