Giter Club home page Giter Club logo

synicsugar's Introduction

SynicSugar

https://github.com/skeyll/SynicSugar/blob/main/LICENSE Unity openupm

SynicSugar is Unity High-Level Network Library with EpicOnlineServices. The concept is the syntax sugar of netcode. Matchmaking, Relay and VC are for free thanks to EpicGames, and have high-level APIs for actual game development. Almost SynicSugar APIs are zero-allocation, so the runtime process is sonic. SynicSugar will be optimized for small-party game not covered by Mirror.

For more detail is https://skeyll.github.io/SynicSugar/.

Feature

  • Mesh topology with max 64 peers
  • No Use Cost and No CCU Limit
  • High-level APIs for mobile and small-group games (MatchMaking, Host-Migration, To sent Large-packet, PushToTalk, and Re-connection...)
  • Almost all RPC processes are zero-allocation
  • Free VoiceChat
  • Cross-platform connction
    (Windows / Linux / macOS
    Android / iOS
    Nintendo Switch / Xbox One / Xbox Series X / PlayStation 4 / PlayStation 5)
using SynicSugar.P2P;
using UnityEngine;
[NetworkPlayer(true)]
public partial class Player {  
    //Sync every 1000ms(default)
    [SyncVar] public int Hp;
    //Sync every 3000ms
    [SyncVar(3000)] Skill skill;

    [Synic(0)] public string name;
    [Synic(0)] public string item;
    [Synic(1)] public Vector3 pos;
    
    [Rpc] 
    public void Attack(int a){
        Hp -= a;
    }
    [TargetRpc]
    public void GreetTarget(UserId id){
        Debug.log("Hi");
    }
    [Rpc]
    public void Heal(HealInfo info){
        Debug.log($"{OwnerUserId} heal {info.target} {info.amount}");
    }

    public void SyncBasisStatus(){
        //Sync the Variables that have Synic(0) attribute at once.
        ConnectHub.Instance.SyncSynic(p2pInfo.Instance.LastDisconnectedUsersId, 0);
    }
}

Requirement

SynicSugar uses Roslyn SourceGenerator supported after 2021.3. SourceGenerator generates almost all codes for p2p connect on compile automatically.
Large dependencies is for performance. SynicSugar is mesh-topology p2p. All peers connect with each other instead of 1-to-many like dedicated server and client-server model. If we want to sync data with 63 peer in a full-mesh, we need to send data 63 times. Individual connection is fast but the whole is costly. So the core needs faster.

Getting started

1.Install SynicSugar and depended librarys.

The first is to import SynicSugar and dependent libraries. You can get SynicSugar from OpenUPM or SynicSugar/Release's unitypackage.
.unitypackage contains Mono.Cecil and System.Runtime.CompilerServices.Unsafe.dll for MemoryPack and, in addition to SynicSugar. Therefore, you can skip some processes, but it is more convenient to download via OpenUPM for version control.

  1. Rigister some package with OpenUPM

In your unity project, select Edit/ProjectSetting/PackageManager. Then, register some librarys.

Name: OpenUPM

URL: https://package.openupm.com

Scope(s):

  • net.skeyll.synicsugar (Skip if downloading as unitypackage)
  • com.cysharp.unitask
  • com.playeveryware.eos
  • com.cysharp.memorypack

image

  1. Install these packages
     These packages can be imported from Window/PackageManager/MyRegistries. Importing SynicSugar will automatically import the other required librarys. If you are using another version in your project, that one will probably work. However, SynicSugar has been developed using the following:
  • Epic Online Services Plugin for Unity: 2.2.0
  • UniTask: 2.3.1
  • MemoryPack: 1.9.13
  1. Import the rest (Skip if downloading as unitypackage.)
    Import what is not in OpenUPM.
  • Mono.Cecil
    Enter com.unity.nuget.mono-cecil in Edit/ProjectSetting/PackageManager/+/Add package from git URL.

image

  • System.Runtime.CompilerServices.Unsafe
    MemoryPack need System.Runtime.CompilerServices.Unsafe.dll. You can get this dll from Download package in https://www.nuget.org/packages/System.Runtime.CompilerServices.Unsafe/6.0.0 . Since this contains DLLs for multiple environments, only import packages for Unity. Unzip the downloaded file and drag and drop lib/netstandard2.0/System.Runtime.CompilerServices.Unsafe.dll into your project.

2.Get some tokens for EOS.

Please check the eos document or the plugin page. SynicSugar doesn't need EOS store brand. Just register and can develop online games.

About app credential, you can use Peer2Peer as ClientPolicy. The minimum is as follows. image

License

License is under the MIT.

Contribute Guideline

SynicSugar's concept is an easy online game development for everyone. Therefore, the development is also based on this policy. We can create online game for up to 64 people supported by EOS, but the main is small-party(2-32) game. If you want to create MMO, Survival Game and Party Game, you should use Mirror.

The roadmap is here. For the time being, add a basic function for online-game and improve the performance. If you need any necessary functions, please post it to Github Issue or give a pull request. Great thanks for all contributions!

synicsugar's People

Contributors

skeyll avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

synicsugar's Issues

Stop receiving to buffer in Pause.

No relationship around p2pToken.

Even if opponents disconnect the socket connection by notify, the connection is going on and continues to be received.

Maybe The connection cannot be broken with the connected user?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.