I Almost Lost Everything

First and foremost, Space Cats is now available for wishlist on Steam (https://store.steampowered.com/app/2892290/Space_Cats/). I hope to have the game published and released within the next two weeks so please stay tuned.

Here’s the final main title image

After getting my store ready and submitted to Valve for approval, I began working on full controller support. Mostly because I want my game to be playable on the Steam Deck (I'm not bothering with other consoles right now). So after reading tons of different blog posts, watching a few tutorials, and even cracking open the Unity docs, I decided to give it a go.

Getting my cat to jump up and down while pushing the “A” button was actually really simple. All I needed to do was add a little line of code in my Update() method.

“Okay. This isn’t as bad as I originally thought,” I naively thought lol.

But then I tried to get my UI menus to work. And while the main ones did, my dynamic menus didn’t work. So I started Googling. And then I came across a couple blogs and videos describing Unity’s New Input System. So then I cracked open my editor, tried to follow their directions, and realized that I was on the Old Input System. Okay. No problem. I’ll just update my editor. And then I tried to follow the directions. But quickly, it was becoming really cumbersome and I realized I’d have to refactor a lot of code I’d already written.

I thought "this is ridiculous that I'm trying to rewrite all this code for only one stupid button" (I was trying to map the start button on my xbox controller to my pause menu).

So then I tried to undo all my changes and go back to the old system, only to realize that I had really broken my game. And I almost lost everything. I was on the verge of tears and panic. Would I really lose everything that I had worked on for the past 6 weeks? I’m on the verge of publishing my game!

I tried to download my GitHub copy and start over but even then that wasn't working. To tell you I was panicked and freaking out is an understatement. I really thought I had horked it beyond saving. This is it. This is the end. I’m a failed game developer.

After calming myself down, I turned to the inter webs to help me unravel the big mess I had made. Luckily, Unity has a Safe Mode that will quite literally save you from your own stupidity. I was able to methodically and carefully undo my changes and luckily, I didn’t lose everything. I didn’t royally mess up my game. I only lost one day’s worth of terrible work.

Time to take a break. I put down my computer for the rest of the day and decided that I needed to understand what was happening and WHY it happened before I attempt controller support again. And here’s where I messed up.

First of all, I should have made a new branch in git and done all the controller work on that, not on my main. That way it would have been much easier for me to roll back my changes and I wouldn’t have had as much of a panic when things didn’t go as well.

The second problem has to do with the fact that I was making all these changes and doing all these things without understanding the fundamental reason why I was making those changes in the first place. So I did some actual thorough reading on the Unity docs, talked to some other devs online, and here’s the big dealio.

Each controller is set up slightly differently (for example, PS 5 controllers are slightly different from PS 4 controllers and these are different from Xbox One which are slightly different from Xbox 360 which are very different from Nintendo’s controllers). And I’m not talking just about appearance, but also in how they’re mapped and how different game engines (and operating systems too I later learned) interpret the hardware and the inputs. And to make a game have full controller compatibility, you have to explicitly map each button to the game functionality. Obviously there are some built-ins that help development go faster, but you still have to do explicit mapping. The only problem is, if you map one controller explicitly, that doesn’t mean that a different controller is going to be compatible with that mapping.

Let me illustrate an example. If I want a player to be able to make the cat jump by pressing the “A” button, on an Xbox One controller, that functionality is going to be mapped to “joystick button 0”. But what if I wanted to make my game compatible with a Switch controller? Well if I wanted “A” to still be jump, then I would have to map it to “joystick button 1”. Otherwise it would be mapped to “B”. So you can easily see how this can become cumbersome.

Add to the fact that, as it turns out, if you’re developing on MacOS, you have slightly different controller mapping than if you’re developing on Windows. EVEN IF YOU’RE BOTH USING UNITY AND YOU’RE BOTH USING AN XBOX ONE CONTROLLER.

To help solve this frustration and make it significantly easier, Unity has their New Input System which is much friendlier toward different operating systems and different controllers. And while it does take some time setting it all up, ultimately it is much better because it handles the different controllers and systems much more elegantly. You don’t have to write a ton of extra code. Less chance for error. More compatibility. Win. Win. Win.

Except.

The learning curve is like a vertical asymptote. (I mean not really but it sure feels that way). And if I wanted to incorporate the New Input System, it would mean rewriting and refactoring a lot of my code. This didn’t seem worth it to me for one button. Especially when I can very easily put some digital duct tape on the problem and then ship my game.

So which one do you think I ended up doing? And don’t get me wrong: I’m not saying this as a way to justify not learning the new way or not doing it the “correct” way. It is just all about balance, right? I am only targeting one platform: Steam. I want to enable controller support on Steam Deck (and desktop with an Xbox One controller). Can the pause menu be accessed via the Steam Deck? If the answer is yes, then in my opinion, it doesn’t matter how I got there.

But rest assured, for my next game (because I already have an idea cooking…), I’ll be building it with the New Input System already in mind.

Previous
Previous

Coming Soon to iOS

Next
Next

A Little Update