Skip to content

Commit 07eb874

Browse files
Merge pull request #1 from Unity-Technologies/matt_work
Bringing up to date to MLAPI public
2 parents fbd31df + 2e5750c commit 07eb874

35 files changed

Lines changed: 612 additions & 484 deletions

.github/CONTRIBUTING.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
# How to contribute
2-
32
I'm really glad you're reading this, because we need volunteer developers to help this project evolve.
43

54
If you haven't already, come find us on [Discord](http://discord.mlapi.network).
6-
75
## Submitting changes
8-
96
Please send a [GitHub Pull Request to MLAPI](https://github.com/midlevel/MLAPI/pull/new/master) with a clear list of what you've done (read more about [pull requests](http://help.github.com/pull-requests/)).
107
Please follow our commit message conventions (below) and make sure all of your commits are atomic (one feature per commit).
118

129
## Commit Message Guidelines
13-
1410
We have very precise rules over how our git commit messages can be formatted. This leads to **more
1511
readable messages** that are easy to follow when looking through the **project history**. But also,
1612
we use the git commit messages to **generate the MLAPI change log**. We follow angular's message format.

MLAPI/Configuration/MLAPIConstants.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace MLAPI.Configuration
55
/// </summary>
66
internal static class MLAPIConstants
77
{
8-
internal const string MLAPI_PROTOCOL_VERSION = "10.7.0";
8+
internal const string MLAPI_PROTOCOL_VERSION = "12.0.0";
99

1010
internal const byte MLAPI_CERTIFICATE_HAIL = 0;
1111
internal const byte MLAPI_CERTIFICATE_HAIL_RESPONSE = 1;
@@ -31,6 +31,7 @@ internal static class MLAPIConstants
3131
internal const byte MLAPI_DESTROY_OBJECTS = 21;
3232
internal const byte MLAPI_NAMED_MESSAGE = 22;
3333
internal const byte MLAPI_SYNCED_VAR = 23;
34+
internal const byte MLAPI_SERVER_LOG = 24;
3435
internal const byte INVALID = 32;
3536

3637
internal static readonly string[] MESSAGE_NAMES = {
@@ -58,7 +59,7 @@ internal static class MLAPIConstants
5859
"MLAPI_DESTROY_OBJECTS",
5960
"MLAPI_NAMED_MESSAGE",
6061
"MLAPI_SYNCED_VAR",
61-
"",
62+
"MLAPI_SERVER_LOG",
6263
"",
6364
"",
6465
"",

MLAPI/Configuration/NetworkConfig.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,10 @@ public class NetworkConfig
176176
[Tooltip("The amount of time a message should be buffered for without being consumed. If it is not consumed within this time, it will be dropped")]
177177
public float MessageBufferTimeout = 20f;
178178
/// <summary>
179+
/// Whether or not to enable network logs.
180+
/// </summary>
181+
public bool EnableNetworkLogs = true;
182+
/// <summary>
179183
/// Whether or not to enable the ECDHE key exchange to allow for encryption and authentication of messages
180184
/// </summary>
181185
[Tooltip("Whether or not to enable the ECDHE key exchange to allow for encryption and authentication of messages")]
@@ -257,14 +261,15 @@ public string ToBase64()
257261
writer.WriteInt32Packed(config.LoadSceneTimeOut);
258262
writer.WriteBool(config.EnableTimeResync);
259263
writer.WriteBool(config.EnsureNetworkedVarLengthSafety);
260-
writer.WriteBits((byte)config.RpcHashSize, 3);
264+
writer.WriteBits((byte)config.RpcHashSize, 2);
261265
writer.WriteBool(ForceSamePrefabs);
262266
writer.WriteBool(UsePrefabSync);
263267
writer.WriteBool(EnableSceneManagement);
264268
writer.WriteBool(RecycleNetworkIds);
265269
writer.WriteSinglePacked(NetworkIdRecycleDelay);
266270
writer.WriteBool(EnableNetworkedVar);
267271
writer.WriteBool(AllowRuntimeSceneChanges);
272+
writer.WriteBool(EnableNetworkLogs);
268273
stream.PadStream();
269274

270275
return Convert.ToBase64String(stream.ToArray());
@@ -305,14 +310,15 @@ public void FromBase64(string base64)
305310
config.LoadSceneTimeOut = reader.ReadInt32Packed();
306311
config.EnableTimeResync = reader.ReadBool();
307312
config.EnsureNetworkedVarLengthSafety = reader.ReadBool();
308-
config.RpcHashSize = (HashSize)reader.ReadBits(3);
313+
config.RpcHashSize = (HashSize)reader.ReadBits(2);
309314
config.ForceSamePrefabs = reader.ReadBool();
310315
config.UsePrefabSync = reader.ReadBool();
311316
config.EnableSceneManagement = reader.ReadBool();
312317
config.RecycleNetworkIds = reader.ReadBool();
313318
config.NetworkIdRecycleDelay = reader.ReadSinglePacked();
314319
config.EnableNetworkedVar = reader.ReadBool();
315320
config.AllowRuntimeSceneChanges = reader.ReadBool();
321+
config.EnableNetworkLogs = reader.ReadBool();
316322
}
317323
}
318324
}
@@ -338,7 +344,7 @@ public ulong GetConfig(bool cache = true)
338344
writer.WriteUInt16Packed(ProtocolVersion);
339345
writer.WriteString(MLAPIConstants.MLAPI_PROTOCOL_VERSION);
340346

341-
if (!AllowRuntimeSceneChanges)
347+
if (EnableSceneManagement && !AllowRuntimeSceneChanges)
342348
{
343349
for (int i = 0; i < RegisteredScenes.Count; i++)
344350
{
@@ -362,7 +368,7 @@ public ulong GetConfig(bool cache = true)
362368
writer.WriteBool(EnsureNetworkedVarLengthSafety);
363369
writer.WriteBool(EnableEncryption);
364370
writer.WriteBool(SignKeyExchange);
365-
writer.WriteBits((byte)RpcHashSize, 3);
371+
writer.WriteBits((byte)RpcHashSize, 2);
366372
stream.PadStream();
367373

368374
if (cache)

MLAPI/Configuration/NetworkedPrefab.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ internal ulong Hash
1616
{
1717
if (Prefab == null)
1818
{
19-
if (LogHelper.CurrentLogLevel <= LogLevel.Normal) LogHelper.LogWarning("NetworkedPrefab is not assigned");
19+
if (NetworkLog.CurrentLogLevel <= LogLevel.Normal) NetworkLog.LogWarning("NetworkedPrefab is not assigned");
2020
return 0;
2121
}
2222
else if (Prefab.GetComponent<NetworkedObject>() == null)
2323
{
24-
if (LogHelper.CurrentLogLevel <= LogLevel.Normal) LogHelper.LogWarning("The NetworkedPrefab " + Prefab.name + " does not have a NetworkedObject");
24+
if (NetworkLog.CurrentLogLevel <= LogLevel.Normal) NetworkLog.LogWarning("The NetworkedPrefab " + Prefab.name + " does not have a NetworkedObject");
2525
return 0;
2626
}
2727
else return Prefab.GetComponent<NetworkedObject>().PrefabHash;

0 commit comments

Comments
 (0)