Rolly Docs

Set up control presets, swaps, keyboard layouts, touch and Steam Deck

Offer whole sets of keys to pick from, let left-handed players swap the sticks and shoulder buttons, keep keys where they belong on AZERTY and QWERTZ keyboards, tune the on-screen touch controls, and give a Steam Deck defaults of its own.

Sheet
23 of 45
Rev
1.2.0
Updated
On this sheet

The built-in library’s Controls category puts Control Preset and Match Keys to Keyboard above the key list, Swap Sticks in Sticks, Swap Shoulder Buttons in Controller, and the touch rows in a Touch section at the end. Each row shows only while it can change something; the sections below say when.

Figure 1. The top of Controls on an AZERTY keyboard: the Classic preset with two keys changed, Z and Q where W and A sit on a US keyboard, and the triangle on a button two actions share.

Offer control presets

A control preset is an Enhanced Input key profile: the keys a mapping context gives each action under that profile.

  1. In each mapping context, add an entry to Mapping Profile Overrides per preset: the key is the preset’s id (Classic), the value the context’s mappings with the preset’s keys. Contexts without an entry use their own mappings for every preset.
  2. Project Settings > Plugins > Rolly Settings > Control Presets: one entry per preset with its Profile Id, the Display Name players read and an optional one-line Description. The Control Preset setting offers them in this order, and the first is the default: a player without a key file starts on it. When your code registers the contexts that make the first preset after the player’s first controller, the player moves to it once they are registered, unless the player changed a key before. Enhanced Input’s own profile (InputUserSettings.Profiles.Default) is called Standard and comes first unless you list it; a preset without an entry shows its id, and development builds report it.
  3. The row shows once two presets exist, and changing it switches every key at once; the key list under it changes in place, so focus stays on the row.

The detail of the row gives the preset’s description, the actions whose keys differ from the default preset (“Differs from Standard: Sprint, Crouch, Throw and 1 more.”), and how many keys the player changed in it. Each preset keeps the keys the player changes in it, and Enhanced Input saves the active preset with the keys, so Rolly Settings stores nothing for this setting. A Reset of Controls keeps the preset and puts its keys back. Author presets for the right hand: a preset that is already left-handed mirrors back under the swaps below.

Let players swap sticks and shoulder buttons

Swap Sticks moves with the right stick and turns the camera with the left; Swap Shoulder Buttons swaps LB with RB and LT with RT (L1 and R1, L2 and R2 on a PlayStation pad). Both mirror the player’s gamepad keys, stick clicks and stick directions included, so they work with any action. Menus keep their navigation: the left stick and the D-pad move focus, and LB and RB switch categories.

  • Swap Sticks shows only while every stick mapping of the registered contexts is player mappable: give each stick mapping Player Mappable Key Settings with a Name (the key list shows it read-only). A stick a fixed mapping holds would stay while its partner moves, so the row hides instead.
  • Swap Shoulder Buttons shows while one shoulder or trigger mapping is player mappable. A fixed mapping keeps its button: when the swap moves another action onto it, the swap row warns (“RB is now used by Sprint and Ping. Change one in the key list.”) and both keys show the triangle.
  • The swaps are the player’s preferences: a switch to another preset mirrors that preset’s keys too, and a Reset of Controls turns both off. A moved key counts as unchanged (no Pending dot) and its detail says “Swap Sticks moved this.”
  • Keys move only when the player turns a swap on or off, or when keys arrive still at their context defaults (a context registered later, a reset row). Keys the player sets stay where the player set them: two triggers flipped by hand stay flipped after a map load, and turning a swap on and off again gives back exactly the keys from before, also the keys of a context your code has not registered at the time (a vehicle’s, while the player is on foot). Which swaps each preset’s keys carry, and which mappings they reached, is kept per player as KeySwaps in [RollySettings.Player.<n>.Meta] of RollySettings.ini.
  • The Stick modifiers sit on the mappings, so stick settings follow the stick by job: with Swap Sticks on, the Movement Stick rows apply to the right stick. Test Sticks labels its views by the stick each job is on.

Keep keys where they belong on every keyboard (Windows)

Enhanced Input names letter keys by the character they type, so W is a different key on an AZERTY keyboard, where it sits at the bottom left.

  • Names. Every key cap, fact and question names a key by the character it types on the keyboard layout in use, upper case for letters, and number-row keys by their digit (“1” on AZERTY, where that key types “&” first). An action on the engine’s own digit key that the layout types elsewhere reads “1 (US)”, so it never shares a name with the number-row key. Names change at once when the player switches layouts (Alt+Shift).
  • First start. The first time a player’s keys meet a keyboard layout, the keys still at their defaults move to the keys at the same places: W A S D become Z Q S D on AZERTY, and Y and Z trade places on QWERTZ. A default stays where its place holds no key the engine always knows (a letter only that layout has), a reserved or fixed key, or a key another action of its conflict group keeps. Moved keys count as the defaults: no Pending dot, the Default fact names them (“Default: Z.”), and Reset returns to them. Each key moves once per preset: one the player later sets back to its context default (M for a map on AZERTY, where the comma sits at M’s US place) stays there through map loads, new contexts and restarts, until its row is reset. A key whose place was taken stays at its default and moves once the place is free.
  • Later layout changes never move keys. Match Keys to Keyboard shows while matching would move a key, moves the keys the player has not changed, says “Keys match this keyboard.” and hides.
  • Keys this keyboard lacks (the backtick on AZERTY, the US digit keys as “1 (US)”) show the triangle: “` is not on this keyboard. Change it to a key you have.”

The layout the keys were matched to is kept per player as KeyboardLayout in [RollySettings.Player.<n>.Meta] of RollySettings.ini, and the keys the first start moved for it, per preset, as KeyboardLayoutReached. Other platforms keep the engine’s key names and move nothing; Match Keys to Keyboard shows on Windows only.

Tune the touch controls

The Touch rows change the engine’s on-screen controls (Project Settings > Engine > Input > Default Touch Interface, or the interface your game activates): Touch Control Opacity, Touch Control Size, Left-Handed Touch Controls (joystick on the right, buttons on the left) and Touch Look Sensitivity. They show while the engine shows on-screen controls (on Windows, with Project Settings > Engine > Input > Always Show Touch Interface or -faketouches) and an interface is known; Touch Look Sensitivity only while the interface has a camera stick, a stick that sends the right stick’s axes.

  • The player’s values go to a copy of the interface, which the player’s controller shows; every new controller gets it again. The controls hide while the player uses a gamepad and while a Rolly Settings screen takes input, so they never take touches meant for a menu.
  • When your game activates an interface of its own (a vehicle’s), pass it to Use Touch Interface on the Rolly Settings Subsystem instead of Activate Touch Interface, so the player’s values apply to it. None goes back to the interface the controller shows.
  • A preview under the rows draws the interface’s controls as outlines, at their places and sizes with the player’s values, so players see the controls while the menu hides them.
Figure 2. The Touch section in a phone-sized window (820 x 380), scrolled to the preview: controls at 120 % and 60 % opacity, mirrored for the left hand.

Give a Steam Deck its own defaults

Rolly Settings knows a Steam Deck from, in order: the console variable rollysettingscore.steamdeck (1 or 0, for testing), the answer your game gives, then the SteamDeck environment variable Steam sets in Game Mode, the engine’s handheld check and the Deck’s processor. Other handheld PCs pass the engine’s handheld check and get the same defaults. A Deck starts with gamepad prompts.

The Steam API knows for sure, also on a handheld PC that the detection counts as a Deck. With the Steamworks SDK in your game module (AddEngineThirdPartyPrivateStaticDependencies(Target, "Steamworks") in its Build.cs), give its answer once Steam is initialised. It may arrive after the settings started: defaults then follow it, and values still at the first start’s default take the new one, Shared settings included.

#include "Platform/RollySettingsCoreSteamDeck.h"
#include "steam/steam_api.h"

void UMyGameInstance::Init()
{
	Super::Init();
	if (SteamUtils() != nullptr)
	{
		FRollySettingsCoreSteamDeck::SetAnswer(SteamUtils()->IsSteamRunningOnSteamDeck());
	}
}
C++

A setting’s Platform Defaults and Platforms take SteamDeck as a key, which wins over the platform: a default for a Deck, or a row only a Deck shows. A Deck default also seeds the first start of a value the engine saves itself (GameUserSettings), in the built-in library too. Its Default fact says where it comes from: “Default on Steam Deck: 30.”, or “Default on this handheld: 30.” on another handheld PC that only the engine’s handheld check counts. The built-in library gives one row a Deck default, Menu Frame Rate Limit 30, so menus save battery and play is untouched. Defaults for play stay yours; for example, in a collection made from the defaults:

Setting Platform Defaults
Overall Quality SteamDeck = Medium
Frame Rate Limit SteamDeck = 30 (Valve asks for a default that plays at 30 frames per second at 800p)
Resolution leave it: the Deck’s native 1280 x 800 is the monitor’s native size

A value the player chose, or one saved before this start, keeps its value whatever the answer says. Text needs no change: at 1280 x 800 the screen lays out at a DPI scale of 0.74, and its smallest text measures about 16 pixels, above the 12 Valve recommends.

Figure 3. Display on a Steam Deck at 1280 x 800: Menu Frame Rate Limit at 30, with the Deck's default named.

Add a preview of your own settings

A setting’s Preview Widget names a live preview the settings screen shows after the last visible row of the settings that name the same class: the touch layout is one. For a crosshair preview after your crosshair rows:

  1. Make a Widget Blueprint whose parent class is Rolly Settings Preview.
  2. In On Refresh Preview, read the player’s values from Get Player Settings (Get Float Value, Get Option Value) and draw them. It runs when the preview shows, on every change of a value (values that wait for Apply included) and when the room changes. Get Room gives the list’s width and the height it shows at once, and Get Row Height the height of the tallest of its rows: a preview no taller than the room’s height less that height shows beside the focused row.
  3. Name the class in each crosshair setting’s Preview Widget.

The preview never takes focus, hides while those rows are all hidden, and the list keeps it in view with them while both fit. A list too low for all those rows and the preview at once shows the preview after the focused one of them instead, where the two fit together.

Nodes and C++

Node Notes
Use Touch Interface The touch interface the player’s touch values apply to; None goes back to the controller’s

In C++: FRollySettingsControls (from URollySettingsSubsystem::GetControls) switches presets (SetActivePreset), sets the swaps and matches keys to the keyboard; FRollySettingsTouch (from GetTouch) holds the player’s touch values; FRollySettingsCoreKeyboardLayout names keys and tells layouts apart; FRollySettingsCoreSteamDeck decides whether the game runs on a Deck.

What the checks report

On save: a Control Preset, Key Swap, Match Keys to Keyboard or Touch Controls binding on the wrong kind or on a Shared setting (errors), and a Control Preset without Options From Binding (warning). While the game runs: a key profile without a name in Project Settings, a Preview Widget that is not a Rolly Settings Preview class, and a player controller without the Current Touch Interface the touch rows read (warnings).

Limits

  • No drag editor for the touch controls: players change their opacity, size, hand and look speed, not where each control sits.
  • Keys follow the keyboard layout on Windows only. A layout’s letters that the engine names by character (ö, ü) exist only while that layout is in use, so defaults never move onto them.
  • Not yet checked on real hardware: AZERTY and QWERTZ keyboards, a Windows touch screen, and a Steam Deck. The automated tests cover the rules with test layouts, Always Show Touch Interface and the Deck’s detection facts.