Changes to fix rewindable attributes incorrectly used on read-only archetype data, fix some bad logic in the pre-render blending code, adding a serializer for AZ::Transform, and adding our client.cfg and server.cfg files to .gitignore

Signed-off-by: kberg-amzn <karlberg@amazon.com>
monroegm-disable-blank-issue-2
kberg-amzn 5 years ago
parent ab354f2e9b
commit bd5226aac5

2
.gitignore vendored

@ -14,6 +14,8 @@ UserSettings.xml
FrameCapture/**
.DS_Store
user*.cfg
client*.cfg
server*.cfg
.mayaSwatches/
_savebackup/
#Output folder for test results when running Automated Tests

@ -302,4 +302,22 @@ namespace AzNetworking
return serializer.IsValid();
}
};
template <>
struct SerializeObjectHelper<AZ::Transform>
{
static bool SerializeObject(ISerializer& serializer, AZ::Transform& value)
{
AZ::Vector3 translation = value.GetTranslation();
AZ::Quaternion rotation = value.GetRotation();
float uniformScale = value.GetUniformScale();
serializer.Serialize(translation, "Translation");
serializer.Serialize(rotation, "Rotation");
serializer.Serialize(uniformScale, "Scale");
value.SetTranslation(translation);
value.SetRotation(rotation);
value.SetUniformScale(uniformScale);
return serializer.IsValid();
}
};
}

@ -8,22 +8,22 @@
{% set PropertyName = UpperFirst(Property.attrib['Name']) %}
{% if Property.attrib['Container'] == 'Array' %}
{% if Property.attrib['IsRewindable']|booleanTrue %}
const RewindableArray<{{ Property.attrib['Type'] }}, {{ Property.attrib['Count'] }}> &Get{{ PropertyName }}Array() const;
const RewindableArray<{{ Property.attrib['Type'] }}, {{ Property.attrib['Count'] }}>& Get{{ PropertyName }}Array() const;
{% else %}
const AZStd::array<{{ Property.attrib['Type'] }}, {{ Property.attrib['Count'] }}> &Get{{ PropertyName }}Array() const;
const AZStd::array<{{ Property.attrib['Type'] }}, {{ Property.attrib['Count'] }}>& Get{{ PropertyName }}Array() const;
{% endif %}
const {{ Property.attrib['Type'] }} &Get{{ PropertyName }}(int32_t index) const;
const {{ Property.attrib['Type'] }}& Get{{ PropertyName }}(int32_t index) const;
{% if Property.attrib['GenerateEventBindings']|booleanTrue %}
void {{ PropertyName }}AddEvent(AZ::Event<int32_t, {{ Property.attrib['Type'] }}>::Handler& handler);
{% endif %}
{% elif Property.attrib['Container'] == 'Vector' %}
{% if Property.attrib['IsRewindable']|booleanTrue %}
const RewindableFixedVector<{{ Property.attrib['Type'] }}, {{ Property.attrib['Count'] }}> &Get{{ PropertyName }}Vector() const;
const RewindableFixedVector<{{ Property.attrib['Type'] }}, {{ Property.attrib['Count'] }}>& Get{{ PropertyName }}Vector() const;
{% else %}
const AZStd::fixed_vector<{{ Property.attrib['Type'] }}, {{ Property.attrib['Count'] }}> &Get{{ PropertyName }}Vector() const;
const AZStd::fixed_vector<{{ Property.attrib['Type'] }}, {{ Property.attrib['Count'] }}>& Get{{ PropertyName }}Vector() const;
{% endif %}
const {{ Property.attrib['Type'] }} &Get{{ PropertyName }}(int32_t index) const;
const {{ Property.attrib['Type'] }} &{{ PropertyName }}GetBack() const;
const {{ Property.attrib['Type'] }}& Get{{ PropertyName }}(int32_t index) const;
const {{ Property.attrib['Type'] }}& {{ PropertyName }}GetBack() const;
uint32_t {{ PropertyName }}GetSize() const;
{% if Property.attrib['GenerateEventBindings']|booleanTrue %}
void {{ PropertyName }}AddEvent(AZ::Event<int32_t, {{ Property.attrib['Type'] }}>::Handler& handler);
@ -63,7 +63,7 @@ void Set{{ PropertyName }}(const {{ Property.attrib['Type'] }}& value);
{% macro DeclareNetworkPropertyGetters(Component, ReplicateFrom, ReplicateTo, IsProtected) %}
{% call(Property) AutoComponentMacros.ParseNetworkProperties(Component, ReplicateFrom, ReplicateTo) %}
{% set PropertyName = UpperFirst(Property.attrib['Name']) %}
{% if Property.attrib['IsPublic'] | booleanTrue != IsProtected %}
{% if Property.attrib['IsPublic']|booleanTrue != IsProtected %}
//! {{ PropertyName }} Accessors
//! {{ Property.attrib['Description'] }}.
{{ DeclareNetworkPropertyGetter(Property) }}
@ -105,7 +105,7 @@ const {{ Property.attrib['Type'] }}& Get{{ PropertyName }}() const;
{% macro DeclareNetworkPropertyAccessors(Component, ReplicateFrom, ReplicateTo, IsProtected) %}
{% call(Property) AutoComponentMacros.ParseNetworkProperties(Component, ReplicateFrom, ReplicateTo) %}
{% set PropertyName = UpperFirst(Property.attrib['Name']) %}
{% if Property.attrib['IsPublic'] | booleanTrue != IsProtected %}
{% if Property.attrib['IsPublic']|booleanTrue != IsProtected %}
//! {{ PropertyName }} Accessors
//! {{ Property.attrib['Description'] }}.
{{ DeclareNetworkPropertyGetter(Property) -}}

@ -507,7 +507,7 @@ case {{ UpperFirst(Component.attrib['Name']) }}Internal::RemoteProcedure::{{ Upp
{% endif %}
}
{% else %}
Handle{{ UpperFirst(Property.attrib['Name']) }}({{ ', '.join(rpcParamList) }});
Handle{{ UpperFirst(Property.attrib['Name']) }}(invokingConnection, {{ ', '.join(rpcParamList) }});
{% endif %}
}
else if (paramsSerialized)
@ -712,11 +712,7 @@ void {{ ClassName }}::NotifyChanges{{ AutoComponentMacros.GetNetPropertiesSetNam
{% macro DefineArchetypePropertyGet(Property, ClassType, ClassName, Prefix = '') %}
{% if ClassType == '' or Property.attrib['ExportTo'] == ClassType or Property.attrib['ExportTo'] == "Common" %}
{% if Property.attrib['Container'] == 'Array' %}
{% if Property.attrib['IsRewindable']|booleanTrue %}
const RewindableArray<{{ Property.attrib['Type'] }}, {{ Property.attrib['Count'] }}>& {{ ClassName }}::Get{{ UpperFirst(Property.attrib['Name']) }}Array() const
{% else %}
const AZStd::array<{{ Property.attrib['Type'] }}, {{ Property.attrib['Count'] }}>& {{ ClassName }}::Get{{ UpperFirst(Property.attrib['Name']) }}Array() const
{% endif %}
{
return {{ Prefix }}m_{{ LowerFirst(Property.attrib['Name']) }};
}
@ -727,11 +723,7 @@ const {{ Property.attrib['Type'] }}& {{ ClassName }}::Get{{ UpperFirst(Property.
}
{% elif Property.attrib['Container'] == 'Vector' %}
{% if Property.attrib['IsRewindable']|booleanTrue %}
const RewindableFixedVector<{{ Property.attrib['Type'] }}, {{ Property.attrib['Count'] }}>& {{ ClassName }}::Get{{ UpperFirst(Property.attrib['Name']) }}Vector() const
{% else %}
const AZStd::fixed_vector<{{ Property.attrib['Type'] }}, {{ Property.attrib['Count'] }}>& {{ ClassName }}::Get{{ UpperFirst(Property.attrib['Name']) }}Vector() const
{% endif %}
{
return {{ Prefix }}m_{{ LowerFirst(Property.attrib['Name']) }};
}

@ -18,9 +18,4 @@
<NetworkProperty Type="uint8_t" Name="resetCount" Init="0" ReplicateFrom="Authority" ReplicateTo="Client" IsRewindable="false" IsPredictable="true" IsPublic="true" Container="Object" ExposeToEditor="false" ExposeToScript="false" GenerateEventBindings="true" />
<NetworkProperty Type="NetEntityId" Name="parentEntityId" Init="InvalidNetEntityId" ReplicateFrom="Authority" ReplicateTo="Client" IsRewindable="true" IsPredictable="true" IsPublic="true" Container="Object" ExposeToEditor="false" ExposeToScript="false" GenerateEventBindings="true" />
<NetworkProperty Type="int32_t" Name="parentAttachmentBoneId" Init="-1" ReplicateFrom="Authority" ReplicateTo="Client" IsRewindable="true" IsPredictable="true" IsPublic="true" Container="Object" ExposeToEditor="false" ExposeToScript="false" GenerateEventBindings="true" />
<!--
<ArchetypeProperty Type="bool" Name="snapToGround" Init="false" ExposeToEditor="true" />
<ArchetypeProperty Type="bool" Name="useGroundNormal" Init="false" ExposeToEditor="true" />
-->
</Component>

@ -847,12 +847,10 @@ namespace Multiplayer
void MultiplayerSystemComponent::TickVisibleNetworkEntities(float deltaTime, float serverRateSeconds)
{
const float targetAdjustBlend = AZStd::clamp(deltaTime / serverRateSeconds, 0.0f, 1.0f);
m_renderBlendFactor += targetAdjustBlend;
// Linear close to the origin, but asymptote at y = 1
const float adjustedBlendFactor = 1.0f - (std::pow(0.2f, m_renderBlendFactor));
AZLOG(NET_Blending, "Computed blend factor of %f", adjustedBlendFactor);
const float targetAdjustBlend = AZStd::clamp(deltaTime / serverRateSeconds, 0.0f, 1.0f);
m_renderBlendFactor = 1.0f - (std::pow(0.2f, m_renderBlendFactor + targetAdjustBlend));
AZLOG(NET_Blending, "Computed blend factor of %0.2f using a frametime of %0.2f and a serverTickRate of %0.2f", m_renderBlendFactor, deltaTime, serverRateSeconds);
if (Camera::ActiveCameraRequestBus::HasHandlers())
{
@ -895,7 +893,7 @@ namespace Multiplayer
for (NetBindComponent* netBindComponent : gatheredEntities)
{
netBindComponent->NotifyPreRender(deltaTime, adjustedBlendFactor);
netBindComponent->NotifyPreRender(deltaTime, m_renderBlendFactor);
}
}
else
@ -907,7 +905,7 @@ namespace Multiplayer
NetBindComponent* netBindComponent = entity->FindComponent<NetBindComponent>();
if (netBindComponent != nullptr)
{
netBindComponent->NotifyPreRender(deltaTime, adjustedBlendFactor);
netBindComponent->NotifyPreRender(deltaTime, m_renderBlendFactor);
}
}
}

Loading…
Cancel
Save