Search Unity

[WIP] Pulse.NET - Extra fast distributed networking

Discussion in 'Works In Progress - Archive' started by ManHunterITA, Dec 2, 2015.

?

Do you want to see this plugin on Asset Store?

  1. Yes

    100.0%
  2. No

    0 vote(s)
    0.0%
  1. ManHunterITA

    ManHunterITA

    Joined:
    Sep 3, 2013
    Posts:
    341
    Hi community,

    I'm working on a MMORPG development at my company as server side programmer, but in my free time usually I work on my side projects, to learn and to improve my skill in my job! I want to show you my last effort, Pulse.NET!


    What is Pulse.NET?
    As server side developer and old school programmer I'm really disappointed of current Unity networking plugins. I can't find the one that fits exactly with my idea of networking programming and can offer me features I need. Of course I didn't tried all network plugins on Asset Store, but I tried 4-5 of them and just one is acceptable (imho). Unluckily, it lacks of some important features I need.
    No one of them, instead, can offer an acceptable, load balanced, high scalable way to work on MMO Games with no bottlenecks (I'm clearly talking about standalone plugins, no cloud services or something similar).
    So Pulse.NET will try to accomplish an hard task: to fill the lack that exists in distributed authoritative client/server solutions for massive multiplayer games.

    What Pulse.NET can do for us?

    Pulse.NET is based on Lidgren library, at the moment. My plugin wraps all P2P stuff from Lidgren, so you will be able to create P2P (peer to peer connections, discovery requests, discover local peers, send unconnected data, etc) behaviours also. But it isn't my target, I wrapped them because I don't want to cut out base library's features.
    My attenction is focused on client/server functionalities, in particular on high scalable networking for MMOGs.
    So the main features of Pulse.NET are the following:
    - Standalone multithreaded server
    - Unity APIs for client creation and server creation. Of course you could need that a game server has access to physic, navmesh, etc. So you need server APIs for Unity.
    - Callback system to manage all incoming packets
    - Integrated database APIs (for MySQL at the moment, but I created a factory that instantiates drivers, so I want to introduce also drivers for SQLServer, MongoDB, PostgreSQL, etc: if you have requests feel free to post it) to manage worlds persistence
    - Scalable and distributed-like network architecture
    - Integrated examples and documentation
    - Integrated distributed network example, with a masterserver, nodes, database server and game servers

    Thanks to Lidgren, Pulse.NET supports reflection objects serialization, network buffers, various delivery types (like ReliableOrdered, ReliableSequenced, Unreliable, ReliableUnordered, UnreliableSequenced), messages pool/recycle, etc. In other words, you can use all Lidgren features.

    Can we talk about your network architecture? How it is composed?
    Pulse.NET's architecture is composed by some, important, entities. The following scheme will explain graphically what is the flow:


    The flow of generic client's action against the server

    Let's explain what each entity means!
    First of all, of course, we have clients: all our efforts are focused to enhance their game experience.
    When a client connects to Pulse.NET server, a MasterServer will check for current load of whole architecture (all registered nodes). So MasterServer will send back to client all information it needs to connect to chosen node. At the same time, MasterServer will communicate to connected client all information to connect to all services like chat, auctions, etc.
    At this point, our client can communicate directly with node to send messages that server side has to evaluate.
    Nodes can manage all non-game logic and respond to clients. A node can act as proxy - by submitting client's requests to game servers - or can act as a submasterserver - by checking current load of whole game servers architecture and communicate to client the chosen one. Client is now allowed to send messages and to receive responses back.
    Game servers architecture is composed by a group of Unity servers that manage virtual world. So they can manage physic, navmesh, animations, etc. They can represent different scenes or they can represent the same scene to split load on that scene (but they have to interact between them to ensure GameObjects sync).
    If chosen node hasn't proxy behaviour, game servers can interact directly with client, instead if node has proxy behaviour all messages between client and game server have to pass by chosen node.
    Database server is useful to store async information. It is a standalone server that receive all queries and put them in a queue: it will compute the queue independently of other servers.

    Last but not least, all this entities can be isolated on a single physical server. This means that you can spread your network on a huge physical servers group and you can add or subtract physical machines to this network based on your needs.

    What do you want to achieve with this thread?
    The target of this thread is huge: I want to inform you of my new plugin, but what I really need are suggestions. I'm young, I have only few years of experience as high scalable games server side programmer. This solution can be awesome for me, but can be wrong for some reasons for somebody else.
    I want to talk about my solution, I want to change my mind if somebody more expert than me wants to post his opinion. I want to learn more!

    Asset Store or not?
    I also want to know if someone is interested in this networking solution, if you want some particular feature to add. In your opinion, how much have to cost this solution?
    In case of big interest by users, I'm also planning to create complete game templates that already implement network functionalities, such as: MMO.NET, RTS.NET, MOBA.NET, etc.

    Oh, well: you're talking so much now... Pics or GTFO!
    I know, I know: I am boring with this wall of text, probably...
    I already provided two examples, the classic "spawn the cube, move it around the world and see other remote cubes" and the classic chat. Other examples will come, if this asset will go on Asset Store. You will find these examples in Pulse.NET package.



    Thank you,
    Emanuele
     
  2. ManHunterITA

    ManHunterITA

    Joined:
    Sep 3, 2013
    Posts:
    341
    Added database manager class. Currently supported DBMS drivers are MySQL and MariaDB.

    If you have particular requests feel free to ask here! :)
     
  3. Lee7

    Lee7

    Joined:
    Feb 11, 2014
    Posts:
    137
    Interested.

    Needs more MS SQLServer.

    Using Bolt + Playfab + Custom master server that handles game server instancing but this solution is not ideal, it does not fit my needs and as such I have had to make compromises based on that.
    Make the Data API clear, concise and easy. I really like PlayFab in this regards.

    Chat example is cool I guess but honestly anyone can make a chat server in 10 minutes with .NET sockets.
    Cube moving is rudimentary unless it includes server authoritative movement with clientside prediction. This is where bolt shines because it makes it easy for the developer to use and it works great.

    The most important part of anything MMO is data. Show some example of your data API to include security, data requests and response, etc. If I need to use PHP or WWW at all I wont touch it, pure C# methods for data interaction is needed.

    I purposely made my project modular because I knew it was not ideal and possibly would need to be replaced in the future so if you need and help testing or developing let me know.
     
    ManHunterITA likes this.
  4. ManHunterITA

    ManHunterITA

    Joined:
    Sep 3, 2013
    Posts:
    341
    One of my targets is to deal with server instancing in builtin way.
    Explain in detail what you mean about PlayFab, I didn't used it.

    Yes, of course my first two examples are simple. But they are just examples, made to test my system (so I improved the chat graphic to make it "presentable").
    I will provide other examples when I add other new features!

    The data is managed by separate server async service (it can run on other physical machine too). My API are composed by full C# classes and methods, no PHP or WWW use. I hate to build this type of stuff based on PHP scripts, it seems so "unprofessional" (no offense to developers who use it).
    I will also use PHP and WWW class to create another asset based on web (I already created all backend services and framework), but this is another topic.

    If you want to test something, add me on Skype: manhunterita.
    I need advices! :)

    I will add it soon, so. :)
    Anyone interested in PostgreSQL?
     
  5. Lee7

    Lee7

    Joined:
    Feb 11, 2014
    Posts:
    137
    Sounds good. I am working on some stuff I need to complete before end of week but I will message you after that.

    You can look at the PlayFab API at their site. but just to give you an example:

    Code (CSharp):
    1.     public void SendLoginRequest(string username, string password)
    2.     {
    3.         LoginWithPlayFabRequest request = new LoginWithPlayFabRequest();
    4.         request.Username = username;
    5.         request.Password = password;
    6.         PlayFabClientAPI.LoginWithPlayFab(request, OnLoginSuccess, PlayFabManager.instance.OnPlayFabError);
    7.     }
    8.  
    9.     private void OnLoginSuccess(LoginResult result)
    10.     {
    11.         SendGetUserInventoryRequest();
    12.  
    13.         if (BoltNetwork.isServer)
    14.         {
    15.             BoltNetwork.LoadScene("CharacterSelect");
    16.         }
    17.         if (BoltNetwork.isClient)
    18.         {
    19.             BoltNetwork.Connect(UdpKit.UdpEndPoint.Parse("127.0.0.1:54321"));
    20.         }
    21.     }
    Code (CSharp):
    1.     public List<ItemInstance> userInventoryCache = new List<ItemInstance>();
    2.  
    3.     public void SendGetUserInventoryRequest()
    4.     {
    5.         GetUserInventoryRequest request = new GetUserInventoryRequest();
    6.         PlayFabClientAPI.GetUserInventory(request, OnGetUserInventoryResultSuccess, PlayFabManager.instance.OnPlayFabError);
    7.     }
    8.  
    9.     private void OnGetUserInventoryResultSuccess(GetUserInventoryResult result)
    10.     {
    11.         userInventoryCache = result.Inventory;
    12.     }
     
    ManHunterITA likes this.
  6. ManHunterITA

    ManHunterITA

    Joined:
    Sep 3, 2013
    Posts:
    341
    I got it. Data management, anyway, is a lot game dependent. Pulse.NET will be a generic networking solution, that you can use for games but also distributed applications.
    Of course I already thought to this type of APIs, for this reason I quoted in my first post something like MMO.NET, MOBA.NET, RTS.NET, etc.
    What are they? They are a Pulse.NET based game type templates. In example, in MOBA.NET you will find all game related APIs that can manage login, inventory, etc.

    Let me know what do you think about this idea!
     
  7. Lee7

    Lee7

    Joined:
    Feb 11, 2014
    Posts:
    137
    I like the idea, but not if it restricts you. For instance what if I am using MOBA.NET but need to use a function in MMO.NET?

    Anyways, will you be available on skype tomorrow? I If so I will message you on there.
     
    ManHunterITA likes this.
  8. ManHunterITA

    ManHunterITA

    Joined:
    Sep 3, 2013
    Posts:
    341
    They will be game templates, so you can edit them for your needs. Or probably I can create them as modular extensions of basic Pulse.NET client/server.

    I'm on Skype all working days. In this period my working days include also weekend, to mix well my job with Pulse.NET development. :)
     
    Last edited: Dec 11, 2015
  9. ManHunterITA

    ManHunterITA

    Joined:
    Sep 3, 2013
    Posts:
    341
    Added SQLServer and PostgreSQL integration, now DatabaseManager supports driver for:
    - MySQL
    - MariaDB
    - SQLServer
    - PostgreSQL