Alright, I’ve been really struggling with NetSession in my XNA->MG port. I was up till 5am fighting with it, still can’t get anywhere. I’ve always got a hostGamer == null, so UnreferencedObject abounds when I try to actually use the NetSession (just for local games now).
Is NetSession even safe to use?
One of the big issues I have is I’m unable to actually set breakpoints in the MonoGame.Framework.Net project as its in a separate solution in VS (using 2013 Community Edition). Does anyone know how to set breakpoints in a separate solution? I’ve tried adding the MonoGame projects to my game solution, but it still is unable to properly debug there.
I’m on Android if that changes anything.
Microsoft.Xna.Framework.Net namespace has suffered from lack of maintenance, primarily because it gets very little, if any, use by most games. You’re the first that I can recall trying to use it in the last couple of years.
To debug it, you can add the csproj for the .Net assembly to your existing solution.
Yeah, I was looking at the commit history. It’s not happy
Alright, one thing I did find out is that even using local NetworkSessions you need to make sure the app has the ACCESS_WIFI_STATE permission. It will not fail, and lead to a hostGamer always being set to null (which isn’t necessarily clear how its related but with all the threading it gets really hard to debug the actual flow).
That fixed my first issue, now I think I’m back in app land trying to work out this lobby
That’s par for the course with Android development. I’ve been bitten by similar permissions issues a lot.
Yeah, and now I realized I’ve been fighting with a race condition in Debug configuration for the last 4 hours. Set it to release, works perfect. Set it to Debug, racey. Add an extra instruction or two, no more race.
Sigh. At least the good news is the port is now fully functional from a gameplay perspective, so now I can finally play an XBLIG title on this Android device.
The networking stuff does need some love, but the good news is that for iOS/Android and Desktop it ‘should’ work ok. Note its not compatible with the XNA networking.
I am working on a rework of sorts to allow WinRT/WP to work as well, but its a work in progress and isn’t even sending any data yet.