Finished the input system and working on a new UI!


Input System

I finished implementing and integrating the new input system, which utilizes keypress.js. It keeps track of input using a set/stack of keys pressed to prioritize a single action to trigger. By using this as the central input-to-action mapper, it fixes many of the bugs related to holding down different keys simultaneously. This class along with the other generic classes could be open sourced once they become more mature. These internal libraries get updated frequently, as more advanced use cases are discovered, so it would be difficult to open source now.

This input system supports other external inputs besides just keyboard input. The UI and touch/mouse input goes through this same system, to prevent multiple actions from being triggered.

Refactored all of the ui/input code, it’s much smaller and more modular now.

User Interface

I also started to implement the new UI:

Updated user interface

When pressing the buttons, they become opaque and move down.

The menu doesn’t exist yet. Also need to prevent issues with pressing buttons causing movement sometimes.

Touch Input

Touch based input needs to be more accurate and not centered around the center player instance. More on-screen buttons would work, but we’d end up with 8 buttons on the bottom, plus the menu accessible from the top. Instead of this mess, it’s possible to use a relative swiping gesture, which would only move as far as you swipe. That way, you can hold down as long as you want, and it won’t keep moving. You are also able to make multiple moves without releasing between each move. This should feel more responsive, while staying accurate, and also not needing to worry about where on the screen to press.

Public Demo

A public demo might be coming in the next few weeks, so watch out for it!