Skip to content
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 @@ -29,7 +29,7 @@ public override ILPostProcessResult Process(ICompiledAssembly compiledAssembly)
var assemblyDefinition = CodeGenHelpers.AssemblyDefinitionFor(compiledAssembly);
if (assemblyDefinition == null)
{
m_Diagnostics.AddError($"Cannot read MLAPI Runtime assembly definition: {compiledAssembly.Name}");
m_Diagnostics.AddError($"Cannot read Netcode Runtime assembly definition: {compiledAssembly.Name}");
return null;
}

Expand Down Expand Up @@ -60,7 +60,7 @@ public override ILPostProcessResult Process(ICompiledAssembly compiledAssembly)
}
else
{
m_Diagnostics.AddError($"Cannot get main module from MLAPI Runtime assembly definition: {compiledAssembly.Name}");
m_Diagnostics.AddError($"Cannot get main module from Netcode Runtime assembly definition: {compiledAssembly.Name}");
}

// write
Expand Down
13 changes: 7 additions & 6 deletions com.unity.multiplayer.mlapi/Editor/NetcodeProfilerModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ namespace Unity.Netcode.Editor
internal static class NetcodeProfilerModule
{
#if UNITY_2020_2_OR_NEWER && ENABLE_PROFILER
private const string k_RpcModuleName = "MLAPI RPCs";
private const string k_OperationModuleName = "MLAPI Operations";
private const string k_MessageModuleName = "MLAPI Messages";
private const string k_RpcModuleName = "Netcode RPCs";
private const string k_OperationModuleName = "Netcode Operations";
private const string k_MessageModuleName = "Netcode Messages";
Comment on lines +13 to +15
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did we have any dependencies on these hardcoded strings? @becksebenius-unity @Rosme 👀

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope, should be fine. upgrading users might have funky profiler modules until they restart the editor. probably not an issue


#pragma warning disable IDE1006 // disable naming rule violation check
/// <summary>
Expand Down Expand Up @@ -75,9 +75,9 @@ private class NetcodeModules

private delegate List<NetcodeProfilerCounter> CounterListFactoryDelegate();

private static bool CreateNetcodeDynamicModule(ref NetcodeModules mlapiModules, string moduleName, CounterListFactoryDelegate counterListFactoryDelegate)
private static bool CreateNetcodeDynamicModule(ref NetcodeModules netcodeModules, string moduleName, CounterListFactoryDelegate counterListFactoryDelegate)
{
var module = mlapiModules.m_Modules.Find(x => x.m_Name == moduleName);
var module = netcodeModules.m_Modules.Find(x => x.m_Name == moduleName);
if (module == null)
{
var newModule = new NetcodeProfilerModuleData
Expand All @@ -86,7 +86,8 @@ private static bool CreateNetcodeDynamicModule(ref NetcodeModules mlapiModules,
m_ChartCounters = counterListFactoryDelegate(),
m_DetailCounters = counterListFactoryDelegate(),
};
mlapiModules.m_Modules.Add(newModule);
netcodeModules.m_Modules.Add(newModule);

return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ public override void OnInspectorGUI()

if (m_NetworkTransportProperty.objectReferenceValue == null)
{
EditorGUILayout.HelpBox("You have no transport selected. A transport is required for the MLAPI to work. Which one do you want?", MessageType.Warning);
EditorGUILayout.HelpBox("You have no transport selected. A transport is required for netcode to work. Which one do you want?", MessageType.Warning);

int selection = EditorGUILayout.Popup(0, m_TransportNames);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Unity.Netcode.Prototyping
/// <summary>
/// A prototype component for syncing animations
/// </summary>
[AddComponentMenu("MLAPI/NetworkAnimator")]
[AddComponentMenu("Netcode/" + nameof(NetworkAnimator))]
public class NetworkAnimator : NetworkBehaviour
{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Unity.Netcode.Prototyping
/// <summary>
/// A prototype component for syncing NavMeshAgents
/// </summary>
[AddComponentMenu("MLAPI/NetworkNavMeshAgent")]
[AddComponentMenu("Netcode/" + nameof(NetworkNavMeshAgent))]
[RequireComponent(typeof(NavMeshAgent))]
public class NetworkNavMeshAgent : NetworkBehaviour
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Unity.Netcode.Prototyping
/// <summary>
/// A prototype component for syncing transforms
/// </summary>
[AddComponentMenu("MLAPI/NetworkTransform")]
[AddComponentMenu("Netcode/" + nameof(NetworkTransform))]
public class NetworkTransform : NetworkBehaviour
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ public class NetworkConfig


/// <summary>
/// The tickrate of network ticks. This value controls how often MLAPI runs user code and sends out data.
/// The tickrate of network ticks. This value controls how often netcode runs user code and sends out data.
/// </summary>
[Tooltip("The tickrate. This value controls how often MLAPI runs user code and sends out data. The value is in 'ticks per seconds' which means a value of 50 will result in 50 ticks being executed per second or a fixed delta time of 0.02.")]
[Tooltip("The tickrate. This value controls how often netcode runs user code and sends out data. The value is in 'ticks per seconds' which means a value of 50 will result in 50 ticks being executed per second or a fixed delta time of 0.02.")]
public int TickRate = 30;

/// <summary>
Expand Down Expand Up @@ -117,10 +117,10 @@ public class NetworkConfig
public bool EnableSceneManagement = true;

/// <summary>
/// Whether or not the MLAPI should check for differences in the prefabs at connection.
/// Whether or not the netcode should check for differences in the prefabs at connection.
/// If you dynamically add prefabs at runtime, turn this OFF
/// </summary>
[Tooltip("Whether or not the MLAPI should check for differences in the prefab lists at connection")]
[Tooltip("Whether or not the netcode should check for differences in the prefab lists at connection")]
public bool ForceSamePrefabs = true;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace Unity.Netcode
{
/// <summary>
/// A static class containing MLAPI constants
/// A static class containing network constants
/// </summary>
internal static class NetworkConstants
{
Expand Down
6 changes: 3 additions & 3 deletions com.unity.multiplayer.mlapi/Runtime/Core/NetworkManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Unity.Netcode
/// <summary>
/// The main component of the library
/// </summary>
[AddComponentMenu("MLAPI/NetworkManager", -100)]
[AddComponentMenu("Netcode/" + nameof(NetworkManager), -100)]
public class NetworkManager : MonoBehaviour, INetworkUpdateSystem, IProfilableTransportProvider
{
#pragma warning disable IDE1006 // disable naming rule violation check
Expand Down Expand Up @@ -273,7 +273,7 @@ private void OnValidate()
{
if (NetworkLog.CurrentLogLevel <= LogLevel.Normal)
{
NetworkLog.LogWarning("Active scene is not registered as a network scene. The MLAPI has added it");
NetworkLog.LogWarning("Active scene is not registered as a network scene. Netcode has added it");
}

NetworkConfig.RegisteredScenes.Add(activeSceneName);
Expand Down Expand Up @@ -725,7 +725,7 @@ public void StopHost()
IsClient = false;
StopServer();

//We don't stop client since we dont actually have a transport connection to our own host. We just handle host messages directly in the MLAPI
//We don't stop client since we dont actually have a transport connection to our own host. We just handle host messages directly in the netcode
}

/// <summary>
Expand Down
10 changes: 5 additions & 5 deletions com.unity.multiplayer.mlapi/Runtime/Core/NetworkObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Unity.Netcode
/// <summary>
/// A component used to identify that a GameObject in the network
/// </summary>
[AddComponentMenu("MLAPI/NetworkObject", -99)]
[AddComponentMenu("Netcode/" + nameof(NetworkObject), -99)]
[DisallowMultipleComponent]
public sealed class NetworkObject : MonoBehaviour
{
Expand Down Expand Up @@ -151,7 +151,7 @@ internal set
public delegate bool VisibilityDelegate(ulong clientId);

/// <summary>
/// Delegate invoked when the MLAPI needs to know if the object should be visible to a client, if null it will assume true
/// Delegate invoked when the netcode needs to know if the object should be visible to a client, if null it will assume true
/// </summary>
public VisibilityDelegate CheckObjectVisibility = null;

Expand All @@ -162,7 +162,7 @@ internal set
public delegate bool SpawnDelegate(ulong clientId);

/// <summary>
/// Delegate invoked when the MLAPI needs to know if it should include the transform when spawning the object, if null it will assume true
/// Delegate invoked when the netcode needs to know if it should include the transform when spawning the object, if null it will assume true
/// </summary>
public SpawnDelegate IncludeTransformWhenSpawning = null;

Expand Down Expand Up @@ -259,7 +259,7 @@ public static void NetworkShow(List<NetworkObject> networkObjects, ulong clientI
}


// Do the safety loop first to prevent putting the MLAPI in an invalid state.
// Do the safety loop first to prevent putting the netcode in an invalid state.
for (int i = 0; i < networkObjects.Count; i++)
{
if (!networkObjects[i].IsSpawned)
Expand Down Expand Up @@ -366,7 +366,7 @@ public static void NetworkHide(List<NetworkObject> networkObjects, ulong clientI
throw new VisibilityChangeException("Cannot hide an object from the server");
}

// Do the safety loop first to prevent putting the MLAPI in an invalid state.
// Do the safety loop first to prevent putting the netcode in an invalid state.
for (int i = 0; i < networkObjects.Count; i++)
{
if (!networkObjects[i].IsSpawned)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ private void WriteBuffer(NetworkBuffer buffer)

// todo: consider using a Key, instead of 3 ints, if it can be exposed
/// <summary>
/// Called by the rest of MLAPI when a NetworkVariable changed and need to go in our snapshot
/// Called by the rest of the netcode when a NetworkVariable changed and need to go in our snapshot
/// Might not happen for all variable on every frame. Might even happen more than once.
/// </summary>
/// <param name="networkVariable">The NetworkVariable to write, or rather, its INetworkVariable</param>
Expand Down
14 changes: 7 additions & 7 deletions com.unity.multiplayer.mlapi/Runtime/Logging/NetworkLog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ public static class NetworkLog
/// <value>The current log level.</value>
internal static LogLevel CurrentLogLevel => NetworkManager.Singleton == null ? LogLevel.Normal : NetworkManager.Singleton.LogLevel;

// MLAPI internal logging
internal static void LogInfo(string message) => Debug.Log($"[MLAPI] {message}");
internal static void LogWarning(string message) => Debug.LogWarning($"[MLAPI] {message}");
internal static void LogError(string message) => Debug.LogError($"[MLAPI] {message}");
// internal logging
internal static void LogInfo(string message) => Debug.Log($"[Netcode] {message}");
internal static void LogWarning(string message) => Debug.LogWarning($"[Netcode] {message}");
internal static void LogError(string message) => Debug.LogError($"[Netcode] {message}");

/// <summary>
/// Logs an info log locally and on the server if possible.
Expand Down Expand Up @@ -70,9 +70,9 @@ private static void LogServer(string message, LogType logType)
}
}

internal static void LogInfoServerLocal(string message, ulong sender) => Debug.Log($"[MLAPI_SERVER Sender={sender}] {message}");
internal static void LogWarningServerLocal(string message, ulong sender) => Debug.LogWarning($"[MLAPI_SERVER Sender={sender}] {message}");
internal static void LogErrorServerLocal(string message, ulong sender) => Debug.LogError($"[MLAPI_SERVER Sender={sender}] {message}");
internal static void LogInfoServerLocal(string message, ulong sender) => Debug.Log($"[Netcode-Server Sender={sender}] {message}");
internal static void LogWarningServerLocal(string message, ulong sender) => Debug.LogWarning($"[Netcode-Server Sender={sender}] {message}");
internal static void LogErrorServerLocal(string message, ulong sender) => Debug.LogError($"[Netcode-Server Sender={sender}] {message}");

internal enum LogType
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ private void OnSceneLoaded(Guid switchSceneGuid, Stream objectStream)

private void OnServerLoadedScene(Guid switchSceneGuid)
{
// Register in-scene placed NetworkObjects with MLAPI
// Register in-scene placed NetworkObjects with the netcode
foreach (var keyValuePair in ScenePlacedObjects)
{
if (!keyValuePair.Value.IsPlayerObject)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace Unity.Netcode
{
/// <summary>
/// Helper class to manage the MLAPI serialization.
/// Helper class to manage the netcode serialization
/// </summary>
public static class SerializationManager
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public enum ConnectionIdSpreadMethod
/// <summary>
/// Drops the last few bits (right side) and replaces them with the transport index.
/// Ensure that ALL transports dont use the last bits in their produced clientId.
/// This option is for advanced users and will not work with the official MLAPI transports as they use the last bits.
/// This option is for advanced users and will not work with the official netcode transports as they use the last bits.
/// </summary>
ReplaceLastBits,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ public void UNetCustomChannelRegistrationTest()
nm.Shutdown();

ut.Channels.Clear();
// test 2: add a bogus channel (one that intersects with the MLAPI built-in ones.) Expect failure
// test 2: add a bogus channel (one that intersects with the netcode built-in ones.) Expect failure
ut.Channels.Add(new UNetChannel { Id = (byte)NetworkChannel.Internal, Type = QosType.Unreliable });

try
{
nm.StartServer();
Assert.Fail("The UNet transport allowed registration of an MLAPI-reserved channel");
Assert.Fail("The UNet transport allowed registration of an netcode-reserved channel");
}
catch (Exception ex)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Unity.Netcode
{
/// <summary>
/// A transport channel used by the MLAPI
/// A transport channel used by the netcode
/// </summary>
[Serializable]
public struct TransportChannel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ private static NetworkEventType BaseReceive(NetworkEventType netEvent, int hostI
{
if ((NetworkError)error == NetworkError.CRCMismatch)
{
Debug.LogError("[Netcode.Relay] The MLAPI Relay detected a CRC mismatch. This could be due to the maxClients or other connectionConfig settings not being the same");
Debug.LogError("[Netcode.Relay] Relay detected a CRC mismatch. This could be due to the maxClients or other connectionConfig settings not being the same");
}

return NetworkEventType.DisconnectEvent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace Unity.Netcode.Transports.UNET
{
/// <summary>
/// A transport channel used by the MLAPI
/// A transport channel used by the netcode
/// </summary>
[Serializable]
public class UNetChannel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public enum SendMode
// transport.Channels.Add(
// new UNetChannel()
// {
// Id = Channel.ChannelUnused + MY_CHANNEL, <<-- must offset from reserved channel offset in MLAPI SDK
// Id = Channel.ChannelUnused + MY_CHANNEL, <<-- must offset from reserved channel offset in netcode SDK
// Type = QosType.Unreliable
// }
// );
Expand Down Expand Up @@ -395,7 +395,7 @@ public ConnectionConfig GetConfig()
{
var connectionConfig = new ConnectionConfig();

// MLAPI built-in channels
// Built-in netcode channels
for (int i = 0; i < NETCODE_CHANNELS.Length; i++)
{
int channelId = AddNetcodeChannel(NETCODE_CHANNELS[i].Delivery, connectionConfig);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public void CustomMessageManagerAssigned()
var networkManager = gameObject.AddComponent<NetworkManager>();
var transport = gameObject.AddComponent<DummyTransport>();

// MLAPI sets this in validate
// Netcode sets this in validate
networkManager.NetworkConfig = new NetworkConfig()
{
// Set the current scene to prevent unexpected log messages which would trigger a failure
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public void MessageHandlerReceivedMessageServerClient()
var networkManager = gameObject.AddComponent<NetworkManager>();
var transport = gameObject.AddComponent<DummyTransport>();

// MLAPI sets this in validate
// Netcode sets this in validate
networkManager.NetworkConfig = new NetworkConfig()
{
// Set the current scene to prevent unexpected log messages which would trigger a failure
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public void SceneManagerAssigned()
var networkManager = gameObject.AddComponent<NetworkManager>();
var transport = gameObject.AddComponent<DummyTransport>();

// MLAPI sets this in validate
// Netcode sets this in validate
networkManager.NetworkConfig = new NetworkConfig()
{
// Set the current scene to prevent unexpected log messages which would trigger a failure
Expand Down
10 changes: 5 additions & 5 deletions com.unity.multiplayer.mlapi/Tests/Editor/NetworkObjectTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ public void GetBehaviourIndexNone()
var networkObject = gameObject.AddComponent<NetworkObject>();

// TODO: Maybe not hardcode message?
LogAssert.Expect(LogType.Error, $"[MLAPI] Behaviour index was out of bounds. Did you mess up the order of your {nameof(NetworkBehaviour)}s?");
LogAssert.Expect(LogType.Error, $"[MLAPI] Behaviour index was out of bounds. Did you mess up the order of your {nameof(NetworkBehaviour)}s?");
LogAssert.Expect(LogType.Error, $"[MLAPI] Behaviour index was out of bounds. Did you mess up the order of your {nameof(NetworkBehaviour)}s?");
LogAssert.Expect(LogType.Error, $"[Netcode] Behaviour index was out of bounds. Did you mess up the order of your {nameof(NetworkBehaviour)}s?");
LogAssert.Expect(LogType.Error, $"[Netcode] Behaviour index was out of bounds. Did you mess up the order of your {nameof(NetworkBehaviour)}s?");
LogAssert.Expect(LogType.Error, $"[Netcode] Behaviour index was out of bounds. Did you mess up the order of your {nameof(NetworkBehaviour)}s?");

Assert.That(networkObject.GetNetworkBehaviourAtOrderIndex(0), Is.Null);
Assert.That(networkObject.GetNetworkBehaviourAtOrderIndex(1), Is.Null);
Expand All @@ -57,8 +57,8 @@ public void GetBehaviourIndexOne()
var networkBehaviour = gameObject.AddComponent<EmptyNetworkBehaviour>();

// TODO: Maybe not hardcode message?
LogAssert.Expect(LogType.Error, $"[MLAPI] Behaviour index was out of bounds. Did you mess up the order of your {nameof(NetworkBehaviour)}s?");
LogAssert.Expect(LogType.Error, $"[MLAPI] Behaviour index was out of bounds. Did you mess up the order of your {nameof(NetworkBehaviour)}s?");
LogAssert.Expect(LogType.Error, $"[Netcode] Behaviour index was out of bounds. Did you mess up the order of your {nameof(NetworkBehaviour)}s?");
LogAssert.Expect(LogType.Error, $"[Netcode] Behaviour index was out of bounds. Did you mess up the order of your {nameof(NetworkBehaviour)}s?");

Assert.That(networkObject.GetNetworkBehaviourAtOrderIndex(0), Is.EqualTo(networkBehaviour));
Assert.That(networkObject.GetNetworkBehaviourAtOrderIndex(1), Is.Null);
Expand Down
Loading