MLAPI by MidLevel - 3

Games & ProjectsFrameworksNetwork

A game networking framework built for the Unity Engine to abstract game networking concepts

MIT LicenseUpdated 7 hours agoCreated on January 5th, 2018

MLAPI (Mid level API) is a framework that hopefully simplifies building networked games in Unity. It is built on the LLAPI and is similar to the HLAPI in many ways. It does not however integrate into the compiler and it’s meant to offer much greater flexibility than the HLAPI while keeping some of it’s simplicity. It offers greater performance over the HLAPI.

GitHub Release Github All Releases Discord Build Status AppVeyor Tests

Licence Website Wiki Api

Documentation

To get started, check the Wiki. This is also where most documentation lies.

To get the latest features, the CI server automatically builds the latest commits from master branch. Note that this build still requires the other DLL’s. It might be unstable. You can download it Here

Support

For bug reports or feature requests you want to propose, please use the Issue Tracker on GitHub. For general questions, networking advice or to discuss changes before proposing them, please use the Discord server.

Requirements

  • Unity 2017 or newer
  • .NET 4.6 or .NET 3.5 with .NET 2.0 non subset

Feature highlights

  • Host support (Client hosts the server)
  • Object and player spawning [Wiki page]
  • Connection approval [Wiki page]
  • Strongly Typed RPC Messaging [Wiki page]
  • Replace the integer QOS with names. When you setup the networking you specify names that are associated with a channel. This makes it easier to manage. You can thus specify that a message should be sent on the “damage” channel which handles all damage related logic and is running on the AllCostDelivery channel.
  • ProtocolVersion to allow making different versions not talk to each other.
  • NetworkedBehaviours does not have to be on the root, it’s simply just a class that implements the send methods etc.
  • Custom tickrate
  • Synced network time
  • Supports separate Unity projects crosstalking
  • Scene Management [Wiki page]
  • Built in Lag compensation [Wiki page]
  • NetworkTransform replacement
  • Port of NetworkedAnimator
  • Networked NavMeshAgent
  • Networked Object Pooling [Wiki page]
  • Networked Vars [Wiki page]
  • Encryption [Wiki page]
  • Super efficient BitWriter & BitReader [Wiki page]
  • Custom UDP transport support [Wiki page]
  • NetworkProfiler [Wiki page]

Special thanks

Special thanks to Gabriel Tofvesson for writing the BitWriter, BitReader & ECDH implementation

Issues and missing features

If there are any issues, bugs or features that are missing. Please open an issue on the GitHub issues page

Example

Example project

The example project has a much lower priority compared to the library itself. If something doesn’t exist in the example nor the wiki. Please open an issue on GitHub.

Sample Chat

Here is a sample MonoBehaviour showing a chat script where everyone can write and read from.

public class Chat : NetworkedBehaviour
{
    private NetworkedList<string> ChatMessages = new NetworkedList<string>(new MLAPI.NetworkedVar.NetworkedVarSettings()
    {
        ReadPermission = MLAPI.NetworkedVar.NetworkedVarPermission.Everyone,
        WritePermission = MLAPI.NetworkedVar.NetworkedVarPermission.Everyone,
        SendTickrate = 5
    }, new List<string>());

    private string textField = "";

    private void OnGUI()
    {
        if (isClient)
        {
            textField = GUILayout.TextField(textField, GUILayout.Width(200));
            if (GUILayout.Button("Send") && !string.IsNullOrWhiteSpace(textField))
            {
                ChatMessages.Add(textField);
                textField = "";
            }

            for (int i = ChatMessages.Count - 1; i >= 0; i--)
            {
                GUILayout.Label(ChatMessages[i]);
            }
        }
    }
}
Show all projects by MidLevel