Godot Input Map Generator: Keyboard and Gamepad Actions

Start from a platformer, top-down, FPS or menu preset, add or remove actions, and bind keys, mouse buttons, gamepad buttons and stick directions with their Godot names. You get a GDScript autoload that registers the actions with InputMap when the game starts, and the project.godot [input] section in the exact text format Godot 4 writes, ready to copy or download.

Step 1 of 3: Actions
Start from a preset (this replaces the list below):
Actions (6)
  • 4 bindings
  • 4 bindings
  • 3 bindings
  • 4 bindings
  • 2 bindings
  • 2 bindings

How to use it

  1. Pick a preset (Platformer, Top-down, First-person shooter or Menu and UI), rename or remove actions, type a name and press Add action for new ones, then press Next.
  2. For each action, use + Add input to bind keys, mouse buttons, gamepad buttons or stick directions, remove any with the x, set the deadzone, then press Next.
  3. Choose GDScript autoload, project.godot [input] section or Both, choose how keys match, and press Generate input map.
  4. Press Copy or Download for each output and follow the numbered steps under it.

Autoload or project.godot: which to use

Actions saved in project.godot are what the Project Settings > Input Map tab edits, so pasting the [input] section is the way to go if you want to keep tweaking bindings in the editor. Each action is stored as a dictionary with a deadzone and a list of InputEvent objects. The section this tool writes was compared byte for byte with the text Godot 4.7 itself saves for the same actions.

The autoload calls InputMap.add_action(action, deadzone) and InputMap.action_add_event() for every binding when the game starts. It is plain code, so it is easy to review in version control, share between projects or extend with a rebinding menu, but the actions it adds do not show up in the Input Map tab. It erases any existing action with the same name first, so the script is the single source of truth.

Either way, every event uses device -1, which Godot treats as all devices, the same value the Input Map editor uses for new events. Without it, a joypad event created in code only listens to device 0, the first controller.

physical_keycode vs keycode

Godot 4 key events can match in three ways. physical_keycode is the position of the key on a US QWERTY keyboard, which the class reference recommends for game input such as WASD movement: on a French AZERTY keyboard the same physical keys are ZQSD, and the controls still sit under the player's left hand.

keycode is the Latin label printed on the key in the current layout, meant for shortcuts like Ctrl + S. Use it when the letter matters more than the position, such as I for inventory or M for map. The third option, key_label, is the localized label and is meant for showing key prompts rather than matching input. This tool sets either physical_keycode or keycode and leaves the other at 0, following the rule that an event mapping should set only one of them.

Deadzones and stick directions

Each action has one deadzone between 0 and 1: a stick or trigger must move past it before the action counts as pressed. Above the deadzone, Input.get_action_strength() rescales the rest of the range to 0 through 1, so with a deadzone of 0.2, a stick pushed 60% of the way gives a strength of 0.5. InputMap.add_action() defaults to 0.2 since Godot 4.4 (it was 0.5 in 4.3); this tool always writes the value you choose.

A stick has two axes and each action listens to one direction of one axis. Up on the Y axis is negative, so move_up binds JOY_AXIS_LEFT_Y at -1.0 and move_down binds it at 1.0, the same as Godot's built-in ui_up and ui_down actions. Triggers (JOY_AXIS_TRIGGER_LEFT and JOY_AXIS_TRIGGER_RIGHT) only go from 0 to 1, so they only bind in the positive direction.

For movement, read the four actions with Input.get_vector("move_left", "move_right", "move_up", "move_down"). It returns a vector limited to a length of 1 with a circular deadzone, by default the average of the four actions' deadzones, so diagonals are not faster than straight lines.

Frequently asked questions

Where is the input map in Godot 4?
Open Project > Project Settings and select the Input Map tab. Actions you add there are saved in the [input] section of project.godot, which is the same text this tool generates.
How do I add a controller to Godot input actions?
Bind gamepad buttons with InputEventJoypadButton (for example JOY_BUTTON_A) and stick directions with InputEventJoypadMotion (for example JOY_AXIS_LEFT_X at -1.0 for left). This tool lists the Godot names for every button, stick and trigger and writes both kinds of events for you.
Why does my action not respond to the second controller?
Events created in code default to device 0, which is only the first controller. Set the event's device to -1 to match all devices, as the Input Map editor does. Both outputs from this tool already use -1.
Can I add these actions without editing project.godot?
Yes. Use the GDScript autoload output: save it as res://input_actions.gd and add it in Project > Project Settings > Globals > Autoload. It registers every action when the game starts, before your first scene runs.
Which Godot versions does the output work with?
Godot 4.3 and newer. The project.godot text matches the format Godot 4.7 writes, including the location field on key events that Godot 4.3 added. The autoload uses Godot 4 constants such as KEY_SPACE, MOUSE_BUTTON_LEFT, JOY_BUTTON_A and JOY_AXIS_LEFT_X.

See all tools