AMF

Jul
06

AMF

One thing I’ve learned through development on this project is that when something goes weird, it is Always My Fault. While the libraries or even Unity itself occasionally have/has, some quirk or known issue, or even an honest bug, more often than not, it’s something dumb I did, possibly a long time ago. In this case, it was something I didn’t do! And things I did. Here’s where my week went:

Controller 2 just decides to disappear on the Sports Pages screen. This, as many things this week, turned out to be My Fault

I was testing out my Xbox One Season Mode build when I noticed some controller issues. I thought that was very strange indeed as I’ve been using Rewired, a completely badass solution to controllers in Unity. In fact, I had redone some things to be more aligned with how Rewired works recently. This was done more recently than the old Team HQ screen, so I was aware there might be some problems in Season Mode. I decided to check it out with some debug information in Unity.

It was hard to keep track of what was happening, so I listed all the controller information for all 9 player slots. One is reserved for keyboard and mouse controls, the other 8 are where game controllers get assigned. The game is only 6 players at the moment, but those 6 players can use any of 8 controllers plugged in. And for some reason, the player on controller info #2 was getting blown away on the Sports Pages screen as soon as someone moved the cursor. Even stranger, reconnecting it assigned it to slot 7 and strangest of all, it no longer functioned.

Odder still, an unrelated bug

The loss of controller info 2 turned out to be because of something dumb I did. My fault! I was literally assigning the cursor controlling player to the 2nd slot on the new Team HQ screen. This might have made more sense the old way I handled controllers, but surprise, that was written on the old Team HQ screen, before I redid the controller info setup this way. If only I made a note of it…

My Fault. Even had it underlined.

Now I loop through the controller infos, not the joysticks, and I can assign the controlling player for that screen without reassigning the stick. Hooray! This fixed the issue and controller 2 stopped disappearing. But the weird issue of some sticks not working persisted. It seemed as I plugged in more controllers, the bug was more likely to appear. I needed more information.

Mapless in Meattle

In debugging and trying to figure out what was wrong, it seemed like this stick didn’t have a map to tell it what buttons were what. I thought this was a disconnect/reconnect issue, but upon experimenting further it didn’t seem to be tied to a specific to a piece of hardware; I could swap USB cables and they would reconnect in an order based on which plug was used.

I wrote code to detect if the map was missing from a controller, and if so to load the default map, but it was no good. I was almost at the point of desperation, the point where I started considering thinking about, maybe emailing the Guavaman for support. My brain told me from years of experience however, that this was probably Always My Fault. I updated Rewired just to be sure.

I even ported back to a Windows build, just in case it was something screwy with the Unity editor in Xbox mode with Rewired, but no, the problem persisted. Finally I plugged in an older, totally different controller, and it didn’t work either. I tried again with no other controllers plugged in, and that old controller was fine. That’s when I figured out that it was a problem only with controller infos 6 and 7. It didn’t matter what was plugged in, those slots were not working.

Well if it’s not obvious by now what the common denominator was, it should have been. I went into the Rewired configuration and double checked to make sure that all these players actually existed, since, yes, the game is only 6 players. But I had remembered correctly; there were 10 players defined. One is reserved for System (not used) and the remaining 9 are described above. They were all there. I clicked through them to be sure, and then found one thing missing… on Player6 and Player7:

This is like spending 2 days trying to figure out why your toaster doesn’t work and you realize the cord isn’t plugged into the wall

All the other players had Default JoystickMaps on them, except players 6 and 7. This is like step 2 of setting up Rewired. Womp womp. On the plus side, I figured it out, and I can fix the Xbox One Season Mode build the same way. On the minus side, there went my week, barking up wrong trees because of something dumb I did, and/or didn’t do. My fault!

Xbox One build testing resumes next week.

About rick

Founder of Tipping Goat and creator of Super Slam Dunk Touchdown. On Twitter @TippingGoat

Leave a comment

*