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.
- 4 bindings
- 4 bindings
- 3 bindings
- 4 bindings
- 2 bindings
- 2 bindings
How to use it
- 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.
- 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.
- Choose GDScript autoload, project.godot [input] section or Both, choose how keys match, and press Generate input map.
- 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?
How do I add a controller to Godot input actions?
Why does my action not respond to the second controller?
Can I add these actions without editing project.godot?
Which Godot versions does the output work with?
More free game dev tools
- GDScript Boilerplate Generator: Typed Godot 4 GDScript templates for player controllers, state machines, health and autoloads.
- Godot Collision Layer Calculator: Plan Godot collision layers and masks and get the bitmask values and code.
- Godot Gitignore Generator: Build a Godot 4 .gitignore and .gitattributes with C#, editor and Git LFS options.