[Feature Suggestion] Support for new input types

Started by deadsuperhero, Wed 19/01/2022 09:11:46

Previous topic - Next topic

deadsuperhero

I wasn't 100% sure whether this fell on the side of the AGS Editor, or the Engine itself - however, I figured that since such a feature would technically be part of a runtime, it might be better to start off here.

Historically, Adventure Game Studio has shipped with support for two types of input: mouse, and keyboard. This makes sense, given that the form factor of most AGS games follow the traditional "point-and-click" form factor that we all know and love.

However, in recent years, it has been possible to port AGS titles to:
  • Android
  • iOS
  • PSP (maybe even Vita?)
Another consideration is that some games have received special ports, such as Unavowed coming to the Nintendo Switch.

My point is: it's technically possible for Adventure Game Studio to support a lot of different form factors, including devices with game controllers as well as tablets that have multitouch.
It's already possible, through the inclusion of DualName's excellent Controller plugin (via SDL), to have an AGS game that supports just about any USB game controller that the host OS can interface with.

The problem is, adapting games to use different types of input is actually pretty hard. The controller plugin works great in principle, but adapting my code to it requires a lot of thoughtful workarounds and trial and error...for example, it currently isn't possible to treat a gamepad button as a left click that can dismiss messages in the game, and trying to make arrow buttons on a pad imitate key presses has its own set of issues.

What would be really amazing, given that AGS is shifting towards being based on SDL, would be for the engine and Script API to consider native support for input types supported by gamepads and touch inputs. Here's a non-exhaustive set of examples of the kind of interactions that we could theoretically support:

Multitouch:
  • Tap
  • Tap and Hold
  • Pinch to zoom
  • Drag and Drop

Gamepad
  • Button Press
  • Button Hold
  • Menu Item Selection
  • Axis tracking
The fediverse needs great indie game developers! Find me there!

eri0o

#1
Menu Item Selection -> this is nearly impossible to get it right, I don't think we should implement it in the engine ever. This is better to leave to do so through scripting since everyone has different needs.

For your click that you mentioned you can use something like Game.SimulateKeyPress or the simulate mouse click that is in the plugin. (If you need a solution now)

Anyway, there's a ticket for gamepad input I opened here: https://github.com/adventuregamestudio/ags/issues/1364

I think UI is better left for scripting and people can update templates and create modules to take these in consideration, but forcing something directly in the engine I think is bound to not work for a lot of cases.

About touch API I am more inclined at a simple touch API and also let things be resolved through scripting. GUIs on multitouch I think may require rework, in Godot there's only one control that accepts touch input.

I did a small analysis of touch APIs here: https://ericonotes.blogspot.com/2020/11/a-quick-look-at-touch-handling-apis-in.html

Anyway, these are most of my thoughts on the topic after exploring different engines and playing around implementing the thing and seeing difficulties people have on the topic (Dear ImGui project commits has lots of insights regarding this).

eri0o


SMF spam blocked by CleanTalk