Fall of 21XX v1.2 – Gamepad Support

Fall of 21XX gets gamepad support and some other usability enhancements.

Major changes

  • Gamepad support.
  • Added Gamepad Settings menu. Buttons can be remapped.
  • The Settings menu can be called at any time during the game.
  • Choose the difficulty right before the game starts.

Read after the break for more details.

Gamepad support

The gamepad support relies on the web browser on your device. I have tested the following configurations:

OSBrowserGamepad
Windows 10Chrome, Firefox and EdgeLogitech F310 (USB-A)
Xbox Wireless Controller (Bluetooth)
Android 13ChromeWired (USB-C) and Xbox Wireless Controller (Bluetooth)
Razer Kishi
macOS SonomaSafari, Chrome and FirefoxXbox Wireless Controller (Bluetooth)

A recent gamepad model should probably work fine on any platform with a web browser that supports modern web standards.

The highlight for me is finally being able to play on the go with a smartphone. The Xbox controller works fine, but if you want an experience closer to the Nintendo Switch, you could try using something like the Razer Kishi.

Razer Kishi Demo

You can play, pause, exit the game, and navigate any menu interface using the gamepad. Touch navigation and keyboard controls are still available if you need them.

To play fullscreen, right-click (or long press) the game and select the Enter fullscreen option. On my tests, the gamepad worked fine in fullscreen mode.

Technical Details

The Gamepad support is possible thanks to the following components:

  • ExternalInterface
  • W3C Gamepad Specification
  • Ruffle and RufflePad

ExternalInterface is an ActionScript-JavaScript integration technology released when the Flash Player was at its height of popularity.

The W3C Gamepad specification came along much later, possibly by a decade when Flash Player was already struggling to survive. And still, you have to factor in many more years for browser vendors to pick it up. I don’t think it was on anyone’s radar for this spec to work with Flash. Thus, I never got to look much into it.

Fast forward many years, and Ruffle shows up to replace the now-defunct Flash Player. But will the ExternalInterface-Gamepad combo work? After all, Ruffle is a newcomer with many unknowns. Luckily, I found on GitHub a project called RufflePad that demonstrated the integration was indeed possible.

Having validated the viability of this integration, it was just a matter of sitting down and making changes in the original game codebase to get it to work to the best of my ability.

Results

The results are very nice, and you can switch between the gamepad and keyboard controls seamlessly at runtime. Just press a button/key of the wanted input device at any moment and the game will detect it and switch to that input method.

Settings Menu

Another pet peeve of mine was the inability to change the game controls while playing. Before, this was only possible from the Main Menu, forcing you to quit the game if you did not like the current control layout. Those days are over. Just hit ENTER or the START gamepad button to access the Settings menu and make any controller changes you want. The changes are persisted even if you quit the browser.

Gamepad Settings

With so many gamepad models in the market available over the years, there was no way I could possibly test them all, so I had to narrow it down to whatever the W3C spec supported.

You can see the assumptions the W3C Gamepad spec makes about the button layout in the following image.

Source: W3C Gamepad

I don’t know if every manufacturer follows this spec to the letter. The spec assigns button codes to the expected button’s physical location.

Since I did not want to show button codes, I am mapping them to button labels that match the Xbox/PC platform buttons.

This means the game won’t display, for example, a PlayStation controller’s labels: triangle, square, etc. I don’t think I can even detect what particular brand of gamepad you are using. Anyway, if your platform of choice can map the buttons of your gamepad to codes similar to the W3C Standard Gamepad, I think it will work fine.

Unlike Keyboard Settings, there is no option to change the gamepad buttons that define the left and right movement of the character. This is just the same pattern of existing Mega Man X games, but seriously, why would you want to change that anyway?

Difficulty Setting

I have noticed in many modern platformers that they show the Difficulty setting right before starting the game. This was very evident in first-person shooters, so not sure why it caught my attention only recently. Since I was making so many menu changes, I decided to move things around and change the menu structure to have this setting available in a similar fashion.

Conclusions

That was quite the multi-year story arc that spanned technologies come and gone. I wouldn’t go through the trouble of making these changes if it weren’t because the game depends now mostly on open-source projects and web standards.

Given these prospects, it is nice to know that the game will be playable well into the future without much friction and on a wide range of platforms.

Who knows, maybe it will even reach levels of compatibility similar to running DOOM on anything.

On a side note, on December 17th, 2023, it’s the 30th anniversary of ROCKMAN X‘s initial launch in Japan. Happy anniversary!