-
Notifications
You must be signed in to change notification settings - Fork 450
chore: merge release into develop #657
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
Conversation
…ires ownership (#627) * add todo comments * fix: implement warning logs on non-owner invoking ServerRpc that requires ownership
* test: NetworkTickSystem test * test: NetworkTickSystem test, removed unneeded code
…#629) * fix: Fix object traversal assigning instanceIds to none scene objects * comment added Co-authored-by: Matt Walsh <matt.walsh@unity3d.com>
If something causes an exception it's possible that the profiler never allocates data. in these cases, there is no point in sending data outside of MLAPI
* Add release notes to changelog * docs: added release notes to changelog * Update com.unity.multiplayer.mlapi/CHANGELOG.md Co-authored-by: Luke Stampfli <43687322+LukeStampfli@users.noreply.github.com> * update per review for bitserializer and networkserializer * revised per feedback - API refactor * update remove bitserializer * renaming * Update com.unity.multiplayer.mlapi/CHANGELOG.md Co-authored-by: M. Fatih MAR <mfatihmar@gmail.com> * Update com.unity.multiplayer.mlapi/CHANGELOG.md * Update com.unity.multiplayer.mlapi/CHANGELOG.md * added known issues and scene mgmt fix * revisions per review * profiler final - no more updates * format Co-authored-by: Luke Stampfli <43687322+LukeStampfli@users.noreply.github.com> Co-authored-by: Matt Walsh <69258106+mattwalsh-unity@users.noreply.github.com> Co-authored-by: M. Fatih MAR <mfatihmar@gmail.com>
- Mirror package readme.md in root readme.md - Add repo directory structure description - Remove contributing and code of conduct from package directory
…icks (#640) PerformanceDataManager reuses PerformanceTickData by resetting per-frame Replaces deferred linq query in PerformanceTickData loop.
… missed in the profiler (#641) Co-authored-by: Matt Walsh <69258106+mattwalsh-unity@users.noreply.github.com>
… clean import (#645) * Add an dummy ILPP to force 2019.4 to proper compilation order * Turning on this test for 2019.4 * Hack -> Workaround rename Co-authored-by: Matt Walsh <matt.walsh@unity3d.com> Co-authored-by: Matt Walsh <69258106+mattwalsh-unity@users.noreply.github.com>
using ILPPInterface = Unity.CompilationPipeline.Common.ILPostProcessing.ILPostProcessor; | ||
|
||
namespace MLAPI.Editor.CodeGen | ||
{ | ||
// There is a behaviour difference between 2019.4 and 2020+ codegen | ||
// that essentially does checking on the existence of ILPP vs if a CodeGen assembly | ||
// is present. So in order to make sure ILPP runs properly in 2019.4 from a clean | ||
// import of the project we add this dummy ILPP which forces the callback to made | ||
// and meets the internal ScriptCompilation pipeline requirements | ||
internal sealed class ILPP2019CodegenWorkaround : ILPPInterface | ||
{ | ||
public override ILPPInterface GetInstance() | ||
{ | ||
return this; | ||
} | ||
|
||
public override ILPostProcessResult Process(ICompiledAssembly compiledAssembly) | ||
{ | ||
return null; | ||
} | ||
|
||
public override bool WillProcess(ICompiledAssembly compiledAssembly) => compiledAssembly.References.Any(filePath => Path.GetFileNameWithoutExtension(filePath) == CodeGenHelpers.RuntimeAssemblyName); | ||
|
||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
coming from: #645 — fix: Resolve an issue where 2019.4 would not properly run ILPP with a clean import
var logNextInstr = processor.Create(OpCodes.Nop); | ||
|
||
// if (LogLevel.Normal > networkManager.LogLevel) | ||
instructions.Add(processor.Create(OpCodes.Ldloc, netManLocIdx)); | ||
instructions.Add(processor.Create(OpCodes.Ldfld, NetworkManager_LogLevel_FieldRef)); | ||
instructions.Add(processor.Create(OpCodes.Ldc_I4, (int)LogLevel.Normal)); | ||
instructions.Add(processor.Create(OpCodes.Cgt)); | ||
instructions.Add(processor.Create(OpCodes.Ldc_I4, 0)); | ||
instructions.Add(processor.Create(OpCodes.Ceq)); | ||
instructions.Add(processor.Create(OpCodes.Brfalse, logNextInstr)); | ||
|
||
// Debug.LogWarning(...); | ||
instructions.Add(processor.Create(OpCodes.Ldstr, "Only the owner can invoke a ServerRpc that requires ownership!")); | ||
instructions.Add(processor.Create(OpCodes.Call, Debug_LogWarning_MethodRef)); | ||
|
||
instructions.Add(logNextInstr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changes in this file are coming from: #627 — fix: implement warning logs on non-owner invoking ServerRpc that requires ownership
var traverseSortedObjects = FindObjectsOfType<NetworkObject>().ToList(); | ||
// find all scene objects that have not been spawned yet | ||
// TODO: long term, replace the means of finding candidate objects to repace FindObjectsOfType | ||
var traverseSortedObjects = FindObjectsOfType<NetworkObject>().Where(x => x.IsSceneObject == null).ToList(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
coming from: #629 — fix: Fix object traversal assigning instanceIds to none scene objects
writer = rpcQueueContainer.BeginAddQueueItemToFrame(RpcQueueContainer.QueueItemType.ClientRpc, Time.realtimeSinceStartup, NetworkChannel.ReliableRpc, NetworkObjectId, | ||
writer = rpcQueueContainer.BeginAddQueueItemToFrame(RpcQueueContainer.QueueItemType.ClientRpc, Time.realtimeSinceStartup, transportChannel, NetworkObjectId, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
coming from: #638 — fix: use specified transport channel instead of hardcoded reliablerpc channel
PerformanceDataManager.Increment(ProfilerConstants.NetworkVarReceived); | ||
PerformanceDataManager.Increment(ProfilerConstants.NetworkVarDeltas); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
coming from: #632 — fix: Correcting the profiler names for network vars to be appropriately named.
@@ -648,6 +648,7 @@ public void NetworkUpdate(NetworkUpdateStage updateStage) | |||
|
|||
private void OnNetworkEarlyUpdate() | |||
{ | |||
NotifyProfilerListeners(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
coming from: #641 — fix: fixed network activity occurring outside the core update getting missed in the profiler
|
||
NotifyProfilerListeners(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
coming from: #641 — fix: fixed network activity occurring outside the core update getting missed in the profiler
if (eventHandler != null && data != null) | ||
if (eventHandler != null) | ||
{ | ||
if (NetworkConfig.NetworkTransport is ITransportProfilerData profileTransport) | ||
if (data != null) | ||
{ | ||
var transportProfilerData = profileTransport.GetTransportProfilerData(); | ||
PerformanceDataManager.AddTransportData(transportProfilerData); | ||
} | ||
if (NetworkConfig.NetworkTransport is ITransportProfilerData profileTransport) | ||
{ | ||
var transportProfilerData = profileTransport.GetTransportProfilerData(); | ||
PerformanceDataManager.AddTransportData(transportProfilerData); | ||
} | ||
|
||
eventHandler.Invoke(data); | ||
} | ||
else if (data == null) | ||
{ | ||
NetworkLog.LogWarning($"No data available. Did you forget to call {nameof(PerformanceDataManager)}.{nameof(PerformanceDataManager.BeginNewTick)}() first?"); | ||
eventHandler.Invoke(data); | ||
} | ||
else | ||
{ | ||
NetworkLog.LogWarning($"No data available. Did you forget to call {nameof(PerformanceDataManager)}.{nameof(PerformanceDataManager.BeginNewTick)}() first?"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
coming from: #614 — fix: prevent OnPerformanceTickData from sending data on null
// Disabling this test on 2019.4 due to ILPP issues on Yamato CI/CD runs (UNITY_2020_2_OR_NEWER) | ||
// Adding the ability to test if we are running in editor local (UNIT_MANUAL_TESTING) | ||
#if UNITY_2020_2_OR_NEWER || UNITY_MANUAL_TESTING |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changes in this file are coming from: #645 — fix: Resolve an issue where 2019.4 would not properly run ILPP with a clean import
using System; | ||
using System.Collections; | ||
using UnityEngine; | ||
using UnityEngine.TestTools; | ||
using NUnit.Framework; | ||
|
||
namespace MLAPI.RuntimeTests | ||
{ | ||
public class TickSystemTests: IDisposable | ||
{ | ||
private NetworkTickSystem m_TickSystem = null; | ||
private float m_TestDuration = 5.0f; | ||
private float m_SleepInterval = 0.001f; | ||
private float m_TickInterval = 0.010f; | ||
|
||
public void Dispose() | ||
{ | ||
m_TickSystem.Dispose(); | ||
m_TickSystem = null; | ||
NetworkUpdateLoop.UnregisterLoopSystems(); | ||
} | ||
|
||
[UnityTest] | ||
public IEnumerator VerifyTickSystem() | ||
{ | ||
m_TickSystem = new NetworkTickSystem(m_TickInterval); | ||
|
||
ushort tick0 = m_TickSystem.GetTick(); | ||
ushort lastTick = tick0; | ||
float t0 = Time.unscaledTime; | ||
float t1; | ||
|
||
do | ||
{ | ||
t1 = Time.unscaledTime; | ||
ushort tick = m_TickSystem.GetTick(); | ||
|
||
Assert.IsTrue(tick >= lastTick); // check monotonicity of ticks | ||
|
||
lastTick = tick; | ||
yield return new WaitForSeconds(m_SleepInterval); | ||
} while (t1 - t0 <= m_TestDuration); | ||
|
||
int ticks = lastTick - tick0; | ||
int expectedTicks = (int)(m_TestDuration / m_TickInterval); | ||
|
||
// check overall number of ticks is within one tick of the expected value | ||
Assert.IsTrue(Math.Abs(expectedTicks - ticks) < 2); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
coming from: #630 — test: NetworkTickSystem test
"name": "com.unity.multiplayer.mlapi", | ||
"displayName": "MLAPI Networking Library", | ||
"version": "0.1.0", | ||
"unity": "2019.4", | ||
"unityRelease": "8f1", | ||
"description": "This the Core Unity Mid-level API that provides core SDK for multiplayer games within unity", | ||
"keywords": [ | ||
"unity" | ||
], | ||
"type": "library", | ||
"hideInEditor": false, | ||
"dependencies": { | ||
"com.unity.nuget.mono-cecil": "1.10.1-preview.1" | ||
} | ||
"name": "com.unity.multiplayer.mlapi", | ||
"displayName": "MLAPI Networking Library", | ||
"version": "0.1.0", | ||
"unity": "2019.4", | ||
"unityRelease": "8f1", | ||
"description": "This the Core Unity Mid-level API that provides core SDK for multiplayer games within unity", | ||
"keywords": [ | ||
"unity" | ||
], | ||
"type": "library", | ||
"hideInEditor": false, | ||
"dependencies": { | ||
"com.unity.modules.ai": "1.0.0", | ||
"com.unity.modules.animation": "1.0.0", | ||
"com.unity.nuget.mono-cecil": "1.10.1-preview.1" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
coming from: #648 — build: add Unity module dependencies explicitly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
No description provided.