[h1]Cats vs. Aliens Caturday Update #4[/h1]
[h2]Hello and welcome, Invaders![/h2]
This week, I didn’t do too much new, so let’s talk about something I did a while ago: implementing the Steam Input API!
P.S. It's been a long week in my household, and my brain is rebelling, so this one might be rambley. Oh well. At least I got it done. I'll try again next week!
[h2]What is this “Steam Input API”?[/h2]
The Steam Input API is Valve’s input system which allows any controller you’re using (that’s in one of the [url=https://partner.steamgames.com/doc/features/steam_controller/getting_started_for_players]six supported device categories[/url]) to be able to show the correct input glyphs and remap actions within the game to any button.
Some of you may be familiar with this idea, but in case you’re not, an “action” in a game is not the same thing as a button press. Some games have hard-coded which button presses do what things directly in their code, so they are listening for the A button to be pressed, and then do something when it is. That approach can be useful for being able to rigidly control how input is received, but it limits a player to only using your prescribed controller layouts.
Steam Input (and Cats vs Aliens) listens for “used a health potion” or “paused the game” instead of “B was pressed”. This way, you get to decide which button tells the game to “use a health potion”, allowing YOU to take full control of your controller. However you want to play, whatever setup is comfortable for your hands, that’s how you can play.
It’s -very- powerful.
And it was a pain to implement.
[h2]What was hard about it?[/h2]
First, there is the matter of the documentation being somewhat obtuse. It’s hard to find what you need, some things are out of date, etc. It very much reads as though Valve set it up years ago and then just… forgot about it. So it’s difficult for a first-time-game-maker like myself to really dig through the docs and get my head around what calls are available to be used and when they should be used.
Then there’s also the matter of how few folks using Godot have put their hands on this API. The wonderful Gramps of GodotSteam has put together a precompiled version of the Godot Engine that I’ve been using and has been very patient with all of my questions, but the fact remains that I’m still having to do a lot of trial-and-error to piece this together because the wealth of tutorials I’m used to seeing out there just don’t exist when it comes to Godot and Steam Input.
But I kept at it and it’s working now! One of these days I’ll get around to making a video tutorial about it, but definitely not before I get the Cats vs Aliens demo out to you fine folks.
My main struggle now is nailing down a process for updating the Official Configuration for controllers. I’m always scared I’m going to totally break the input whenever I try to update it (which I’ve done before… a lot... like we’re talking totally borked to the point where Steam couldn’t even recognize whatever I did as a valid configuration). Once I have that process figured out and documented, though, I’ll be able to add any and all actions that I may need in this and future projects! It’s an exciting place to be.
[h3]What’s next?[/h3]
Hopefully this coming week will allow me more time to keep chipping away at the feedback from the play test, making teensy steps closer to the demo with every passing day.
Next up on my list is finishing the three biomes that are already playable by adding biome-specific enemy types and adding more harvest node types. Also more variety in map chunks. And random event spawns. And maybe two bosses.
There’s a lot left to do, but with any luck at all I’ll be able to make next week count!
[h1]Happy Invading! [/h1]