From 6afd1b4be796d843f88bbcb34cde7f7b0d338963 Mon Sep 17 00:00:00 2001 From: Matt Coburn Date: Tue, 15 Mar 2022 11:44:36 +1000 Subject: [PATCH 01/12] Version updates --- Packages/manifest.json | 9 ++++----- Packages/packages-lock.json | 24 ++++-------------------- ProjectSettings/ProjectVersion.txt | 4 ++-- 3 files changed, 10 insertions(+), 27 deletions(-) diff --git a/Packages/manifest.json b/Packages/manifest.json index 2a6e32c..0428294 100644 --- a/Packages/manifest.json +++ b/Packages/manifest.json @@ -3,13 +3,12 @@ "com.unity.2d.sprite": "1.0.0", "com.unity.2d.tilemap": "1.0.0", "com.unity.ide.rider": "2.0.7", - "com.unity.ide.visualstudio": "2.0.12", - "com.unity.ide.vscode": "1.2.4", - "com.unity.multiplayer-hlapi": "1.0.6", - "com.unity.test-framework": "1.1.29", + "com.unity.ide.visualstudio": "2.0.14", + "com.unity.ide.vscode": "1.2.5", + "com.unity.test-framework": "1.1.31", "com.unity.timeline": "1.4.8", "com.unity.ugui": "1.0.0", - "com.unity.xr.legacyinputhelpers": "2.1.8", + "com.unity.xr.legacyinputhelpers": "2.1.9", "com.unity.modules.ai": "1.0.0", "com.unity.modules.androidjni": "1.0.0", "com.unity.modules.animation": "1.0.0", diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index 83a03c9..4ba0e39 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -29,7 +29,7 @@ "url": "https://packages.unity.com" }, "com.unity.ide.visualstudio": { - "version": "2.0.12", + "version": "2.0.14", "depth": 0, "source": "registry", "dependencies": { @@ -38,23 +38,14 @@ "url": "https://packages.unity.com" }, "com.unity.ide.vscode": { - "version": "1.2.4", + "version": "1.2.5", "depth": 0, "source": "registry", "dependencies": {}, "url": "https://packages.unity.com" }, - "com.unity.multiplayer-hlapi": { - "version": "1.0.6", - "depth": 0, - "source": "registry", - "dependencies": { - "nuget.mono-cecil": "0.1.6-preview" - }, - "url": "https://packages.unity.com" - }, "com.unity.test-framework": { - "version": "1.1.29", + "version": "1.1.31", "depth": 0, "source": "registry", "dependencies": { @@ -86,7 +77,7 @@ } }, "com.unity.xr.legacyinputhelpers": { - "version": "2.1.8", + "version": "2.1.9", "depth": 0, "source": "registry", "dependencies": { @@ -95,13 +86,6 @@ }, "url": "https://packages.unity.com" }, - "nuget.mono-cecil": { - "version": "0.1.6-preview", - "depth": 1, - "source": "registry", - "dependencies": {}, - "url": "https://packages.unity.com" - }, "com.unity.modules.ai": { "version": "1.0.0", "depth": 0, diff --git a/ProjectSettings/ProjectVersion.txt b/ProjectSettings/ProjectVersion.txt index 4c9401b..14a36b8 100644 --- a/ProjectSettings/ProjectVersion.txt +++ b/ProjectSettings/ProjectVersion.txt @@ -1,2 +1,2 @@ -m_EditorVersion: 2020.3.25f1 -m_EditorVersionWithRevision: 2020.3.25f1 (9b9180224418) +m_EditorVersion: 2020.3.30f1 +m_EditorVersionWithRevision: 2020.3.30f1 (1fb1bf06830e) From c62aff797305cf2615af00ddba385859a0587322 Mon Sep 17 00:00:00 2001 From: Matt Coburn Date: Tue, 15 Mar 2022 12:37:22 +1000 Subject: [PATCH 02/12] Rename NodeListServer to 'NodeLS Client' --- ...NodeListServer.meta => NodeLS Client.meta} | 0 .../Communicator.cs | 46 +++++++++++++- .../Communicator.cs.meta | 0 Assets/NodeLS Client/DebugCommunicator.cs | 61 +++++++++++++++++++ .../NodeLS Client/DebugCommunicator.cs.meta | 11 ++++ .../Definitions.meta | 0 .../Definitions/Serializables.cs | 0 .../Definitions/Serializables.cs.meta | 0 .../Example.meta | 0 .../Example/List Example.unity | 0 .../Example/List Example.unity.meta | 0 .../Example/Scripts.meta | 0 .../Example/Scripts/ServerListBrowser.cs | 6 +- .../Example/Scripts/ServerListBrowser.cs.meta | 0 .../Example/UI.meta | 0 .../Example/UI/ListEntry.prefab | 0 .../Example/UI/ListEntry.prefab.meta | 0 .../Example/UI/ListEntryController.cs | 0 .../Example/UI/ListEntryController.cs.meta | 0 .../NodeListServer.UnityIntegration.asmdef | 8 ++- ...odeListServer.UnityIntegration.asmdef.meta | 0 21 files changed, 126 insertions(+), 6 deletions(-) rename Assets/{NodeListServer.meta => NodeLS Client.meta} (100%) rename Assets/{NodeListServer => NodeLS Client}/Communicator.cs (82%) rename Assets/{NodeListServer => NodeLS Client}/Communicator.cs.meta (100%) create mode 100644 Assets/NodeLS Client/DebugCommunicator.cs create mode 100644 Assets/NodeLS Client/DebugCommunicator.cs.meta rename Assets/{NodeListServer => NodeLS Client}/Definitions.meta (100%) rename Assets/{NodeListServer => NodeLS Client}/Definitions/Serializables.cs (100%) rename Assets/{NodeListServer => NodeLS Client}/Definitions/Serializables.cs.meta (100%) rename Assets/{NodeListServer => NodeLS Client}/Example.meta (100%) rename Assets/{NodeListServer => NodeLS Client}/Example/List Example.unity (100%) rename Assets/{NodeListServer => NodeLS Client}/Example/List Example.unity.meta (100%) rename Assets/{NodeListServer => NodeLS Client}/Example/Scripts.meta (100%) rename Assets/{NodeListServer => NodeLS Client}/Example/Scripts/ServerListBrowser.cs (96%) rename Assets/{NodeListServer => NodeLS Client}/Example/Scripts/ServerListBrowser.cs.meta (100%) rename Assets/{NodeListServer => NodeLS Client}/Example/UI.meta (100%) rename Assets/{NodeListServer => NodeLS Client}/Example/UI/ListEntry.prefab (100%) rename Assets/{NodeListServer => NodeLS Client}/Example/UI/ListEntry.prefab.meta (100%) rename Assets/{NodeListServer => NodeLS Client}/Example/UI/ListEntryController.cs (100%) rename Assets/{NodeListServer => NodeLS Client}/Example/UI/ListEntryController.cs.meta (100%) rename Assets/{NodeListServer => NodeLS Client}/NodeListServer.UnityIntegration.asmdef (61%) rename Assets/{NodeListServer => NodeLS Client}/NodeListServer.UnityIntegration.asmdef.meta (100%) diff --git a/Assets/NodeListServer.meta b/Assets/NodeLS Client.meta similarity index 100% rename from Assets/NodeListServer.meta rename to Assets/NodeLS Client.meta diff --git a/Assets/NodeListServer/Communicator.cs b/Assets/NodeLS Client/Communicator.cs similarity index 82% rename from Assets/NodeListServer/Communicator.cs rename to Assets/NodeLS Client/Communicator.cs index bbe94a3..058a5fe 100644 --- a/Assets/NodeListServer/Communicator.cs +++ b/Assets/NodeLS Client/Communicator.cs @@ -1,4 +1,5 @@ using System; +using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Http; @@ -27,6 +28,7 @@ public class NLSCommunicator #endregion public bool Busy { get; private set; } + #region Private properties /// /// Convience property. No need to worry about this. @@ -44,6 +46,48 @@ public class NLSCommunicator #region Communication Routines /// + /// Retrieves the list of servers currently registered with the NodeLS Endpoint. + /// If something goes wrong, a Debug.LogError call is made. + /// + /// The communication key used to authenicate. + public IEnumerator RetrieveList(string commKey) + { + // Sanity checks: Did the user forget to set the endpoint? Did the user forget to + // specify the communication key? + + if (string.IsNullOrWhiteSpace(EndPoint) || string.IsNullOrWhiteSpace(commKey)) + { + Debug.LogError("NodeLS Client: Endpoint or Communicaton key is invalid."); + yield break; + } + + WWWForm postRequest = new WWWForm(); + postRequest.AddField("serverKey", commKey.Trim()); + + using (UnityWebRequest requestRunner = UnityWebRequest.Post($"{EndPoint}{QueryEndpoint}", postRequest)) + { + Busy = true; + + yield return requestRunner.SendWebRequest(); + + Busy = false; + if (requestRunner.result == UnityWebRequest.Result.Success) + { + // Invoke the data received event. + OnServerListRetrieved?.Invoke(JsonUtility.FromJson(requestRunner.downloadHandler.text.Trim())); + } + else + { + Debug.LogError($"NodeLS Client: Error processing request. Status returned was {requestRunner.result}."); + yield break; + } + } + + yield break; + } + + [Obsolete("Use RetrieveList instead, this was made on a whim.")] + /// /// Retrieves the list of servers currently registered with the NodeLS Endpoint. /// /// The communication key used to authenicate. @@ -185,7 +229,7 @@ public void DeregisterServer(string CommunicationKey, string ServerUuid) { // Swallow it } - + // Was this successful? if (theResult != null && theResult.IsSuccessStatusCode) { diff --git a/Assets/NodeListServer/Communicator.cs.meta b/Assets/NodeLS Client/Communicator.cs.meta similarity index 100% rename from Assets/NodeListServer/Communicator.cs.meta rename to Assets/NodeLS Client/Communicator.cs.meta diff --git a/Assets/NodeLS Client/DebugCommunicator.cs b/Assets/NodeLS Client/DebugCommunicator.cs new file mode 100644 index 0000000..5b2e684 --- /dev/null +++ b/Assets/NodeLS Client/DebugCommunicator.cs @@ -0,0 +1,61 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace NodeListServer +{ + public class DebugCommunicator : MonoBehaviour + { + private NLSCommunicator communicator = new NLSCommunicator(); + + private string ourServerIdentifier = string.Empty; + + private void Start() + { + communicator.EndPoint = "http://192.168.88.250:8889"; + communicator.OnServerRemoved += OnServerRemoved; + } + + // Update is called once per frame + private void Update() + { + // Query. + if (Input.GetKeyDown(KeyCode.Q)) + { + StartCoroutine(communicator.RetrieveList("NodeListServerDefaultKey")); + } + else if (Input.GetKeyUp(KeyCode.W)) + { + // Register a server. + if (!string.IsNullOrEmpty(ourServerIdentifier)) + return; + + ServerInfo serverInfo = new ServerInfo() + { + Name = "NodeLS Communicator Test Server", + Count = 69, + Capacity = 420, + Port = 31337, + ExtraInformation = string.Empty, + }; + + ourServerIdentifier = communicator.RegisterServer("NodeListServerDefaultKey", serverInfo); + + } + else if (Input.GetKeyDown(KeyCode.E)) + { + // Deregister a server. + if (string.IsNullOrEmpty(ourServerIdentifier)) + return; + + communicator.DeregisterServer("NodeListServerDefaultKey", ourServerIdentifier); + } + } + + private void OnServerRemoved() + { + ourServerIdentifier = string.Empty; + } + } + +} diff --git a/Assets/NodeLS Client/DebugCommunicator.cs.meta b/Assets/NodeLS Client/DebugCommunicator.cs.meta new file mode 100644 index 0000000..6bc552e --- /dev/null +++ b/Assets/NodeLS Client/DebugCommunicator.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9a9401aa9bab5b24d99e6a058d85c894 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NodeListServer/Definitions.meta b/Assets/NodeLS Client/Definitions.meta similarity index 100% rename from Assets/NodeListServer/Definitions.meta rename to Assets/NodeLS Client/Definitions.meta diff --git a/Assets/NodeListServer/Definitions/Serializables.cs b/Assets/NodeLS Client/Definitions/Serializables.cs similarity index 100% rename from Assets/NodeListServer/Definitions/Serializables.cs rename to Assets/NodeLS Client/Definitions/Serializables.cs diff --git a/Assets/NodeListServer/Definitions/Serializables.cs.meta b/Assets/NodeLS Client/Definitions/Serializables.cs.meta similarity index 100% rename from Assets/NodeListServer/Definitions/Serializables.cs.meta rename to Assets/NodeLS Client/Definitions/Serializables.cs.meta diff --git a/Assets/NodeListServer/Example.meta b/Assets/NodeLS Client/Example.meta similarity index 100% rename from Assets/NodeListServer/Example.meta rename to Assets/NodeLS Client/Example.meta diff --git a/Assets/NodeListServer/Example/List Example.unity b/Assets/NodeLS Client/Example/List Example.unity similarity index 100% rename from Assets/NodeListServer/Example/List Example.unity rename to Assets/NodeLS Client/Example/List Example.unity diff --git a/Assets/NodeListServer/Example/List Example.unity.meta b/Assets/NodeLS Client/Example/List Example.unity.meta similarity index 100% rename from Assets/NodeListServer/Example/List Example.unity.meta rename to Assets/NodeLS Client/Example/List Example.unity.meta diff --git a/Assets/NodeListServer/Example/Scripts.meta b/Assets/NodeLS Client/Example/Scripts.meta similarity index 100% rename from Assets/NodeListServer/Example/Scripts.meta rename to Assets/NodeLS Client/Example/Scripts.meta diff --git a/Assets/NodeListServer/Example/Scripts/ServerListBrowser.cs b/Assets/NodeLS Client/Example/Scripts/ServerListBrowser.cs similarity index 96% rename from Assets/NodeListServer/Example/Scripts/ServerListBrowser.cs rename to Assets/NodeLS Client/Example/Scripts/ServerListBrowser.cs index ca3eabd..c57f7cf 100644 --- a/Assets/NodeListServer/Example/Scripts/ServerListBrowser.cs +++ b/Assets/NodeLS Client/Example/Scripts/ServerListBrowser.cs @@ -91,7 +91,7 @@ private void RefreshList() // Don't refresh again if we're busy if (isBusy) return; - nlsCommunicator.RetrieveServerList(communicationKey); + StartCoroutine(nlsCommunicator.RetrieveList(communicationKey)); } // -- UI Elements -- // @@ -153,7 +153,9 @@ private void SupportButton() private void OnServerListRetrieved(ServerListResponse response) { listServerListEntries = response.servers; - print(listServerListEntries.Count); + + // For debug purposes only. + // print(listServerListEntries.Count); if (ListElementContainer != null) { diff --git a/Assets/NodeListServer/Example/Scripts/ServerListBrowser.cs.meta b/Assets/NodeLS Client/Example/Scripts/ServerListBrowser.cs.meta similarity index 100% rename from Assets/NodeListServer/Example/Scripts/ServerListBrowser.cs.meta rename to Assets/NodeLS Client/Example/Scripts/ServerListBrowser.cs.meta diff --git a/Assets/NodeListServer/Example/UI.meta b/Assets/NodeLS Client/Example/UI.meta similarity index 100% rename from Assets/NodeListServer/Example/UI.meta rename to Assets/NodeLS Client/Example/UI.meta diff --git a/Assets/NodeListServer/Example/UI/ListEntry.prefab b/Assets/NodeLS Client/Example/UI/ListEntry.prefab similarity index 100% rename from Assets/NodeListServer/Example/UI/ListEntry.prefab rename to Assets/NodeLS Client/Example/UI/ListEntry.prefab diff --git a/Assets/NodeListServer/Example/UI/ListEntry.prefab.meta b/Assets/NodeLS Client/Example/UI/ListEntry.prefab.meta similarity index 100% rename from Assets/NodeListServer/Example/UI/ListEntry.prefab.meta rename to Assets/NodeLS Client/Example/UI/ListEntry.prefab.meta diff --git a/Assets/NodeListServer/Example/UI/ListEntryController.cs b/Assets/NodeLS Client/Example/UI/ListEntryController.cs similarity index 100% rename from Assets/NodeListServer/Example/UI/ListEntryController.cs rename to Assets/NodeLS Client/Example/UI/ListEntryController.cs diff --git a/Assets/NodeListServer/Example/UI/ListEntryController.cs.meta b/Assets/NodeLS Client/Example/UI/ListEntryController.cs.meta similarity index 100% rename from Assets/NodeListServer/Example/UI/ListEntryController.cs.meta rename to Assets/NodeLS Client/Example/UI/ListEntryController.cs.meta diff --git a/Assets/NodeListServer/NodeListServer.UnityIntegration.asmdef b/Assets/NodeLS Client/NodeListServer.UnityIntegration.asmdef similarity index 61% rename from Assets/NodeListServer/NodeListServer.UnityIntegration.asmdef rename to Assets/NodeLS Client/NodeListServer.UnityIntegration.asmdef index 47d9b09..2ea1728 100644 --- a/Assets/NodeListServer/NodeListServer.UnityIntegration.asmdef +++ b/Assets/NodeLS Client/NodeListServer.UnityIntegration.asmdef @@ -1,14 +1,16 @@ { - "name": "NodeListServer.UnityIntegration", + "name": "NodeLS.Client", + "rootNamespace": "", "references": [ "Mirror" ], - "optionalUnityReferences": [], "includePlatforms": [], "excludePlatforms": [], "allowUnsafeCode": false, "overrideReferences": false, "precompiledReferences": [], "autoReferenced": true, - "defineConstraints": [] + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false } \ No newline at end of file diff --git a/Assets/NodeListServer/NodeListServer.UnityIntegration.asmdef.meta b/Assets/NodeLS Client/NodeListServer.UnityIntegration.asmdef.meta similarity index 100% rename from Assets/NodeListServer/NodeListServer.UnityIntegration.asmdef.meta rename to Assets/NodeLS Client/NodeListServer.UnityIntegration.asmdef.meta From 9ed2bc175990be07bd4e71c709776b5b8eb2cd12 Mon Sep 17 00:00:00 2001 From: Matt Coburn Date: Tue, 15 Mar 2022 12:37:46 +1000 Subject: [PATCH 03/12] Update project settings --- ProjectSettings/ProjectSettings.asset | 100 ++++++++++++++++---------- 1 file changed, 61 insertions(+), 39 deletions(-) diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index 811e85e..60d3e84 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -3,7 +3,7 @@ --- !u!129 &1 PlayerSettings: m_ObjectHideFlags: 0 - serializedVersion: 20 + serializedVersion: 22 productGUID: 3cc85800ab570d04789e8c579c748c13 AndroidProfiler: 0 AndroidFilterTouchesWhenObscured: 0 @@ -49,6 +49,8 @@ PlayerSettings: m_StereoRenderingPath: 0 m_ActiveColorSpace: 0 m_MTRendering: 1 + mipStripping: 0 + numberOfMipsStripped: 0 m_StackTraceTypes: 010000000100000001000000010000000100000001000000 iosShowActivityIndicatorOnLoading: -1 androidShowActivityIndicatorOnLoading: -1 @@ -66,6 +68,12 @@ PlayerSettings: androidRenderOutsideSafeArea: 0 androidUseSwappy: 0 androidBlitType: 0 + androidResizableWindow: 0 + androidDefaultWindowWidth: 1920 + androidDefaultWindowHeight: 1080 + androidMinimumWindowWidth: 400 + androidMinimumWindowHeight: 300 + androidFullscreenMode: 1 defaultIsNativeResolution: 1 macRetinaSupport: 1 runInBackground: 1 @@ -117,7 +125,9 @@ PlayerSettings: stadiaTargetFramerate: 0 vulkanNumSwapchainBuffers: 3 vulkanEnableSetSRGBWrite: 0 + vulkanEnablePreTransform: 0 vulkanEnableLateAcquireNextImage: 0 + vulkanEnableCommandBufferRecycling: 1 m_SupportedAspectRatios: 4:3: 1 5:4: 1 @@ -132,31 +142,6 @@ PlayerSettings: xboxOneDisableKinectGpuReservation: 1 xboxOneEnable7thCore: 1 vrSettings: - cardboard: - depthFormat: 0 - enableTransitionView: 0 - daydream: - depthFormat: 0 - useSustainedPerformanceMode: 0 - enableVideoLayer: 0 - useProtectedVideoMemory: 0 - minimumSupportedHeadTracking: 0 - maximumSupportedHeadTracking: 1 - hololens: - depthFormat: 1 - depthBufferSharingEnabled: 1 - lumin: - depthFormat: 0 - frameTiming: 2 - enableGLCache: 0 - glCacheMaxBlobSize: 524288 - glCacheMaxFileSize: 8388608 - oculus: - sharedDepthBuffer: 1 - dashSupport: 1 - lowOverheadMode: 0 - protectedContext: 0 - v2Signing: 0 enable360StereoCapture: 0 isWsaHolographicRemotingEnabled: 0 enableFrameTimingStats: 0 @@ -168,7 +153,11 @@ PlayerSettings: androidSupportedAspectRatio: 1 androidMaxAspectRatio: 2.1 applicationIdentifier: {} - buildNumber: {} + buildNumber: + Standalone: 0 + iPhone: 0 + tvOS: 0 + overrideDefaultApplicationIdentifier: 0 AndroidBundleVersionCode: 1 AndroidMinSdkVersion: 19 AndroidTargetSdkVersion: 0 @@ -185,10 +174,10 @@ PlayerSettings: StripUnusedMeshComponents: 1 VertexChannelCompressionMask: 4054 iPhoneSdkVersion: 988 - iOSTargetOSVersionString: 10.0 + iOSTargetOSVersionString: 11.0 tvOSSdkVersion: 0 tvOSRequireExtendedGameController: 0 - tvOSTargetOSVersionString: 10.0 + tvOSTargetOSVersionString: 11.0 uIPrerenderedIcon: 0 uIRequiresPersistentWiFi: 0 uIRequiresFullScreen: 1 @@ -222,8 +211,8 @@ PlayerSettings: iOSLaunchScreeniPadFillPct: 100 iOSLaunchScreeniPadSize: 100 iOSLaunchScreeniPadCustomXibPath: - iOSUseLaunchScreenStoryboard: 0 iOSLaunchScreenCustomStoryboardPath: + iOSLaunchScreeniPadCustomStoryboardPath: iOSDeviceRequirements: [] iOSURLSchemes: [] iOSBackgroundModes: 0 @@ -241,10 +230,19 @@ PlayerSettings: iOSRequireARKit: 0 iOSAutomaticallyDetectAndAddCapabilities: 1 appleEnableProMotion: 0 + shaderPrecisionModel: 0 clonedFromGUID: c0afd0d1d80e3634a9dac47e8a0426ea templatePackageId: com.unity.template.3d@1.3.0 templateDefaultScene: Assets/Scenes/SampleScene.unity + useCustomMainManifest: 0 + useCustomLauncherManifest: 0 + useCustomMainGradleTemplate: 0 + useCustomLauncherGradleManifest: 0 + useCustomBaseGradleTemplate: 0 + useCustomGradlePropertiesTemplate: 0 + useCustomProguardFile: 0 AndroidTargetArchitectures: 5 + AndroidTargetDevices: 0 AndroidSplashScreenScale: 0 androidSplashScreen: {fileID: 0} AndroidKeystoreName: @@ -261,6 +259,10 @@ PlayerSettings: height: 180 banner: {fileID: 0} androidGamepadSupportLevel: 0 + chromeosInputEmulation: 1 + AndroidMinifyWithR8: 0 + AndroidMinifyRelease: 0 + AndroidMinifyDebug: 0 AndroidValidateAppBundleSize: 1 AndroidAppBundleSizeToValidate: 150 m_BuildTargetIcons: [] @@ -324,7 +326,7 @@ PlayerSettings: m_Automatic: 1 - m_BuildTarget: AppleTVSupport m_APIs: 10000000 - m_Automatic: 0 + m_Automatic: 1 - m_BuildTarget: WebGLSupport m_APIs: 0b000000 m_Automatic: 1 @@ -344,6 +346,7 @@ PlayerSettings: tvOS: 1 m_BuildTargetGroupLightmapEncodingQuality: [] m_BuildTargetGroupLightmapSettings: [] + m_BuildTargetNormalMapEncoding: [] playModeTestRunnerEnabled: 0 runPlayModeTestAsEditModeTest: 0 actionOnDotNetUnhandledException: 1 @@ -353,12 +356,15 @@ PlayerSettings: cameraUsageDescription: locationUsageDescription: microphoneUsageDescription: + bluetoothUsageDescription: + switchNMETAOverride: switchNetLibKey: switchSocketMemoryPoolSize: 6144 switchSocketAllocatorPoolSize: 128 switchSocketConcurrencyLimit: 14 switchScreenResolutionBehavior: 2 switchUseCPUProfiler: 0 + switchUseGOLDLinker: 0 switchApplicationID: 0x01004b9000490000 switchNSODependencies: switchTitleNames_0: @@ -376,6 +382,7 @@ PlayerSettings: switchTitleNames_12: switchTitleNames_13: switchTitleNames_14: + switchTitleNames_15: switchPublisherNames_0: switchPublisherNames_1: switchPublisherNames_2: @@ -391,6 +398,7 @@ PlayerSettings: switchPublisherNames_12: switchPublisherNames_13: switchPublisherNames_14: + switchPublisherNames_15: switchIcons_0: {fileID: 0} switchIcons_1: {fileID: 0} switchIcons_2: {fileID: 0} @@ -406,6 +414,7 @@ PlayerSettings: switchIcons_12: {fileID: 0} switchIcons_13: {fileID: 0} switchIcons_14: {fileID: 0} + switchIcons_15: {fileID: 0} switchSmallIcons_0: {fileID: 0} switchSmallIcons_1: {fileID: 0} switchSmallIcons_2: {fileID: 0} @@ -421,6 +430,7 @@ PlayerSettings: switchSmallIcons_12: {fileID: 0} switchSmallIcons_13: {fileID: 0} switchSmallIcons_14: {fileID: 0} + switchSmallIcons_15: {fileID: 0} switchManualHTML: switchAccessibleURLs: switchLegalInformation: @@ -483,6 +493,11 @@ PlayerSettings: switchSocketInitializeEnabled: 1 switchNetworkInterfaceManagerInitializeEnabled: 1 switchPlayerConnectionEnabled: 1 + switchUseNewStyleFilepaths: 0 + switchUseMicroSleepForYield: 1 + switchEnableRamDiskSupport: 0 + switchMicroSleepForYieldTime: 25 + switchRamDiskSpaceSize: 12 ps4NPAgeRating: 12 ps4NPTitleSecret: ps4NPTrophyPackPath: @@ -553,6 +568,7 @@ PlayerSettings: ps4videoRecordingFeaturesUsed: 0 ps4contentSearchFeaturesUsed: 0 ps4CompatibilityPS5: 0 + ps4AllowPS5Detection: 0 ps4GPU800MHz: 1 ps4attribEyeToEyeDistanceSettingVR: 0 ps4IncludedModules: [] @@ -573,20 +589,27 @@ PlayerSettings: webGLAnalyzeBuildSize: 0 webGLUseEmbeddedResources: 0 webGLCompressionFormat: 1 + webGLWasmArithmeticExceptions: 0 webGLLinkerTarget: 1 webGLThreadsSupport: 0 - webGLWasmStreaming: 0 + webGLDecompressionFallback: 0 scriptingDefineSymbols: - 1: MIRROR;MIRROR_1726_OR_NEWER;MIRROR_3_0_OR_NEWER;MIRROR_3_12_OR_NEWER;MIRROR_4_0_OR_NEWER;MIRROR_5_0_OR_NEWER;MIRROR_6_0_OR_NEWER;MIRROR_7_0_OR_NEWER;MIRROR_8_0_OR_NEWER;MIRROR_9_0_OR_NEWER;MIRROR_10_0_OR_NEWER;MIRROR_11_0_OR_NEWER;MIRROR_12_0_OR_NEWER;MIRROR_13_0_OR_NEWER;MIRROR_14_0_OR_NEWER;MIRROR_15_0_OR_NEWER;MIRROR_16_0_OR_NEWER;MIRROR_17_0_OR_NEWER;MIRROR_18_0_OR_NEWER;MIRROR_24_0_OR_NEWER;MIRROR_26_0_OR_NEWER + 1: MIRROR;MIRROR_1726_OR_NEWER;MIRROR_3_0_OR_NEWER;MIRROR_3_12_OR_NEWER;MIRROR_4_0_OR_NEWER;MIRROR_5_0_OR_NEWER;MIRROR_6_0_OR_NEWER;MIRROR_7_0_OR_NEWER;MIRROR_8_0_OR_NEWER;MIRROR_9_0_OR_NEWER;MIRROR_10_0_OR_NEWER;MIRROR_11_0_OR_NEWER;MIRROR_12_0_OR_NEWER;MIRROR_13_0_OR_NEWER;MIRROR_14_0_OR_NEWER;MIRROR_15_0_OR_NEWER;MIRROR_16_0_OR_NEWER;MIRROR_17_0_OR_NEWER;MIRROR_18_0_OR_NEWER;MIRROR_24_0_OR_NEWER;MIRROR_26_0_OR_NEWER;MIRROR_27_0_OR_NEWER;MIRROR_28_0_OR_NEWER;MIRROR_29_0_OR_NEWER;MIRROR_30_0_OR_NEWER;MIRROR_30_5_2_OR_NEWER;MIRROR_32_1_2_OR_NEWER;MIRROR_32_1_4_OR_NEWER;MIRROR_35_0_OR_NEWER;MIRROR_35_1_OR_NEWER;MIRROR_37_0_OR_NEWER;MIRROR_38_0_OR_NEWER;MIRROR_39_0_OR_NEWER;MIRROR_40_0_OR_NEWER;MIRROR_41_0_OR_NEWER;MIRROR_42_0_OR_NEWER;MIRROR_43_0_OR_NEWER;MIRROR_44_0_OR_NEWER;MIRROR_46_0_OR_NEWER;MIRROR_47_0_OR_NEWER;MIRROR_53_0_OR_NEWER;MIRROR_55_0_OR_NEWER;MIRROR_57_0_OR_NEWER;MIRROR_58_0_OR_NEWER;MIRROR_65_0_OR_NEWER + additionalCompilerArguments: {} platformArchitecture: {} scriptingBackend: {} il2cppCompilerConfiguration: {} managedStrippingLevel: {} incrementalIl2cppBuild: {} + suppressCommonWarnings: 1 allowUnsafeCode: 0 + useDeterministicCompilation: 1 + useReferenceAssemblies: 1 + enableRoslynAnalyzers: 1 additionalIl2CppArgs: scriptingRuntimeVersion: 1 gcIncremental: 0 + assemblyVersionValidation: 1 gcWBarrierValidation: 0 apiCompatibilityLevelPerPlatform: {} m_RenderingPath: 1 @@ -636,6 +659,7 @@ PlayerSettings: XboxOneCapability: [] XboxOneGameRating: {} XboxOneIsContentPackage: 0 + XboxOneEnhancedXboxCompatibilityMode: 0 XboxOneEnableGPUVariability: 1 XboxOneSockets: {} XboxOneSplashScreen: {fileID: 0} @@ -644,10 +668,7 @@ PlayerSettings: XboxOneXTitleMemory: 8 XboxOneOverrideIdentityName: XboxOneOverrideIdentityPublisher: - vrEditorSettings: - daydream: - daydreamIconForeground: {fileID: 0} - daydreamIconBackground: {fileID: 0} + vrEditorSettings: {} cloudServicesEnabled: UNet: 1 luminIcon: @@ -662,11 +683,12 @@ PlayerSettings: m_VersionCode: 1 m_VersionName: apiCompatibilityLevel: 6 + activeInputHandler: 0 cloudProjectId: framebufferDepthMemorylessMode: 0 + qualitySettingsNames: [] projectName: organizationId: cloudEnabled: 0 - enableNativePlatformBackendsForNewInputSystem: 0 - disableOldInputManagerSupport: 0 legacyClampBlendShapeWeights: 0 + virtualTexturingSupportEnabled: 0 From 7d3ac1db2ff7264c2487b25fbcb283a5673f9360 Mon Sep 17 00:00:00 2001 From: Matt Coburn Date: Tue, 15 Mar 2022 12:38:16 +1000 Subject: [PATCH 04/12] Blacklist Mirror (add to gitignore) --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index c2ab95a..59803a7 100644 --- a/.gitignore +++ b/.gitignore @@ -46,3 +46,7 @@ sysinfo.txt Assets/Mirror/Tests/ Assets/NodeListServer/DebugCommunicator.cs Assets/NodeListServer/DebugCommunicator.cs.meta +Assets/Mirror +Assets/Mirror.meta +Assets/ScriptTemplates +Assets/ScriptTemplates.meta From 751f14212cbbf95f9436065f35f3be8f360f99cc Mon Sep 17 00:00:00 2001 From: Matt Coburn Date: Tue, 15 Mar 2022 12:42:07 +1000 Subject: [PATCH 05/12] Add period --- Assets/NodeLS Client/Example/Scripts/ServerListBrowser.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Assets/NodeLS Client/Example/Scripts/ServerListBrowser.cs b/Assets/NodeLS Client/Example/Scripts/ServerListBrowser.cs index c57f7cf..55e333c 100644 --- a/Assets/NodeLS Client/Example/Scripts/ServerListBrowser.cs +++ b/Assets/NodeLS Client/Example/Scripts/ServerListBrowser.cs @@ -88,7 +88,7 @@ private void LateUpdate() // So I guess the workaround is to make a bootstrapper. private void RefreshList() { - // Don't refresh again if we're busy + // Don't refresh again if we're busy. if (isBusy) return; StartCoroutine(nlsCommunicator.RetrieveList(communicationKey)); From 57abd94f8c3c48c00228e9de5bc959f1a4a41e99 Mon Sep 17 00:00:00 2001 From: Matt Coburn Date: Tue, 15 Mar 2022 13:08:02 +1000 Subject: [PATCH 06/12] Modify the debug communicator to use coroutine --- Assets/NodeLS Client/DebugCommunicator.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Assets/NodeLS Client/DebugCommunicator.cs b/Assets/NodeLS Client/DebugCommunicator.cs index 5b2e684..40e70c2 100644 --- a/Assets/NodeLS Client/DebugCommunicator.cs +++ b/Assets/NodeLS Client/DebugCommunicator.cs @@ -39,7 +39,9 @@ private void Update() ExtraInformation = string.Empty, }; - ourServerIdentifier = communicator.RegisterServer("NodeListServerDefaultKey", serverInfo); + StartCoroutine(communicator.RegisterServer("NodeListServerDefaultKey", serverInfo)); + + // ourServerIdentifier = } else if (Input.GetKeyDown(KeyCode.E)) From 4d625663b2f961ec4743a7a3551b7c1131de2458 Mon Sep 17 00:00:00 2001 From: Matt Coburn Date: Tue, 15 Mar 2022 13:08:30 +1000 Subject: [PATCH 07/12] Now that's chunky. A big cleanup. --- Assets/Mirror Integration.meta | 8 + Assets/NodeLS Client/Communicator.cs | 196 +++++------------- .../Example/Scripts/ServerListBrowser.cs | 2 +- 3 files changed, 63 insertions(+), 143 deletions(-) create mode 100644 Assets/Mirror Integration.meta diff --git a/Assets/Mirror Integration.meta b/Assets/Mirror Integration.meta new file mode 100644 index 0000000..f7c638d --- /dev/null +++ b/Assets/Mirror Integration.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f7da57e1593a69947a11bd419c869ebe +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/NodeLS Client/Communicator.cs b/Assets/NodeLS Client/Communicator.cs index 058a5fe..bb72f1d 100644 --- a/Assets/NodeLS Client/Communicator.cs +++ b/Assets/NodeLS Client/Communicator.cs @@ -35,9 +35,6 @@ public class NLSCommunicator /// private Uri EndPointAsUri { get { return new Uri(EndPoint); } } - private HttpClient httpClient = new HttpClient(); - private List> postDataPairs = new List>(); - public Action OnServerListRetrieved; public Action OnServerRegistered; public Action OnServerRemoved; @@ -70,7 +67,6 @@ public IEnumerator RetrieveList(string commKey) yield return requestRunner.SendWebRequest(); - Busy = false; if (requestRunner.result == UnityWebRequest.Result.Success) { // Invoke the data received event. @@ -79,62 +75,11 @@ public IEnumerator RetrieveList(string commKey) else { Debug.LogError($"NodeLS Client: Error processing request. Status returned was {requestRunner.result}."); - yield break; } } - yield break; - } - - [Obsolete("Use RetrieveList instead, this was made on a whim.")] - /// - /// Retrieves the list of servers currently registered with the NodeLS Endpoint. - /// - /// The communication key used to authenicate. - /// - public void RetrieveServerList(string CommunicationKey) - { - // Did the user forget to set the endpoint? - if (string.IsNullOrWhiteSpace(EndPoint)) - throw new ArgumentNullException(EndPoint); - - // Did the user forget to specify the communication key? - if (string.IsNullOrWhiteSpace(CommunicationKey)) - throw new ArgumentNullException(CommunicationKey); - - // Sanity checks passed, let's attempt communication. - httpClient.BaseAddress = EndPointAsUri; - - // Create - postDataPairs.Clear(); - postDataPairs.Add(new KeyValuePair("serverKey", CommunicationKey.Trim())); - - var postContent = new FormUrlEncodedContent(postDataPairs); - HttpResponseMessage theResult = null; - - try - { - theResult = httpClient.PostAsync(QueryEndpoint, postContent).Result; - } - catch - { - // Swallow it - } - - // Was this successful? - if (theResult != null && theResult.IsSuccessStatusCode) - { - var contentAsString = theResult.Content.ReadAsStringAsync().Result.Trim(); - UnityEngine.Debug.Log(contentAsString); - OnServerListRetrieved?.Invoke(JsonUtility.FromJson(contentAsString)); - Busy = false; - } - else - { - // Throw an exception. - Busy = false; - throw new Exception($"Failed retrieving Server List."); - } + Busy = false; + yield return null; } /// @@ -143,107 +88,74 @@ public void RetrieveServerList(string CommunicationKey) /// The communication key used to authenicate. /// A string containing a GUID (UUID) identifying the server on the NodeLS instance. /// - public string RegisterServer(string CommunicationKey, ServerInfo newServerInfo) + public IEnumerator RegisterServer(string commKey, ServerInfo newServerInfo) { - // Did the user forget to set the endpoint? - if (string.IsNullOrWhiteSpace(EndPoint)) - throw new ArgumentNullException(EndPoint); - - // Did the user forget to specify the communication key? - if (string.IsNullOrWhiteSpace(CommunicationKey)) - throw new ArgumentNullException(CommunicationKey); - - // TODO: Server information checks - - // Sanity checks passed, let's attempt communication. - httpClient.BaseAddress = EndPointAsUri; - - postDataPairs.Clear(); - postDataPairs.Add(new KeyValuePair("serverKey", CommunicationKey.Trim())); - postDataPairs.Add(new KeyValuePair("serverName", newServerInfo.Name)); - // Possibly in the future. Does nothing atm. - // postDataPairs.Add("serverIp", newServerInfo.Ip); - postDataPairs.Add(new KeyValuePair("serverPort", newServerInfo.Port.ToString())); - postDataPairs.Add(new KeyValuePair("serverPlayers", newServerInfo.Count.ToString())); - postDataPairs.Add(new KeyValuePair("serverCapacity", newServerInfo.Capacity.ToString())); - postDataPairs.Add(new KeyValuePair("serverExtras", newServerInfo.ExtraInformation == null ? string.Empty : newServerInfo.ExtraInformation.ToString())); + // Sanity checks: Did the user forget to set the endpoint? Did the user forget to + // specify the communication key? - var postContent = new FormUrlEncodedContent(postDataPairs); - HttpResponseMessage theResult = null; - try - { - theResult = httpClient.PostAsync(RegisterEndpoint, postContent).Result; - } - catch + if (string.IsNullOrWhiteSpace(EndPoint) || string.IsNullOrWhiteSpace(commKey)) { - // Swallow it + Debug.LogError("NodeLS Client: Endpoint or Communicaton key is invalid."); + yield break; } + Busy = true; - // Was this successful? - if (theResult != null && theResult.IsSuccessStatusCode) - { - var contentAsString = theResult.Content.ReadAsStringAsync().Result.Trim(); - OnServerRegistered?.Invoke(contentAsString); - return contentAsString; - } - else + // TODO: Server information checks + WWWForm postRequest = new WWWForm(); + postRequest.AddField("serverKey", commKey.Trim()); + postRequest.AddField("serverName", newServerInfo.Name.Trim()); + // Possibly in the future, doesn't do anything atm. + // ostRequest.AddField("serverIp", newServerInfo.Ip); + postRequest.AddField("serverPort", newServerInfo.Port); + postRequest.AddField("serverPlayers", newServerInfo.Count); + postRequest.AddField("serverCapacity", newServerInfo.Capacity); + postRequest.AddField("serverExtras", newServerInfo.ExtraInformation == null ? string.Empty : newServerInfo.ExtraInformation.ToString()); + + using (UnityWebRequest requestRunner = UnityWebRequest.Post($"{EndPoint}{RegisterEndpoint}", postRequest)) { - // Throw an exception. - throw new Exception($"Failed registering server. More information available on the NodeLS instance console."); + yield return requestRunner.SendWebRequest(); + + if (requestRunner.result == UnityWebRequest.Result.Success) + { + // It works! + OnServerRegistered?.Invoke(requestRunner.downloadHandler.text.Trim()); + } + else + { + Debug.LogError($"NodeLS Client: Error processing register request. Status returned was {requestRunner.result}."); + } } + + Busy = false; + yield return null; } - public void DeregisterServer(string CommunicationKey, string ServerUuid) + public IEnumerator DeregisterServer(string commKey, string serverUuid) { - // Did the user forget to set the endpoint? - if (string.IsNullOrWhiteSpace(EndPoint)) - throw new ArgumentNullException(EndPoint); - - // Did the user forget to specify the communication key? - if (string.IsNullOrWhiteSpace(CommunicationKey)) - throw new ArgumentNullException(CommunicationKey); - - // Gotta have a server uuid to use this! - if (string.IsNullOrWhiteSpace(ServerUuid)) - throw new ArgumentNullException(ServerUuid); - - // Sanity check passed, attempt contact. - httpClient.BaseAddress = EndPointAsUri; - - List> postDataPairs = new List> + if (string.IsNullOrWhiteSpace(EndPoint) || string.IsNullOrWhiteSpace(commKey) || string.IsNullOrWhiteSpace(serverUuid)) { - // Server Auth Key - new KeyValuePair("serverKey", CommunicationKey.Trim()), - // Server UUID to remove - new KeyValuePair("serverUuid", ServerUuid.Trim()) - }; - - var postContent = new FormUrlEncodedContent(postDataPairs); - HttpResponseMessage theResult = null; - try - { - theResult = httpClient.PostAsync(RemoveEndpoint, postContent).Result; - } - catch - { - // Swallow it + Debug.LogError("NodeLS Client: Endpoint, communicaton key or server UUID is invalid."); + yield break; } - // Was this successful? - if (theResult != null && theResult.IsSuccessStatusCode) - { - // Fire it off. - OnServerRemoved?.Invoke(); - } - else + WWWForm postRequest = new WWWForm(); + postRequest.AddField("serverKey", commKey.Trim()); + postRequest.AddField("serverUuid", serverUuid.Trim()); + + using (UnityWebRequest requestRunner = UnityWebRequest.Post($"{EndPoint}{RemoveEndpoint}", postRequest)) { - // Fire it off anyway. - OnServerRemoved?.Invoke(); + yield return requestRunner.SendWebRequest(); - // Throw an exception. - throw new Exception($"Failed deregistering server. This servers' listing may have expired or the NodeLS server was restarted. " + - $"HTTP status code {theResult.StatusCode}."); + if (requestRunner.result == UnityWebRequest.Result.Success) + { + // It works! + OnServerRemoved.Invoke(); + } + else + { + Debug.LogError($"NodeLS Client: Error processing deregister request. Status returned was {requestRunner.result}."); + } } } diff --git a/Assets/NodeLS Client/Example/Scripts/ServerListBrowser.cs b/Assets/NodeLS Client/Example/Scripts/ServerListBrowser.cs index 55e333c..c3dae3f 100644 --- a/Assets/NodeLS Client/Example/Scripts/ServerListBrowser.cs +++ b/Assets/NodeLS Client/Example/Scripts/ServerListBrowser.cs @@ -124,7 +124,7 @@ private void UpdateListElements() ListEntryController entryController = ListElementContainer.transform.GetChild(i).GetComponent(); - string modifiedAddress = string.Empty; + string modifiedAddress; if (listServerListEntries[i].ip.StartsWith("::ffff:")) { modifiedAddress = listServerListEntries[i].ip.Replace("::ffff:", string.Empty); From ff1218c48cf720945e2494764ee834e5e5124009 Mon Sep 17 00:00:00 2001 From: Matt Coburn Date: Tue, 15 Mar 2022 13:41:12 +1000 Subject: [PATCH 08/12] Fix up the debugging --- Assets/NodeLS Client/DebugCommunicator.cs | 27 ++++++++++++++++------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/Assets/NodeLS Client/DebugCommunicator.cs b/Assets/NodeLS Client/DebugCommunicator.cs index 40e70c2..eacb839 100644 --- a/Assets/NodeLS Client/DebugCommunicator.cs +++ b/Assets/NodeLS Client/DebugCommunicator.cs @@ -4,6 +4,12 @@ namespace NodeListServer { +#if UNITY_EDITOR + /// + /// This is for debug purposes only. + /// NOT RECOMMENDED FOR USE IN A PRODUCTION ENVIRONMENT. + /// YOU HAVE BEEN WARNED. + /// public class DebugCommunicator : MonoBehaviour { private NLSCommunicator communicator = new NLSCommunicator(); @@ -13,6 +19,7 @@ public class DebugCommunicator : MonoBehaviour private void Start() { communicator.EndPoint = "http://192.168.88.250:8889"; + communicator.OnServerRegistered += OnServerRegistered; communicator.OnServerRemoved += OnServerRemoved; } @@ -32,17 +39,14 @@ private void Update() ServerInfo serverInfo = new ServerInfo() { - Name = "NodeLS Communicator Test Server", - Count = 69, - Capacity = 420, + Name = $"NodeLS Dummy Server {Random.Range(100, 1000)}", + Count = Random.Range(0, 69), + Capacity = 999, Port = 31337, ExtraInformation = string.Empty, }; StartCoroutine(communicator.RegisterServer("NodeListServerDefaultKey", serverInfo)); - - // ourServerIdentifier = - } else if (Input.GetKeyDown(KeyCode.E)) { @@ -50,14 +54,21 @@ private void Update() if (string.IsNullOrEmpty(ourServerIdentifier)) return; - communicator.DeregisterServer("NodeListServerDefaultKey", ourServerIdentifier); + StartCoroutine(communicator.DeregisterServer("NodeListServerDefaultKey", ourServerIdentifier)); } } + private void OnServerRegistered(string serverUuid) + { + print("Server registered successfully"); + ourServerIdentifier = serverUuid; + } + private void OnServerRemoved() { + print("Server removed successfully"); ourServerIdentifier = string.Empty; } } - +#endif } From bd6e470960439d2c28b9fdf4bc2d4cacef15d5d3 Mon Sep 17 00:00:00 2001 From: Matt Coburn Date: Tue, 15 Mar 2022 14:24:30 +1000 Subject: [PATCH 09/12] Renames --- .../{Mirror Integration.meta => NodeLS Client Integrations.meta} | 0 ...odeListServer.UnityIntegration.asmdef => NodeLS.Client.asmdef} | 0 ...ver.UnityIntegration.asmdef.meta => NodeLS.Client.asmdef.meta} | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename Assets/{Mirror Integration.meta => NodeLS Client Integrations.meta} (100%) rename Assets/NodeLS Client/{NodeListServer.UnityIntegration.asmdef => NodeLS.Client.asmdef} (100%) rename Assets/NodeLS Client/{NodeListServer.UnityIntegration.asmdef.meta => NodeLS.Client.asmdef.meta} (100%) diff --git a/Assets/Mirror Integration.meta b/Assets/NodeLS Client Integrations.meta similarity index 100% rename from Assets/Mirror Integration.meta rename to Assets/NodeLS Client Integrations.meta diff --git a/Assets/NodeLS Client/NodeListServer.UnityIntegration.asmdef b/Assets/NodeLS Client/NodeLS.Client.asmdef similarity index 100% rename from Assets/NodeLS Client/NodeListServer.UnityIntegration.asmdef rename to Assets/NodeLS Client/NodeLS.Client.asmdef diff --git a/Assets/NodeLS Client/NodeListServer.UnityIntegration.asmdef.meta b/Assets/NodeLS Client/NodeLS.Client.asmdef.meta similarity index 100% rename from Assets/NodeLS Client/NodeListServer.UnityIntegration.asmdef.meta rename to Assets/NodeLS Client/NodeLS.Client.asmdef.meta From d60994a853ae79cf462691bbe5bcd83330a26182 Mon Sep 17 00:00:00 2001 From: Matt Coburn Date: Tue, 15 Mar 2022 14:24:38 +1000 Subject: [PATCH 10/12] Update README --- README.md | 69 ++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 43 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index b01a37d..a1d49b2 100644 --- a/README.md +++ b/README.md @@ -6,43 +6,58 @@ _**Please consider a donation (see the Ko-Fi button above) if this project is useful to you.**_ -This repository contains a project that shows off NodeListServer in action. Included is both server and client functionality and is easy to demostrate. The server and client logic are both set up to communicate with Furutaka, the Oiran Studio in-house development server. +This repository contains a Unity 2020.3 LTS project that demostrates a implementation of a classic Server Browser (one you'd see in classic games such as Battlefield 1942, old Call of Duty games, etc). -_**It is advised that this project is only used as a reference and not a "complete" project. Think of it like a reference manual, not something you'd slap into a project and expect it to make you a million dollars overnight.**_ +It is advised that this project is only used as a reference, don't expect it to be feature rich. -You are strongly advised NOT to use Furutaka's NodeLS instance in production as Oiran Studio cannot promise that it will be running forever. Instead, learn how to run your own instance by checking out the [NodeListServer repository](https://github.com/SoftwareGuy/NodeListServer). **Check your editor logs for any errors before you file a Issue Ticket.** There is a fair chance that the demo NodeListServer instance may be shut down for various reasons. +While the Server Browser logic is network stack agnostic (as in, it doesn't care if you're using Mirror, Mirage, a fishy-named network library or something paid), the Mirror and Mirage integrations are +dependent on the respective network stacks and require further steps. To help keep dependencies to a minimum the mentioned network stacks are **not** included in the repository. + +## Requirements + +- You must have installed and configured Node List Server. You can get it here from the [NodeListServer repository](https://github.com/SoftwareGuy/NodeListServer). ## Setup -1. Open the List Example scene, click Logic gameobject, and change the masterServerUrl and communicationKey, the key and port you will have set in Node List Server.config file on your vps. ( example masterServerUrl: http://MyVPS:8008/list ) -2. Locate and open the script called: NodeListServerCommunicationManager, and set the two variables, Server and AuthKey, same as above. -## Server Mode +1. You can either clone this repository and open it in your version of Unity, please note that any versions below Unity 2020 LTS are unsupported and I cannot have 50 different Unity versions on my workstation. Alternatively, download a snapshot +archive of this repository and copy the **NodeLS Client** directory into your project's Assets directory. +2. If you use Unity Assembly Definitions, add a reference to the `NodeLS.Client` Definition. This will allow you to access the `NodeListServer` namespace. +3. You're good to go! You can now create class instances of the NodeLS Client. An example would be `NLSCommunicator myCommunicator = new NLSCommunicator();`. -1. Open the project in your version of Unity. Remember to use a version supported with Mirror, which is 2018.3 - 2019.x. **Alpha/Beta versions are not supported.** -2. Go to File -> Build Settings -> Make sure both scenes are listed in the Build Scenes. -3. Tick "Server Build", then click `Build and Run`. -4. If prompted, point it to a empty folder and wait for it to build. -5. Once it completes, it should automatically pop up a new window (on Windows, maybe Mac/Linux too) and go through the cycles of starting up a server instance. You should also see "Successfully registered server instance!" in the console. +Review the `Communicator.cs` as it's commented and does explain what it's trying to do. -## Client Mode +### Testing with DebugCommunicator -1. Open the project in your version of Unity. Remember to use a version supported with Mirror, which is 2018.3 - 2019.x. **Alpha/Beta versions are not supported.** -2. Go to File -> Build Settings -> Make sure both scenes are listed in the Build Scenes. -3. Make sure "Server Build" is not ticked, then click `Build and Run`. -4. If prompted, point it to a empty folder and wait for it to build. -5. It should auto-run when complete. When the Unity runtime finishes initializing, it should load into the List Server Client user interface. If you have a server running, you should see it in the list. +- There is a `DebugCommunicator` script that I used during development to ensure things are operating correctly. It uses three keys which are **Q**, **W** and **E**. +- **Q** sends a request to retrieve the server list, **W** fakes a server registration request and **E** removes the fake server that it created (if it was successful). +- You'll need to modify the Endpoint in which it uses for it to work on your setup. This script has a compile define to only be available inside the Unity Editor. It will not be compiled in standalone builds. +- Using this script outside of a testing environment is a bad idea. You've been warned. -## Scripts +### Integration Packages -The main logic you want to take a look at is the `NodeListServerNetMan.cs` file. That is pretty much a barebones Network Manager with NodeListServer Adapter calls added where appropriate. See the Example scene's objects in its Hierarchy. If you're using custom code, just add the Node List Server Adapter component somewhere, and then you can call it's public functions where needed. +- Some integrations exist for various network stacks as mentioned earlier. +- Look inside the `NodeLS Client Integrations` folder for a UnityPackage file that contains scripts for use with the network stack the integration is for. +- Note that some integrations may be cause a compile error or warning about things being obsolete over time. If this happens, please open a issue ticket. ## Wait, why I cannot connect to a listed server? -- Unless your NodeLS instance is inside your local network, NodeLS will detect your **public** IP address. Most routers do not support loopback connections, which is basically a inside connection calling the external outside IP address. -- Some ISPs block game server traffic. Comcast, Verizon and Vodafone are some that do traffic blocking, including servers on non-business grade connections. You're screwed if your ISP does that to you. **Use a VPN to workaround this, at the expense of extra latency.** -- Mobile connections will not work for server hosting. Due to the nature of how mobile internet works, even if it *does* work partially, if you drop signal then you're in the dark. -- The server port is closed or needs Port Forwarding. If the server is on your ISP connection, open that port in your router - read the manual to figure out how to do that. **Keep in mind some ISPs can disallow port forwarding for stupid reasons, or they'll penalize you for doing so.** If it's on a Windows/Linux cloud instance, open the firewall using Windows Firewall or iptables, although if you're using Google Cloud/Amazon AWS/Microsoft Azure then that's a clusterfuck of a firewall system to deal with. +**The easy answers...** + - The server died. It happens, as it's Unity Engine after all. +- The server port is closed or needs Port Forwarding. If the server is on your ISP connection, open that port in your router: read the manual to figure out how to do that. See the footnote for additional info. + +**The more technicial answers...** + +*Are you trying to connect a server hosted on your network using the Server Browser?* + +- Unless your NodeLS instance is inside your local network, NodeLS will detect your **public** IP address. Your private IP might be `10.0.0.2`, but your public IP might be `42.69.4.20`. +- Most routers may not support loop-back connections, which is basically a LAN connection calling the external outside IP address. +- Some ISPs block game server traffic. Comcast, Verizon and Vodafone are some that do traffic blocking, including servers on non-business grade connections. You're screwed if your ISP does that to you. +- Hosting servers behind a VPN connection is a bad idea. +- Mobile connections will not work for server hosting. Due to the nature of how mobile internet works, even if it *does* work partially, if you drop signal then you're in the dark. + +Footnote: Keep in mind some ISPs can disallow port forwarding for stupid reasons, or they'll penalize you for doing so. If it's on a Windows/Linux cloud instance, open the firewall using Windows Firewall or +iptables, although if you're using Google Cloud/Amazon AWS/Microsoft Azure then it can be a clusterfuck. ## I need help! @@ -51,8 +66,10 @@ The main logic you want to take a look at is the `NodeListServerNetMan.cs` file. ## Credits -- AnthonyE: First NodeLS instance in production -- JesusLuvsYooh: Some say he's still pestering me with NodeLS bugfixes, but for what we know he's a great comrade -- Mirror Team & Discord Members: Warm and friendly community based around a great network stack +- AnthonyE +- JesusLuvsYooh +- NodeLS users & contributors +- Coffee donators +- Mirror discord _**Thanks for using Australian Open Source Software!**_ From e837dfc71bb70436bb8af93bcca0591eec991606 Mon Sep 17 00:00:00 2001 From: Matt Coburn Date: Tue, 15 Mar 2022 14:37:47 +1000 Subject: [PATCH 11/12] Fix name violation --- Assets/NodeLS Client/Example/Scripts/ServerListBrowser.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Assets/NodeLS Client/Example/Scripts/ServerListBrowser.cs b/Assets/NodeLS Client/Example/Scripts/ServerListBrowser.cs index c3dae3f..fe15ae1 100644 --- a/Assets/NodeLS Client/Example/Scripts/ServerListBrowser.cs +++ b/Assets/NodeLS Client/Example/Scripts/ServerListBrowser.cs @@ -32,7 +32,7 @@ public class ServerListBrowser : MonoBehaviour public Button supportButton; // Stop editing from this point onwards // - private bool isBusy => nlsCommunicator.Busy; + private bool IsBusy => nlsCommunicator.Busy; private NLSCommunicator nlsCommunicator = new NLSCommunicator(); private List listServerListEntries = new List(); @@ -80,7 +80,7 @@ private void LateUpdate() { if (popup != null) { - popup.SetActive(isBusy); + popup.SetActive(IsBusy); } } @@ -89,7 +89,7 @@ private void LateUpdate() private void RefreshList() { // Don't refresh again if we're busy. - if (isBusy) return; + if (IsBusy) return; StartCoroutine(nlsCommunicator.RetrieveList(communicationKey)); } From a8fb2955da2ee97c900a4e229373bb5f8c99ca23 Mon Sep 17 00:00:00 2001 From: Matt Coburn Date: Fri, 18 Mar 2022 12:10:22 +1000 Subject: [PATCH 12/12] Oops, forgot to commit --- .../NodeLS Client/Example/List Example.unity | 17 ++++++--------- .../Example/Scripts/ServerListBrowser.cs | 21 +++++++++++++++++++ ProjectSettings/EditorBuildSettings.asset | 2 +- 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/Assets/NodeLS Client/Example/List Example.unity b/Assets/NodeLS Client/Example/List Example.unity index 01d5e8c..909a89d 100644 --- a/Assets/NodeLS Client/Example/List Example.unity +++ b/Assets/NodeLS Client/Example/List Example.unity @@ -1526,17 +1526,12 @@ MonoBehaviour: m_HorizontalOverflow: 0 m_VerticalOverflow: 1 m_LineSpacing: 1 - m_Text: 'Git the source at https://github.com/SoftwareGuy/NodeListServer - - Thanks - for using Aussie Open Source Software! - - - Modify the NLS Adapter settings - on the "NodeListServer NetMan" in this scene, then build as a Server Build in - Unity via File > Build Settings > Tick Server Build > Build & Run. Server Builds - will automatically boot and register themselves using this example unless you - broke it. No refunds.' + m_Text: "If you like this software, please consider donating coffee at https://ko-fi.com/coburn\nThanks + for using Aussie Open Source Software. Don't forget to read the fine manual!\n\nThis + scene only shows the server browser in action, it doesn't contain any server + functionality. Clicking join will do nothing but print a message to the console. + \n\nPlease refer to the network stack integrations int the Git Repository for + information on how to integrate NodeLS in your server instances." --- !u!222 &777480157 CanvasRenderer: m_ObjectHideFlags: 0 diff --git a/Assets/NodeLS Client/Example/Scripts/ServerListBrowser.cs b/Assets/NodeLS Client/Example/Scripts/ServerListBrowser.cs index fe15ae1..dfb06a4 100644 --- a/Assets/NodeLS Client/Example/Scripts/ServerListBrowser.cs +++ b/Assets/NodeLS Client/Example/Scripts/ServerListBrowser.cs @@ -32,6 +32,8 @@ public class ServerListBrowser : MonoBehaviour public Button supportButton; // Stop editing from this point onwards // + public Action OnJoinButtonClicked; + private bool IsBusy => nlsCommunicator.Busy; private NLSCommunicator nlsCommunicator = new NLSCommunicator(); @@ -125,6 +127,8 @@ private void UpdateListElements() ListEntryController entryController = ListElementContainer.transform.GetChild(i).GetComponent(); string modifiedAddress; + int port; + if (listServerListEntries[i].ip.StartsWith("::ffff:")) { modifiedAddress = listServerListEntries[i].ip.Replace("::ffff:", string.Empty); @@ -134,11 +138,21 @@ private void UpdateListElements() modifiedAddress = listServerListEntries[i].ip; } + port = listServerListEntries[i].port; entryController.titleText.text = listServerListEntries[i].name; entryController.addressText.text = modifiedAddress; entryController.playersText.text = $"{listServerListEntries[i].players} {(listServerListEntries[i].capacity > 0 ? $"/ {listServerListEntries[i].capacity}" : string.Empty)}"; // It is up to you to figure out how to do the latency text. entryController.latencyText.text = "-"; + + if(entryController.joinButton != null) + { + // Remove any existing listening callbacks. + entryController.joinButton.onClick.RemoveAllListeners(); + + // Add a new listener. + entryController.joinButton.onClick.AddListener(() => OnJoinButtonClick(modifiedAddress, port)); + } } // Done here. @@ -164,5 +178,12 @@ private void OnServerListRetrieved(ServerListResponse response) } } #endregion + + private void OnJoinButtonClick(string ip, int port) + { + print($"You clicked join on a server and we'd probably be connecting to a server at {ip} on port {port}."); + + OnJoinButtonClicked?.Invoke(ip, port); + } } } diff --git a/ProjectSettings/EditorBuildSettings.asset b/ProjectSettings/EditorBuildSettings.asset index 7ed3058..2b72dc0 100644 --- a/ProjectSettings/EditorBuildSettings.asset +++ b/ProjectSettings/EditorBuildSettings.asset @@ -6,6 +6,6 @@ EditorBuildSettings: serializedVersion: 2 m_Scenes: - enabled: 1 - path: Assets/NodeListServer/Example/List Example.unity + path: Assets/NodeLS Client/Example/List Example.unity guid: ccdea83d270df4b078963a0243e41ac0 m_configObjects: {}