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

feat: server distribution config #3132

Merged
merged 2 commits into from
Nov 20, 2024
Merged
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 @@ -5,9 +5,12 @@ namespace Unity.Netcode
{
internal struct ServiceConfig : INetworkSerializable
{
private const int k_AddServerRedistribution = 1;

public uint Version;
public bool IsRestoredSession;
public ulong CurrentSessionOwner;
public bool ServerRedistribution;

public void NetworkSerialize<T>(BufferSerializer<T> serializer) where T : IReaderWriter
{
Expand All @@ -16,12 +19,22 @@ public void NetworkSerialize<T>(BufferSerializer<T> serializer) where T : IReade
BytePacker.WriteValueBitPacked(serializer.GetFastBufferWriter(), Version);
serializer.SerializeValue(ref IsRestoredSession);
BytePacker.WriteValueBitPacked(serializer.GetFastBufferWriter(), CurrentSessionOwner);

if (Version >= k_AddServerRedistribution)
{
serializer.SerializeValue(ref ServerRedistribution);
}
}
else
{
ByteUnpacker.ReadValueBitPacked(serializer.GetFastBufferReader(), out Version);
serializer.SerializeValue(ref IsRestoredSession);
ByteUnpacker.ReadValueBitPacked(serializer.GetFastBufferReader(), out CurrentSessionOwner);

if (Version >= k_AddServerRedistribution)
{
serializer.SerializeValue(ref ServerRedistribution);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ internal struct ClientConfig : INetworkSerializable
/// is not bypass feature compatible.
/// </summary>
private const int k_BypassFeatureCompatible = 1;
public int Version => k_BypassFeatureCompatible;
private const int k_ServerDistributionCompatible = k_BypassFeatureCompatible + 1;
public int Version => k_ServerDistributionCompatible;
public uint TickRate;
public bool EnableSceneManagement;

Expand Down
Loading