Input controls

You have a few options for input controls, when making a Blu-Play game.

What you should know about these different options, is that they behave differently on different platforms. Some with poor performance, others with great performance.

The poor performers

A keyboard connected to a Blu-ray player (if the device supports a keyboard) generally fires both KEY_PRESSED and KEY_RELEASED at the same time the instant you press a key, regardless of whether you actually released the key again or not.

The remote control does it better: It waits firing KEY_RELEASED till you actually release the key - as it should.

A keyboard connected to a PlayStation 3 or 4 will give the same behavior as a remote control connected to a Blu-ray player though.

But both the keyboard and the remote control only lets you press a single button at a time.

This means you can't press UP + LEFT for example. If you hold UP and you press LEFT, you will just continue going UP.

Sadly, we also find the gamepad for both the Xbox One and the Xbox Series X in the group of poor performers. On these consoles, the gamepad also only lets you press a single button at a time - and it's not even possible to hold the button! (It calls keyReleased instantly, despite you not actually releasing it. Go Microsoft!).

The great performers

The PlayStation 3 and 4 gamepad is a lot better: It lets you hold down several buttons at the same time, and only calls KEY_RELEASED when you actually release them - as it should. Unfortunately this doesn't apply to the directional buttons for some reason. Here again you can only press one directional button at a time. This means you can't press UP + LEFT - but you can press UP + any other non-directional (supported) button (CrossSquareL1R1L2R2).

If you don't find any of the above options good enough, you also have the option of using a Blu-Pad: A software app that lets you use your cellphone, tablet or even computer as a virtual gamepad.

The Blu-Pad is a great performer. It runs on all platforms you can think of, as long as the player/console and the phone/tablet is connected to the same LAN.

In order to use a Blu-Pad for your game, you must add support for it in your game. Some helpful source files will be available on this site in the near future.

Categories

Based on these facts we can divide user-input into 3 groups:

Class 1: Holdable multiple buttons

This is the most optimal user-input we can get. You can register multiple buttons. KEY_PRESSED will be fired for each button as the player press and hold them one by one. When you release them one by one, KEY_RELEASED will be fired for each of them too. So this class of input-controls really has no limits. Devices in this category includes the PS4 gamepad, and the PS3 gamepad.

Suitable game types: All kinds.

Class 2: Holdable single button

There's a big step down from a Class 1 to a Class 2 input-control device. Devices in this category only lets you press a single button at a time. It fires KEY_PRESSED when you press the button, and KEY_RELEASED when you lift your finger again.

Suitable game types: Simple arcade games like Arkanoid, or space shooters with auto-fire.

Class 3: Clickable single button

The absolute worst class of input-control you can find is the class 3: Only a single button can be pressed - and not held down. KEY_PRESSED and KEY_RELEASED is both fired the instant you press the button. So there's no way of knowing when the user actually releases the button.

Suitable game types: Most puzzle games, like Tetris, and "auto-moving" arcade games, like Snake and Pacman.

Overview

 Class 1:
Holdable
multiple
buttons
Class 2:
Holdable
single
button
Class 3:
Clickable
single
button
PlayStation 3DualShock III *1
Blu-Pad WiFi
USB keyboard
PlayStation 4DualShock 4 *1
Blu-Pad WiFi
USB keyboard
PlayStation 5DualShock 5 *1
Blu-Pad WiFi
USB keyboard
Xbox OneBlu-Pad WiFiXbox Controller
Xbox Series XBlu-Pad WiFiXbox Controller
Blu-ray playerBlu-Pad WiFiRemote control
DualShock 4 v1 *2
USB keyboard
Dune HD Smart D1Blu-Pad WiFiRemote control
PowerDVDKeyboard
Blu-Pad WiFi
VLCKeyboard

1 The DualShock's only lets you press one directional button at a time. But you can press all other buttons at the same time too.
2 The DualShock 4 v1 can be connected to certain Blu-ray players. See platforms.

Suitable game types

The limited user-input options for Xbox and standard Blu-ray players means there are certain game-types you can only create for the PlayStation's - if you want to stick with standard controllers.

In order for your game to be playable on Xbox and standard Blu-ray players (without using the Blu-Pads), it needs to require only one button click at a time.

Luckily there are many game-genres that can be done under those requirements. Tetris and Snake comes to mind. But you're free to choose to only target the PlayStation consoles.

If you add Blu-Pad support for your game though, you're pretty much limitless. You can even develop your own input controls using the same technique as the Blu-Pads. For example, turn your phone into a touchpad, and/or make the game react to the phone accelerometer.

Keycodes

Here you can see an overview of the buttons on the gamepads and their corresponding keycodes.

PlayStation 3PlayStation 4Xbox OneKeycodeRemote control
LeftLeftLeft37Left
UpUpUp38Up
RightRightRight39Right
DownDownDown40Down
CrossCrossA button10Enter / Select
SquareSquareMenu button461Popup Menu
Not supportedCircleX button19Pause
StartNot supported415Play
L1L1LB424Previous track
R1R1RB425Next track
L2L2LT412Rewind
R2R2RT417Fast forward

Gamepad buttons placement

As you can see, most buttons on the gamepads share the same locations and keycodes. There are a few exceptions though:

On PlayStation 3 and 4, the square button is mapped to keycode 461. If the buttons should match on the Xbox One gamepad, then the X button should have had the same keycode, but it doesn't. Instead, the X button on the Xbox One gamepad is mapped to keycode 19. The button assigned to keycode 461 is the menu () menu button, which is placed too far away to be useful in a game.

On PS4 keycode 19 is assigned to the circle button, which is placed to the upper right in relation to the cross button - i.e. the opposite side as the X button relative to the A button on the Xbox One. Meanwhile, the PS3 doesn't even have a button mapped to keycode 19.

One solution, if you wish to give the same controls on both platforms, is to assign both keycode 461 and 19 to the same action in your game. That way, the square button on the PlayStations and the X button on the Xbox One does the same thing. This of course also means that both the square button and the circle button does the same thing on the PlayStation 4.

Another solution is to offer a "Redefine control buttons" option in your game. That way your players can decide for themselves what buttons to use.