
implement control remapping, adjustable game speed and adjustable, readable text in Godot, saved between sessions, apply typography principles to player-facing text, and explain how each option removes a barrier.
Instruction
Accessibility options are ordinary code: variables, input handling and a saved file. Today you will build three that remove common barriers, and save them so players set them once. (Built with the Godot documentation’s pages on InputEvent, InputMap and ConfigFile, CC BY 3.0.)
1. A settings autoload. Settings must survive scene changes and restarts, so they live in an autoload named Settings that reads and writes a ConfigFile in user://, a folder Godot provides for each game’s saved data:
extends Node
const PATH := "user://settings.cfg"
var game_speed: float = 1.0
var text_size: int = 24
func _ready() -> void:
var config := ConfigFile.new()
if config.load(PATH) == OK:
game_speed = config.get_value("access", "game_speed", 1.0)
text_size = config.get_value("access", "text_size", 24)
func apply() -> void:
Engine.time_scale = game_speed
for node in get_tree().get_nodes_in_group("readable"):
var label := node as Label
if label:
label.add_theme_font_size_override("font_size", text_size)
func save_settings() -> void:
var config := ConfigFile.new()
config.set_value("access", "game_speed", game_speed)
config.set_value("access", "text_size", text_size)
config.save(PATH)Put every Label that players must read in the group readable, and call Settings.apply() at the end of each level’s _ready() so the settings take effect whenever a level loads.
2. Game speed. Engine.time_scale scales the passage of game time: physics, timers and animation. At 0.75, a hazard that gives players a 4-second window now gives them 4 ÷ 0.75 ≈ 5.3 real seconds, which can make timing-heavy sections playable for someone with slower reactions. A slider connects to it:
func _on_speed_slider_value_changed(value: float) -> void:
Settings.game_speed = value
Settings.apply()
Settings.save_settings()
speed_label.text = "Game speed: %d%%" % roundi(value * 100.0)Set the slider’s range to 0.5-1.0 with a step of 0.05. %% prints a literal percent sign.
3. Remapping a control. Because your game reads named actions such as jump, remapping only has to change which key the action uses. This button waits for the next key press and assigns it:
extends Button
@export var action: StringName = &"jump"
var waiting: bool = false
func _ready() -> void:
pressed.connect(_on_pressed)
update_text()
func _on_pressed() -> void:
waiting = true
text = "Press a key..."
func _unhandled_input(event: InputEvent) -> void:
if waiting and event is InputEventKey and event.is_pressed() and not event.is_echo():
InputMap.action_erase_events(action)
InputMap.action_add_event(action, event)
waiting = false
update_text()
get_viewport().set_input_as_handled()
func update_text() -> void:
var events := InputMap.action_get_events(action)
var key_name: String = "none"
if events.size() > 0:
key_name = events[0].as_text()
text = "%s: %s" % [action, key_name]This simple version replaces all of the action’s bindings, including any gamepad button; a fuller version would erase only the keyboard event, and would save the new key in the settings file as well. Those are good extension tasks.
4. Typography for readable game text. A larger size helps only if the text was set well in the first place. The same principles that guide print and web typography apply to labels, menus and subtitles:
- Typeface. Use a clear sans-serif with open, distinct letter shapes, so that I, l and 1 or O and 0 cannot be confused. Save decorative or script fonts for a title, never for instructions or subtitles. If you change Godot’s default font, use one whose license (such as the SIL Open Font License) allows it, and credit it.
- Case and weight. Mixed case reads faster than ALL CAPITALS, because word shapes help recognition; keep capitals for one- or two-word labels. Very thin strokes disappear at small sizes and low contrast.
- Contrast and background. Text over busy art needs help: a semi-opaque panel behind it, or an outline (in the Inspector, Theme Overrides > Constants > Outline Size, with Colors > Font Outline Color). WCAG 2.2 asks for a contrast ratio of at least 4.5 to 1 for body text and 3 to 1 for large text, which it defines as at least 18 point, or 14 point bold.
- Spacing and line length. Crowded lines are hard to track. Theme Overrides > Constants > Line Spacing adds space between lines; WCAG’s text-spacing test uses a line height of at least 1.5 times the font size as its benchmark. Keep subtitle lines short (two lines at most on screen) and left-align or center consistently.
- Hierarchy. Use size and weight, not many colors, to show what matters: one size for headings, one for options, one for help text.
Test the result at the largest text size in your slider: WCAG’s resize-text criterion expects text to scale to 200 percent without loss of content, so nothing should be cut off or overlap.
Design the settings screen for access too. It must itself be usable with the keyboard alone (call grab_focus() on the first control so arrow keys move between options), have readable text and plain labels, and be reachable from the pause menu, not only from the title screen.
Write a feature note for each option: what barrier it removes, who benefits (including situational uses) and how you tested it. Professional release notes describe accessibility features this way, and players rely on them to decide whether they can play.
📖 Read for this lesson
The reading opens over the lesson; close it to come back to exactly where you were. The checks below draw on it.
Build: Three saved accessibility options
Question. Can you implement remapping, adjustable game speed and adjustable text size so that each works, persists after restarting the game, and removes a barrier found in your accessibility audit?
Materials
- Your level project in the Godot 4 desktop editor (4.3 or later)
- Your accessibility audit from Lesson 2.3
- Kenney UI pack (CC0) for buttons and panels, optional
- A family member or other adult you know for testing (optional; otherwise a self-test after a break)
- Keep ergonomic habits and 20-20-20 breaks.
- Back up the project before adding autoloads and before changing the Input Map at run time.
Procedure
- Create the Settings autoload and add every player-facing Label to the group readable. Call Settings.apply() at the end of your level’s _ready().
- Build a Settings scene (Control root, VBoxContainer) with an HSlider for game speed (0.5-1.0, step 0.05) and its label, an HSlider or buttons for text size (18-40), and a RemapButton for jump. Connect the signals.
- Call grab_focus() on the first control in _ready() and check the whole screen can be used with the keyboard alone.
- Test each option in play: time how long a timed hazard’s window lasts at speed 1.0 and 0.75; remap jump to another key and play; raise the text size and check nothing overflows its box. Then apply the typography rules: a clear sans-serif in mixed case, an outline or panel behind any text over art, added line spacing, and three sizes at most for heading, options and help.
- Close and relaunch the game, and confirm game speed and text size were saved.
- Ask a family member or other adult you know to use the settings screen without help (or, if no one is available, come back after a break and use it with the keyboard only), and record any difficulty. Write a feature note for each option, including the typography changes.
Data
| Option | Test | Expected | Observed | Saved after relaunch? |
|---|---|---|---|---|
| Game speed 0.75 | Timed window of 4 s | ≈ 5.3 s real time | ||
| Remap jump | Jump with new key | Jumps; old key does nothing | (extension) | |
| Text size 36 | All readable labels | Larger, no overflow | ||
| Typography | Labels at text size 40 over the level art | Clear font, mixed case, outline or panel, nothing cut off | — |
Analysis
- Which barrier from your Lesson 2.3 audit does each option remove, and who else benefits from it?
- What happened to gamepad controls after remapping, and how would you change the code to keep them?
- Did your tester (or you, in the self-test) find and use the settings without help? What would you change about the screen itself, including its typography?
If you cannot do this build in person: Without Godot, design the settings screen on paper with every control labeled, write the three scripts by hand with comments explaining each line, and calculate the real-time length of 2-, 4- and 6-second windows at game speeds of 0.5, 0.75 and 1.0.
Formative check
Work through these before moving on. They are not graded — they tell you whether the standard below has landed yet.
At Engine.time_scale = 0.5, a 3-second timed window lasts real seconds; at 0.75 it lasts real seconds.
Why does the remap button call get_viewport().set_input_as_handled() after assigning the new key?
Settings saved with ConfigFile in user:// are still there after the player closes and reopens the game.
Missouri standard: MM.FND.6
A subtitle is set in a thin, decorative all-capitals font at 18 px, directly over a busy forest background. Which revision best applies typography principles for readable game text?
How confident are you that you can implement saved remapping, game-speed and text-size options?
Practice
Work these on paper or in your notebook, then open Check your answer. Aim for all of Fluency and Application; try at least one Challenge.
Printable version: this unit’s practice workbook (PDF)
Fluency
Build speed and accuracy with the core skill.
- What do these do: Engine.time_scale, ConfigFile, user://, InputMap?
Check your answer
Answer: time_scale scales the speed of game time (physics, timers, animation); ConfigFile reads and writes simple settings files in sections and keys; user:// is the folder Godot provides for each game’s saved data; InputMap stores which keys trigger each named action and can change them at run time.Together they make the settings persistent and the controls remappable. - Give the WCAG contrast ratios the lesson cites for body text and large text, and how WCAG defines large text.
Check your answer
Answer: At least 4.5 to 1 for body text and 3 to 1 for large text; large text is at least 18 point, or 14 point bold.Text over busy art needs an outline or a semi-opaque panel. - Name three typography choices that make game text readable.
Check your answer
Answer: Any three: a clear sans-serif with distinct letters (I, l, 1; O, 0); mixed case rather than all capitals; no very thin strokes; an outline or panel behind text over art; added line spacing (at least 1.5 times the font size); short subtitle lines (two at most); hierarchy by size and weight, not many colors.Decorative or script fonts are for titles only.
Application
Use the skill in context. Show your reasoning.
- At Engine.time_scale 0.6, how long in real seconds is a 4-second timed window? A 3-second window?
Check your answer
Answer: About 6.7 s; 5 s.Real time = game time ÷ time_scale: 4 ÷ 0.6 ≈ 6.67 and 3 ÷ 0.6 = 5. - The speed slider is at 0.85. What does “Game speed: %d%%” % roundi(value * 100.0) display? Why are there two percent signs?
Check your answer
Answer: Game speed: 85%. %% prints a literal percent sign; a single % would start a placeholder.0.85 × 100 = 85, inserted by %d. - The text size is 24. What is the minimum line height WCAG’s text-spacing benchmark suggests, and what size must text reach without loss of content under the resize-text criterion?
Check your answer
Answer: 36 (1.5 × 24); 48 (200 percent of 24).1.5 × 24 = 36. 2 × 24 = 48. At the largest slider size, nothing should be cut off or overlap. - Code reading: after a player remaps jump with the lesson’s button, their gamepad no longer jumps. Which line causes it, and what would a fuller version do?
Check your answer
Answer: InputMap.action_erase_events(action) erases all of the action’s bindings, including the gamepad button. A fuller version would erase only the keyboard event (and save the new key in the settings file).The lesson names both as extension tasks. - Write a feature note for the game-speed option: the barrier it removes, who benefits (including a situational use) and how you tested it.
Check your answer
Answer: Model: “Game speed (50-100%) slows physics, timers and animation, so timing-heavy sections are playable for players with slower reactions or limited dexterity; it also helps anyone learning a hard section or playing one-handed. Tested: a 4-second hazard window lasted about 5.3 s at 75%, and the setting was still there after relaunching.”A strong note names the barrier, the beneficiaries and a test with a result.
Review
Keep earlier skills sharp.
- Review (Lesson 2.3): which audit area does each option address: remapping, game speed, text size?
Check your answer
Answer: Remapping: motor. Game speed: motor and cognitive (more time). Text size: vision (and cognitive readability).Each option should remove a barrier found in the audit.
Accessibility Options: Speed Arithmetic, Remap Rules and a Feature Note
SLS original technique sheet; arithmetic uses the lesson’s code values · SLS original
Why this reading. The workshop asks you to build remapping, game speed and text size. This technique sheet adds the arithmetic behind each option, the saved settings file you should see after relaunching, a filled test record and a model feature note. SLS original.
Game speed: real-time window = window / time_scale
| Window (game s) | Speed 1.0 | Speed 0.75 | Speed 0.5 |
|---|---|---|---|
| 2 | 2.00 | 2.67 | 4.00 |
| 4 | 4.00 | 5.33 | 8.00 |
| 6 | 6.00 | 8.00 | 12.00 |
Check against the lesson’s 3-second window: 3 / 0.5 = 6 s and 3 / 0.75 = 4 s. Note that time_scale also slows music and sound effects unless you handle audio separately.
Remap table (what should happen)
| Action | Default | After remap | Old key does | Conflict rule |
|---|---|---|---|---|
| jump | Space | K | Nothing | If K is already used, swap the two actions |
| pause | Escape | P | Nothing | Escape stays as a second binding |
Text size: will it fit?
Rule of thumb (illustrative): average character width is about 0.5 x font size. The button text Press a key… has 14 characters. At 24 px that is 14 x 12 = 168 px; at 36 px it is 14 x 18 = 252 px. In a 240 px button, size 36 overflows, so widen the button to at least 260 px or wrap the text.
What settings.cfg should contain after saving (illustrative)
[access]
game_speed=0.75
text_size=36
If relaunching shows 1.0 and 24, save_settings() was never called or the file path is wrong.
Filled test record and model feature note
| Option | Test | Observed | Saved after relaunch? |
|---|---|---|---|
| Game speed 0.75 | 4 s window timed | 5.4 s | Yes |
| Remap jump | Jump with K | Jumps; Space does nothing | No (extension) |
| Text size 36 | All readable labels | Larger; Back button clipped | Yes |
Feature note: Game speed lets players with slower reactions, or anyone on a noisy bus, play timed sections at 50 to 100 percent speed. It removes the audit’s timing barrier. Tested by timing a 4 second window at 0.75: 5.4 s observed against 5.33 s expected.