Skip to content

Commit

Permalink
Added Adaptive Serialization To Work Better On Lossy Networks
Browse files Browse the repository at this point in the history
Fixed LoginOrSignUp in Multiple Times
Fixed AutoMatch in Multiple Times
  • Loading branch information
AR-Ghodrati committed Jun 26, 2021
1 parent 64ea853 commit 15a662a
Show file tree
Hide file tree
Showing 16 changed files with 64 additions and 35 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 5 additions & 12 deletions Assembly-CSharp-Editor-firstpass.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<LangVersion>latest</LangVersion>
<_TargetFrameworkDirectories>non_empty_path_generated_by_unity.rider.package</_TargetFrameworkDirectories>
<_FullFrameworkReferenceAssemblyPaths>non_empty_path_generated_by_unity.rider.package</_FullFrameworkReferenceAssemblyPaths>
<DisableHandlePackageFileConflicts>true</DisableHandlePackageFileConflicts>
<CscToolPath>/Applications/Unity/Unity.app/Contents/Tools/RoslynScripts</CscToolPath>
<CscToolExe>unity_csc.sh</CscToolExe>
</PropertyGroup>
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
Expand Down Expand Up @@ -341,15 +340,6 @@
<Reference Include="UnityEditor.iOS.Extensions">
<HintPath>/Applications/Unity/PlaybackEngines/iOSSupport/UnityEditor.iOS.Extensions.dll</HintPath>
</Reference>
<Reference Include="FiroozehGameService">
<HintPath>/Users/alirezaghodrati/UnityProject/FiroozehGameServiceNative/Assets/Plugins/GameService/Core/Managed/FiroozehGameService.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>/Users/alirezaghodrati/UnityProject/FiroozehGameServiceNative/Assets/Plugins/GameService/Core/Managed/Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="GProtocol">
<HintPath>/Users/alirezaghodrati/UnityProject/FiroozehGameServiceNative/Assets/Plugins/GameService/Core/Managed/GProtocol/Dynamic/GProtocol.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.Advertisements.Editor">
<HintPath>/Users/alirezaghodrati/UnityProject/FiroozehGameServiceNative/Library/PackageCache/[email protected]/Runtime/UnityEngine.Advertisements.Editor.dll</HintPath>
</Reference>
Expand All @@ -371,6 +361,9 @@
<Reference Include="UnityEditor.Purchasing">
<HintPath>/Users/alirezaghodrati/UnityProject/FiroozehGameServiceNative/Library/PackageCache/[email protected]/Editor/UnityEditor.Purchasing.dll</HintPath>
</Reference>
<Reference Include="FiroozehGameService">
<HintPath>/Users/alirezaghodrati/UnityProject/FiroozehGameServiceNative/Assets/Plugins/GameService/Core/Managed/FiroozehGameService.dll</HintPath>
</Reference>
<Reference Include="nunit.framework">
<HintPath>/Users/alirezaghodrati/UnityProject/FiroozehGameServiceNative/Library/PackageCache/[email protected]/net35/unity-custom/nunit.framework.dll</HintPath>
</Reference>
Expand Down
Binary file modified Assets/Plugins/GameService/Core/Managed/FiroozehGameService.dll
Binary file not shown.
22 changes: 13 additions & 9 deletions Assets/Plugins/GameService/Core/Managed/FiroozehGameService.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion Assets/Plugins/GameService/Utils/GameServiceInitializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ public class GameServiceInitializer : MonoBehaviour

private string _appPath;
private string _logFile;

private static bool _isInit;

private const string DebugPath = "/GameService";
private const string BeginLog = "\r\n=======================Begin GameService Debugger Logs======================\r\n";
Expand All @@ -92,12 +94,14 @@ private void Awake()
{
_appPath = Application.persistentDataPath;
_logFile = "/GSLog-" + FiroozehGameService.Core.GameService.Version() + ".log";

DontDestroyOnLoad(this);
}

private void OnEnable()
{
if(FiroozehGameService.Core.GameService.IsAuthenticated()) return;
if(_isInit || FiroozehGameService.Core.GameService.IsAuthenticated()) return;

var systemInfo = new SystemInfo
{
DeviceUniqueId = UnityEngine.SystemInfo.deviceUniqueIdentifier,
Expand Down Expand Up @@ -148,12 +152,17 @@ private void OnEnable()
var config = new GameServiceClientConfiguration(ClientId.Trim(),ClientSecret.Trim(),systemInfo);
FiroozehGameService.Core.GameService.ConfigurationInstance(config);

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

private void OnDestroy()
{
FiroozehGameService.Core.GameService.Logout();

_isInit = false;
FiroozehGameService.Core.GameService.OnDebugReceived = null;

Debug.Log("GameService Logout Called");

if (!RealTimeUtilEnabled) return;
Expand Down
5 changes: 5 additions & 0 deletions Assets/Plugins/GameService/Utils/RealTimeUtil/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.



## [1.5.1] Stable - 2021-06-26

### Added

- Added Adaptive Serialization To Work Better On Lossy Networks


## [1.5.0] Alpha - 2021-06-25
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,14 @@ internal class FunctionHandler : IFunctionHandler
public bool RunFunction(string methodName,Type from, FunctionType type, params object[] extraData)
{
if (string.IsNullOrEmpty(methodName))
throw new GameServiceException("Function method name cannot be null or empty.");
throw new GameServiceException("Function Method Name Cannot be Null or Empty.");

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

if(methodName.Length > Sizes.MaxMethodName)
throw new GameServiceException("Function Method Name is Too Large! (Max : " + Sizes.MaxMethodName + ")");

return true;
}

Expand Down
5 changes: 0 additions & 5 deletions Assets/Plugins/GameService/Utils/RealTimeUtil/Consts/Sizes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,7 @@ namespace Plugins.GameService.Utils.RealTimeUtil.Consts
{
internal static class Sizes
{
internal const short MaxId = 255;
internal const short MaxPrefabName = 128;
internal const short MaxMethodName = 255;


internal const short EventInterval = 100;

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@ public static class GsLiveRealtime
private static IMemberHandler _memberHandler;

public static bool IsAvailable;
public const string Version = "1.5.0 Alpha";
public const string Version = "1.5.1 Stable";

public static string CurrentPlayerMemberId => GsSerializer.Object.GetCurrentPlayerMemberId();
public static int SerializationRate => GsSerializer.Object.GetSerializationRate();


public static int GetRoundTripTime()
{
Expand All @@ -70,8 +72,6 @@ public static long GetPacketLost()
return FiroozehGameService.Core.GameService.GSLive.RealTime().GetPacketLost();
return -1;
}

public static short SerializationRate => 10;

public static class Callbacks
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
using FiroozehGameService.Models;
using FiroozehGameService.Utils.Serializer.Helpers;
using FiroozehGameService.Utils.Serializer.Interfaces;
using Plugins.GameService.Utils.RealTimeUtil.Consts;
using UnityEngine;

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

if(prefabName.Length > Sizes.MaxPrefabName)
throw new GameServiceException("PrefabName is Too Large! (MaxSize : " + Sizes.MaxPrefabName + ")");

PrefabName = prefabName;
Position = position;
Rotation = rotation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ internal static void ApplySnapShot(IEnumerable<SnapShotData> data,IPrefabHandler
private static void ApplyTransform(byte observerId,string ownerId,byte[] buffer)
{
var observer = ObjectUtil.GetGsLiveObserver(observerId,ownerId);
observer.ApplyData(ownerId,buffer);
if (observer != null) observer.ApplyData(ownerId,buffer);
}

private static void ApplyObject(byte objectAction,byte[] data,string ownerId,IPrefabHandler handler)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ internal static EventUtil RegisterObserver(GameServiceMasterObserver observer)
if(_observerCache.ContainsKey(key))
throw new GameServiceException("Observer (Id,Owner) Must Be Unique");

var newEvent = EventCallerUtil.CreateNewEvent(Sizes.EventInterval);
var newEvent = EventCallerUtil.CreateNewEvent();

_observerCache.Add(key,observer);
_observerEventCache.Add(key,newEvent);
Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,23 @@ All notable changes to this project will be documented in this file.



## [8.1.0] Stable - 2021-06-26

### Added

- Added Adaptive Serialization To Work Better On Lossy Networks



### Fixed

- Fixed LoginOrSignUp in Multiple Times
- Fixed AutoMatch in Multiple Times





## [8.0.0] Alpha - 2021-06-22

### Added
Expand Down

0 comments on commit 15a662a

Please sign in to comment.