MLAPI - HLAPI Replacement

Am I missing something? I literally replicated the network config on the example project, but the example is able to connect from a client, but my project won’t connect.

You’re not giving me much to work with haha. You need to describe your issue a bit more in detail. If you are getting started, I suggest reading the Wiki. There are articles on how to get started.

That’s fair, I’m just a little frustrated is all. Been trying to diagnose this for 3 hours.

So I loaded up the example project, built it, and had no trouble connecting to a host running in the Editor. So far so good.

So I started a new project. I imported MLAPI, made a manager GO, added the NetworkingManager component, and copied the NetManagerHud script from the example project. Added a prefab to the Manager’s list, and checked the box for player object. Built the project, and proceeded to test. No luck, whichever instance runs host works fine, but the other instance will not connect to the server. Tried adding ConnectionApproval to see if any clients are even connecting, also got nothing.

Changed channels, message types, server transports, and ports for both projects. Same result. Used Netcat to test if any data is being sent from the client, and it is.

At this point I’m not even sure what options are even left to try, the Wiki wasn’t of great help.

Seems very odd. I mean, if the MLAPI is not even getting it’s connection approval things invoked. Then there is two things that could go wrong.

  1. LLAPI issue, this is unlikley.
  2. Configuration missmatch. If certain parts of the NetworkConfigs doesn’t match. They won’t talk to each other. But it should give you a nice message in console. If you send me the project. I will happily have a look. Sorry to hear your frustration.

EDIT:
One thing that could go wrong, is if you have NO Transports. See the networkConfig. Then it will not listen anywhere.

No, definitely got some transports.

I’m starting to think it’s my PC, but then I’ve been working on 3 different PCs now and it’s the same.

I’ll upload my project, and hopefully you can figure it out better than I. Thanks for taking a look by the way, I apologize for for sounding like a douche earlier.

3466820–275229–MLAPI Test.zip (526 KB)

Issue is the same on my machine. Let me look into it.

1 Like

Located the issue. Try running your project in development mode and you will get the console spammed. Essentially, the cryptography classes in .NET are fantastic. In Mono, not so much. Pretty much none are implemented. We had to write our own. It’s VERY time consuming. That’s why you don’t see proper key exchanges etc in other C# UDP libs for Unity or the HLAPI. But we did not have the time to write our own BigInt implementation. So we used IntX. We are working on our own. But for now we ship with IntX. This is an IntX issue. As far as I know, IntX is not open source, and I am not looking into the cause of the issue. I rather spend my time on working on our own implementation.

HOWEVER, I know a solution. Change the projects runtime from .NET 3.5 to the new 4.6 and the issue will no longer persist. Sorry for troubling you. This should have been documented, I just did not know.

Thanks so much. I thought I turned encryption off at some point to test, but I cannot remember off the top of my head now.
(EDIT: Not sure if turning encryption off actually affects this issue, so nevermind!)

In any case, glad to see it working!

It happends even with key exchange turned off. It’s part of a static field initializer.

1 Like

Ah I see. Thanks again!

No problem! I did a bit more digging, and found that if you want to use the .NET 3.5 version, you can as long as you change from .NET 2.0 subset to .NET 2.0.

Here is a video showing the install process. You can install the MLAPI in 15 seconds.
EasygoingNiceDairycow

With HLAPI Pro I had to replace files within the actual editor folder and it affected all projects, is this contained within only the current project you are using and my others will be fine?

------------ Edit
Nevermind, I see, its all good. I am going to give it a whirl. Any additional features that might benefit a RPG in some way would be appreciated. : P I dunno what, but… any. I am definitely interested in the observer system.

I’d venture to guess it isn’tI 2018.1 ready? I just tried to build in 2017.4 using net 4.6 and got this. ArgumentException: The Assembly LiteNetLib is referenced by MLAPI (‘Assets/MLAPI/Lib/MLAPI.dll’). But the dll is not allowed to be included or could not be found.

Edit again - - Errors are gone after trying 5-6 times but it wont build. The editor log says it did, but it dings at me and makes no executable and throws no error. I tried both 4.6 and 3.5(non-sub and sub). The closest I can get to an error in the log is this.

Fallback handler could not load library C:/Program Files/Unity/Hub/Editor/2017.4.1f1/Editor/Data/Mono/lib/data-0000000039F462D0.dll

I tried to go back a version as well and still no build though.

Oh, that’s intresting. I thought I could get away with referencing LiteNetLib but not including the library. I will get that sorted.

Edit:
This has been resolved in the v1.1.1 version. I removed LiteNetLib from the DefaultTransports, if you want to use it. Just download the transport from the “SampleTransports” folder.

Hello TwoTen I was wondering if I can make the player host the sever with no cost because I currently have a budget of $0.

Yes, that is supported

1 Like

Hey, Just a quick thank you for this project! This could be recommended for anyone who’s struggling to find a replacement for uNet or just wants a nice and clean networking solution.
I had a couple of very specific needs for my own game so I ended up taking a partial fork and building upon it. Your bit writer / reader system could be a project of its own :slight_smile:
Thank you!

That’s what many people do! Create a fork, add their own custom magic if needed (a lot of the time it’s not). Then they submit a PR and the stock library becomes better!

Glad you’re enjoying it!

1 Like

MLAPI intrigues me. I like the cut of its jib.

I am thinking about using MLAPI for a rewrite of a turn-based game that needs some heavy updating.

A few questions (just to clarify I am reading the wiki correctly):

  1. MLAPI allows me to synchronize an array of structs across the network, correct?
  2. Like the HLAPI, it does not allow synchronizing an array of classes, correct?
  3. When synchronizing an array of structs, and one property in one struct in the array is modified, does the entire array re-synced, or only the one struct in the array?

Thanks very much.
– Paul

  1. Short answer: yes, Long answer: you need to create a wrapper class if you don’t want to sync primitives
  2. Wrong
  3. You need to provide your own delta. So it does not have to resync evertythibg
1 Like