SoftwareGuy / Ignorance

Ignorance utilizes the power of ENet to provide a reliable UDP networking transport for Mirror Networking.
Other
248 stars 31 forks source link

Mac Silicon, game console, and additional platform support #86

Open TCROC opened 1 year ago

TCROC commented 1 year ago

I mentioned something I am trying out over here in this issue:

https://github.com/SoftwareGuy/ENet-CSharp/issues/41 https://github.com/SoftwareGuy/ENet-CSharp/issues/41#issuecomment-1622389486

I'm just opening an issue to track it here as well as it is specifically Ignorance that I am using to test it with. Quote of comment here for ease of reading:

@SoftwareGuy I was doing some digging around on this as I'm also in need of Mac and hopefully soon PlayStation, XBox, and Switch support. I found this:

https://docs.unity3d.com/Manual/PluginInspector.html

And this:

https://forum.unity.com/threads/how-to-setup-this-windows-player-c-source-code-plugins-for-il2cpp.537269/

Reading through it, it sounds like Unity supports including native C code in your project and it will compile it in the il2cpp build process. It won't work in mono builds or Editor (because of mono).

I'll try it out with enet and if it works, it should make it so enet supports all platforms unity compiles il2cpp with (which I think is all of them).

I'll keep this issue updated with my findings and put in a PR for review if it works on my local.

SoftwareGuy commented 1 year ago

Ok, that'll be great. Good to know that Unity might be able to do the compiling, although it might need some compile defines for it to compile successfully.

TCROC commented 1 year ago

Good call. I'm scrolling through the c file now and seeing those ifdefs. I'll keep you updated on my findings

TCROC commented 1 year ago

Good news, mac compiled. Now I'm trying uploading to the AppStore / Test Flight. Then gonna test it on intel and m1 macs with some users tonight

SoftwareGuy commented 1 year ago

Awesome. This will mean I don't have to go to the lengths of having to fix up the libraries when Unity can do it for us, only downside I think would be if it's trying to load the library or something from disk? Unless it's marked as "embedded" so it doesn't try to load libenet.dylib or enet.dll?

TCROC commented 1 year ago

Have not tested yet. Had to recompile cause Apple rejected my build because of different libraries. I'm recompiling and reuploading.

I don't think that will be an issue. Only downside I've been able to identify is Mono builds w and Unity Editor doesn't work with it (because editor relies on Mono).

Actually... I'm not sure about the Mono builds. I'll have to test. I wonder if Unity still compiles C code for mono builds. If so, then the only thing precompiled libraries will be needed for is the Unity Editor.

TCROC commented 1 year ago

Update:

I finally got it to compile and upload to App Store Connect. Then it got flagged for not indicating whether or not is uses non exempt encryption...

I set the setting and triggered another build. Hopefully this one makes Apple happy :)

TCROC commented 1 year ago

Update:

Yay! AppStore Connect is happy! Gonna try it out tomorrow and see how it actually works at runtime.

SoftwareGuy commented 1 year ago

Sweet. This'll be great to know!

TCROC commented 1 year ago

Update:

Things seem to be working for mac Intel (x86_64).

I'm going to run some more tests on it tomorrow. Haven't had a chance to test Mac M1 yet. Will also try to do that tomorrow.

SoftwareGuy commented 1 year ago

Any updates on this?

TCROC commented 1 year ago

Yep Mac Intel seems to be working. I got caught up in some other testing with my users and didn't get a chance to do Mac ARM yet. Gonna try to do that this week