Skip to content

Commit 15a662a

Browse files
committed
Added Adaptive Serialization To Work Better On Lossy Networks
Fixed LoginOrSignUp in Multiple Times Fixed AutoMatch in Multiple Times
1 parent 64ea853 commit 15a662a

File tree

16 files changed

+64
-35
lines changed

16 files changed

+64
-35
lines changed

.idea/.idea.FiroozehGameServiceNative/.idea/contentModel.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/.idea.FiroozehGameServiceNative/.idea/indexLayout.xml

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assembly-CSharp-Editor-firstpass.csproj

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<PropertyGroup>
44
<LangVersion>latest</LangVersion>
5-
<_TargetFrameworkDirectories>non_empty_path_generated_by_unity.rider.package</_TargetFrameworkDirectories>
6-
<_FullFrameworkReferenceAssemblyPaths>non_empty_path_generated_by_unity.rider.package</_FullFrameworkReferenceAssemblyPaths>
7-
<DisableHandlePackageFileConflicts>true</DisableHandlePackageFileConflicts>
5+
<CscToolPath>/Applications/Unity/Unity.app/Contents/Tools/RoslynScripts</CscToolPath>
6+
<CscToolExe>unity_csc.sh</CscToolExe>
87
</PropertyGroup>
98
<PropertyGroup>
109
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -341,15 +340,6 @@
341340
<Reference Include="UnityEditor.iOS.Extensions">
342341
<HintPath>/Applications/Unity/PlaybackEngines/iOSSupport/UnityEditor.iOS.Extensions.dll</HintPath>
343342
</Reference>
344-
<Reference Include="FiroozehGameService">
345-
<HintPath>/Users/alirezaghodrati/UnityProject/FiroozehGameServiceNative/Assets/Plugins/GameService/Core/Managed/FiroozehGameService.dll</HintPath>
346-
</Reference>
347-
<Reference Include="Newtonsoft.Json">
348-
<HintPath>/Users/alirezaghodrati/UnityProject/FiroozehGameServiceNative/Assets/Plugins/GameService/Core/Managed/Newtonsoft.Json.dll</HintPath>
349-
</Reference>
350-
<Reference Include="GProtocol">
351-
<HintPath>/Users/alirezaghodrati/UnityProject/FiroozehGameServiceNative/Assets/Plugins/GameService/Core/Managed/GProtocol/Dynamic/GProtocol.dll</HintPath>
352-
</Reference>
353343
<Reference Include="UnityEngine.Advertisements.Editor">
354344
<HintPath>/Users/alirezaghodrati/UnityProject/FiroozehGameServiceNative/Library/PackageCache/[email protected]/Runtime/UnityEngine.Advertisements.Editor.dll</HintPath>
355345
</Reference>
@@ -371,6 +361,9 @@
371361
<Reference Include="UnityEditor.Purchasing">
372362
<HintPath>/Users/alirezaghodrati/UnityProject/FiroozehGameServiceNative/Library/PackageCache/[email protected]/Editor/UnityEditor.Purchasing.dll</HintPath>
373363
</Reference>
364+
<Reference Include="FiroozehGameService">
365+
<HintPath>/Users/alirezaghodrati/UnityProject/FiroozehGameServiceNative/Assets/Plugins/GameService/Core/Managed/FiroozehGameService.dll</HintPath>
366+
</Reference>
374367
<Reference Include="nunit.framework">
375368
<HintPath>/Users/alirezaghodrati/UnityProject/FiroozehGameServiceNative/Library/PackageCache/[email protected]/net35/unity-custom/nunit.framework.dll</HintPath>
376369
</Reference>
Binary file not shown.

Assets/Plugins/GameService/Core/Managed/FiroozehGameService.xml

Lines changed: 13 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Plugins/GameService/Utils/GameServiceInitializer.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ public class GameServiceInitializer : MonoBehaviour
8282

8383
private string _appPath;
8484
private string _logFile;
85+
86+
private static bool _isInit;
8587

8688
private const string DebugPath = "/GameService";
8789
private const string BeginLog = "\r\n=======================Begin GameService Debugger Logs======================\r\n";
@@ -92,12 +94,14 @@ private void Awake()
9294
{
9395
_appPath = Application.persistentDataPath;
9496
_logFile = "/GSLog-" + FiroozehGameService.Core.GameService.Version() + ".log";
97+
9598
DontDestroyOnLoad(this);
9699
}
97100

98101
private void OnEnable()
99102
{
100-
if(FiroozehGameService.Core.GameService.IsAuthenticated()) return;
103+
if(_isInit || FiroozehGameService.Core.GameService.IsAuthenticated()) return;
104+
101105
var systemInfo = new SystemInfo
102106
{
103107
DeviceUniqueId = UnityEngine.SystemInfo.deviceUniqueIdentifier,
@@ -148,12 +152,17 @@ private void OnEnable()
148152
var config = new GameServiceClientConfiguration(ClientId.Trim(),ClientSecret.Trim(),systemInfo);
149153
FiroozehGameService.Core.GameService.ConfigurationInstance(config);
150154

155+
_isInit = true;
151156
Debug.Log("GameService Version : "+FiroozehGameService.Core.GameService.Version()+" Initialized");
152157
}
153158

154159
private void OnDestroy()
155160
{
156161
FiroozehGameService.Core.GameService.Logout();
162+
163+
_isInit = false;
164+
FiroozehGameService.Core.GameService.OnDebugReceived = null;
165+
157166
Debug.Log("GameService Logout Called");
158167

159168
if (!RealTimeUtilEnabled) return;

Assets/Plugins/GameService/Utils/RealTimeUtil/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
44

55

66

7+
## [1.5.1] Stable - 2021-06-26
8+
9+
### Added
10+
11+
- Added Adaptive Serialization To Work Better On Lossy Networks
712

813

914
## [1.5.0] Alpha - 2021-06-25

Assets/Plugins/GameService/Utils/RealTimeUtil/Classes/Handlers/FunctionHandler.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,14 @@ internal class FunctionHandler : IFunctionHandler
3333
public bool RunFunction(string methodName,Type from, FunctionType type, params object[] extraData)
3434
{
3535
if (string.IsNullOrEmpty(methodName))
36-
throw new GameServiceException("Function method name cannot be null or empty.");
36+
throw new GameServiceException("Function Method Name Cannot be Null or Empty.");
3737

3838
if(!ObjectUtil.HaveFunctions(from))
3939
throw new GameServiceException("No Function Have GsLiveFunction Attribute in Class " + from);
4040

41+
if(methodName.Length > Sizes.MaxMethodName)
42+
throw new GameServiceException("Function Method Name is Too Large! (Max : " + Sizes.MaxMethodName + ")");
43+
4144
return true;
4245
}
4346

Assets/Plugins/GameService/Utils/RealTimeUtil/Consts/Sizes.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,7 @@ namespace Plugins.GameService.Utils.RealTimeUtil.Consts
2323
{
2424
internal static class Sizes
2525
{
26-
internal const short MaxId = 255;
2726
internal const short MaxPrefabName = 128;
2827
internal const short MaxMethodName = 255;
29-
30-
31-
internal const short EventInterval = 100;
32-
3328
}
3429
}

Assets/Plugins/GameService/Utils/RealTimeUtil/GsLiveRealtime.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,11 @@ public static class GsLiveRealtime
5353
private static IMemberHandler _memberHandler;
5454

5555
public static bool IsAvailable;
56-
public const string Version = "1.5.0 Alpha";
56+
public const string Version = "1.5.1 Stable";
5757

5858
public static string CurrentPlayerMemberId => GsSerializer.Object.GetCurrentPlayerMemberId();
59+
public static int SerializationRate => GsSerializer.Object.GetSerializationRate();
60+
5961

6062
public static int GetRoundTripTime()
6163
{
@@ -70,8 +72,6 @@ public static long GetPacketLost()
7072
return FiroozehGameService.Core.GameService.GSLive.RealTime().GetPacketLost();
7173
return -1;
7274
}
73-
74-
public static short SerializationRate => 10;
7575

7676
public static class Callbacks
7777
{

Assets/Plugins/GameService/Utils/RealTimeUtil/Models/SendableObjects/InstantiateData.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
using FiroozehGameService.Models;
2323
using FiroozehGameService.Utils.Serializer.Helpers;
2424
using FiroozehGameService.Utils.Serializer.Interfaces;
25+
using Plugins.GameService.Utils.RealTimeUtil.Consts;
2526
using UnityEngine;
2627

2728
namespace Plugins.GameService.Utils.RealTimeUtil.Models.SendableObjects
@@ -44,6 +45,9 @@ internal InstantiateData(string prefabName, Vector3 position, Quaternion rotatio
4445
if (Rotation == null)
4546
throw new GameServiceException("Rotation Cant Be Null");
4647

48+
if(prefabName.Length > Sizes.MaxPrefabName)
49+
throw new GameServiceException("PrefabName is Too Large! (MaxSize : " + Sizes.MaxPrefabName + ")");
50+
4751
PrefabName = prefabName;
4852
Position = position;
4953
Rotation = rotation;

Assets/Plugins/GameService/Utils/RealTimeUtil/Utils/ActionUtil.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ internal static void ApplySnapShot(IEnumerable<SnapShotData> data,IPrefabHandler
7878
private static void ApplyTransform(byte observerId,string ownerId,byte[] buffer)
7979
{
8080
var observer = ObjectUtil.GetGsLiveObserver(observerId,ownerId);
81-
observer.ApplyData(ownerId,buffer);
81+
if (observer != null) observer.ApplyData(ownerId,buffer);
8282
}
8383

8484
private static void ApplyObject(byte objectAction,byte[] data,string ownerId,IPrefabHandler handler)

Assets/Plugins/GameService/Utils/RealTimeUtil/Utils/ObjectUtil.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ internal static EventUtil RegisterObserver(GameServiceMasterObserver observer)
137137
if(_observerCache.ContainsKey(key))
138138
throw new GameServiceException("Observer (Id,Owner) Must Be Unique");
139139

140-
var newEvent = EventCallerUtil.CreateNewEvent(Sizes.EventInterval);
140+
var newEvent = EventCallerUtil.CreateNewEvent();
141141

142142
_observerCache.Add(key,observer);
143143
_observerEventCache.Add(key,newEvent);

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,23 @@ All notable changes to this project will be documented in this file.
66

77

88

9+
## [8.1.0] Stable - 2021-06-26
10+
11+
### Added
12+
13+
- Added Adaptive Serialization To Work Better On Lossy Networks
14+
15+
16+
17+
### Fixed
18+
19+
- Fixed LoginOrSignUp in Multiple Times
20+
- Fixed AutoMatch in Multiple Times
21+
22+
23+
24+
25+
926
## [8.0.0] Alpha - 2021-06-22
1027

1128
### Added

0 commit comments

Comments
 (0)