The big thing I’m trying to figure out: how do I make game controller support work in my Adventure Game Studio template?
Trying to clean up some of my misunderstandings of some third-party plugin that was designed to handle controller input. My hope is to release a template that makes adapting AGS games really easy for Steam Deck.
There are a couple of limitations that I have to figure out:
As a game engine, there is no native support for controllers. The plugin works pretty good, but it’s an external consideration to how the core of the engine works.
Because of this, peripherals other than a mouse and keyboard have to rely on code that can get blocked by other core functions of the engine. The big one is the Display() function, which is used to show boxes full of text to the player - it’s designed to block everything going on to pause the game, so that the player can read it. What this means is that you can’t dismiss the text boxes with a controller! So, I’ll have to implement my own as a workaround, until the engine gains support for it.
The documentation is sparse, and there’s no public examples of how to get this plugin to work. I’ve managed to get something half-working, but my understanding is incomplete.
My current implementation is always being polled by the game engine, to know when controller input is updated. The downside of this approach is that I’m using a joystick to move the controller, and I haven’t figured out how to just make the mouse cursor stop and sit in one place after I’ve moved the stick. Right now, it’s like there’s a huge rubber band attached to the mouse pointer, which is not ideal.
There isn’t a native way to “select” a button in the GUI, because buttons were designed with the assumption that you’d just click them. Theoretically, this can be coded around using button ID numbers and some kind of iteration loop that cycles through them.
Moving the character with either the stick or buttons is kind of a hack, because moving the character with a keyboard is also a hack that uses an undocumented Type called Vector, that is described nowhere in any AGS documentation ever. It’s used to basically make the character keep walking as long as the key is held down, in the script that ships with every base template ever.