Hello. I want to tell you about my project called the MLAPI. It’s a high level network abstraction library similar to the HLAPI. It’s designed to offer more features, greater flexibility and performance.
It should have all the feature the HLAPI current has and more. Here are some feature highlights
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.
For those who care, I have created a Wiki on Github. I am starting to get to a point where it’s usable. I will be creating example projects and more wiki pages as the project develops and hopefully it will be ready for use fairly soon. Currently it shares many features with the HLAPI. Such as object spawning, object authority. But it removes the many limitations the HLAPI has (and hopefully their bugs). The fancy features such as an easy way to get variables to sync (syncvars) are still not done. Currently you would have to create it similar to a Cmd - RPC setup. But it is planned.
I have created another repo for Examples. So far the example is just a unity scene with multiplayer where each player controls a cube and the positions sync across the network. It’s simply to show how to write network code with the library and is just very quick and dirty written code.
And btw, the Host feature is not yet working. So use one server and at least one client for now
The code above won’t send "PosUpdatesPerSecond"n packets to the server at the fixed tickrate of “PosUpdatesPerSecond” if the Client’s FrameRate would be lower than the “PosUpdatesPerSecond” value.
Let’s assume that your tickrate is 64, which means that the Client sends PositionUpdate 64 times per second. This particular case would work only if the Client’s FPS is 64 or higher, if you will try to change it to the lower value on the client by “Application.targetFrameRate = 20” - you will see jittering on the server because the client would send only 20 packets per second instead of 64.
So what I would suggest, is to somehow process that SendToServer in a new thread, because your main thread would be always busy and limited to the GPU resources.
But in general, I like the idea of MLAPI, sounds cool. Keep it up
By the way, what happened to your blog?
Hello.
I am currently on vacation in japan and this is a sideproject I started (though I am planning to continue it). As for the example project. You are correct. The example is just to show the basics of how to get started with message sending.
That out the way, you are corect. You have a good point though. I could add a thread system. So that once the send function is called, we send the byte array off to the thread to be processed. And its only returned to the main thread when it’s ready to be passed to the LLAPI. Same for receive but in reverse.
Not sure if it’s worth it though. The only gain would be that the binary serialization would happend on a separate thread. The HLAPI works on one thread aswell similar to this. Dont think you would get much of a benefit since game logic has to happend on the main thread and the NetworkTransport can also just be interacted with from that thread
Mainly it shows the new Target variant of the send methods. Using the Target version means that only listeners registered on the same NetworkedObject as it’s being sent from will be Invoked. Worth noting is that if multiple listeners are registered to the same NetworkedObject they will all be invoked. Even if they are on different NetworkedBehaviours. This is in order to not have to sync the NetworkedBehaviours themselves.
If anyone has any questions about the MLAPI. Feel free to ask. Currently, I feel that it’s at a point where it can be a better alternative to the HLAPI. I just need to consider Variable sync and scene management.
Also, if you encounter any problems with the library. Please open an Issue on Github.
I have added a big new feature. MessagePassthrough. It allows messages to be sent from Client to Client via the Server. This is similar to a Command → RPC Setup but requires a single call. Security features are implemented. You have to manually mark MessageTypes to be used for Passthrough and the Server will also inject the Source ClientId when passing it to the target. I have added a Wiki page for it.
Lot’s of new features have been added. Complete feature list can be found on the GitHub readme. It should now pretty much be production ready and I’m happy to hear from anyone using it. Any issues and/or missing features you encouter, please report them on GitHub and they will be looked into.
The components have replacements now (NetworkedTransform & NetworkedAnimator).
My thought was that it would be an alternate to NetworkedTransform, and include transform updates at a much lower frequency, allowing the clients to largely solve and run the agents independently. The big picture would be that the clients would have code that would drive other things off the NavMeshAgent that the server wouldn’t have because such would be non-critical to game play or precision across all clients, e.g. the destination is more important than the journey. If properties were sent as reliable only when changed, the data traffic would be a lot less for such entities. One scenario might be to have the server raise or lower the transform update frequency based on distance from client character for such agents. Come to think of it that might be a nice optimization for NetworkedTransform as well when proximity checking is active.
As for the Distance & Proximity thing, i’ll get that sorted. For future feature request. Please use the Issue feature on GitHub. Makes it super neat for me to track. That’s where pretty much all feature requests have been put so far and almost all have been implemented.
Right, I think that’s due to the import order of the components. Idk why Unity does that tbh.
NetworkManager has a NetworkingManager component, the player object just has NetworkedObject, NetworkedTransform and NetworkedAnimator that is from the library.
The documentation, API reference and wiki are documenting the last release. Thus they are a bit outdated. I am currently working on version 1.0 thus there has been no release for a bit. We are getting a brand new serializer in that uses bits instead of bytes to save as much space as possible & lots of new features. A new Editor script that lets you handle your versions and update the MLAPI in the engine.
I’ve just released version 1.0. It offers lot’s of new features and fixes and is now ready for use (IMO). It has a nice way to manage your MLAPI version to prevent your project from breaking while at the same time letting you easily upgrade. Please do excuse my horrible Editor scripting skills.