Fox Studios logo Fox StudiosGame projects, devlogs and Scratch builds
Devlogs

Adding Controller Support to Our Godot Game, a Devlog

Three of the first ten people who played our demo picked up a gamepad, pressed A on the title screen, and nothing happened.

Several game controllers lying on a desk next to a laptop showing a colorful 2D platformer level

Three of the first ten people who played our demo picked up a gamepad, pressed A on the title screen, and nothing happened. That was the moment we stopped treating Godot controller support as a launch week task and gave it a full two week sprint instead.

This devlog covers what we built, what broke, and what we would do differently. Our game is a small 2D platformer in Godot 4.3, roughly 25 minutes long, built by three of us in evenings and weekends. Nothing here needs a plugin.

Where we started

Our input code was the classic first project mess. The player script checked keys directly with things like Input.is_key_pressed(KEY_SPACE), the menus only reacted to mouse clicks, and the pause screen was hard coded to Escape. It all worked on a keyboard, which is exactly why nobody noticed the problem until real players showed up with controllers.

Our list of goals for the sprint was short:

  • Every action works on keyboard and on an Xbox, PlayStation or Switch Pro style gamepad.
  • Every menu can be used without touching the mouse.
  • On screen prompts show the right buttons for whatever the player last touched.
  • Unplugging a controller mid game pauses instead of leaving the player running off a cliff.

Step one, moving everything to the Input Map

The single most useful change for Godot controller support is to stop reading devices and start reading actions. In Project Settings, under Input Map, we created named actions: move_left, move_right, move_up, move_down, jump, dash, interact and pause. Each action got a keyboard key and a joypad event.

Then the player script changed from a pile of key checks to two lines that do most of the work:

  • var dir = Input.get_vector("move_left", "move_right", "move_up", "move_down") for movement, which handles both keys and the left stick.
  • Input.is_action_just_pressed("jump") for jumping, so Space and the bottom face button both work.

This took one evening and fixed about 70 percent of the problem. It also made our kanban board look a lot happier, because four separate input bugs closed at once.

What broke along the way

The stick drift problem

Godot gives each action a deadzone, 0.5 by default. For digital actions like jump, that is fine. For movement, it felt awful: the character went from standing still to full speed with nothing in between. We dropped the movement deadzones to 0.2 and let the analog value drive speed. Then one tester's older controller drifted at about 0.15 at rest, and their character slowly walked off a ledge in the first level. We settled on 0.25, and added a slider in the options menu that goes from 0.1 to 0.4.

Godot's UI focus system works well once you remember to use it. Every menu now calls grab_focus() on its first button when it opens. Without that, a controller player lands on a screen where nothing is selected and nothing responds. We also had to set focus neighbors by hand on our level select grid, because automatic neighbors jumped diagonally in a way that confused everyone.

A small detail we missed for a week: the settings screen had a slider, and sliders eat left and right input when focused. Players got stuck on it. The fix was to make the slider change on left and right, but move focus on up and down, which is the default behavior. Our own custom script was overriding it.

Button prompts that lie

Our tutorial said "Press Space to jump" even when the player was holding a gamepad. We added a small autoload that listens in _input and records whether the last event was a key, a mouse event, or a joypad event. Prompts read from that value and swap their icon. For the gamepad face buttons, we show position based icons, the bottom, right, left and top button, rather than letters, because A means a different spot on a Switch controller than on an Xbox one.

Unplugging mid game

We connected to Input.joy_connection_changed and open the pause menu when the active controller disconnects. Wireless controllers drop briefly when batteries get low, so we wait 0.3 seconds before pausing. Without that delay, one tester got paused six times in a single level.

Why we skipped full button remapping

The usual advice is that full remapping is a must have for any PC release. We disagree for a game our size, and we cut it. Remapping in Godot is doable, but the work is not the remap itself. It is saving it, loading it, handling conflicts when two actions share a button, showing correct prompts for the custom layout, and testing every combination. We estimated six to eight evenings, almost as long as the rest of the sprint.

Instead, we offered two preset layouts, standard and a swapped jump and dash, plus a "hold to run" toggle. On Steam Deck, Steam Input already lets players remap at the system level, which covers the players who need it most. We wrote more about trimming features like this in our devlog on cutting scope. Remapping is on our list for after launch if players ask for it, and we will be honest in the store page that it is not there yet.

How we tested it

We borrowed controllers rather than buying them. Our test pile ended up as an Xbox Series pad, a DualShock 4, a Switch Pro controller, an 8BitDo SN30 Pro, and a Steam Deck. Each one went through the same checklist:

  1. Boot the game with the controller already connected and reach level one without touching the keyboard.
  2. Play the first level, pause, change the deadzone, and resume.
  3. Unplug or switch off the controller during a jump.
  4. Switch from keyboard to controller mid level and check that prompts update.
  5. Quit to the title screen and back in again.

The DualShock 4 failed step one on Windows without Steam running, because the face buttons mapped in a different order. Godot's built in controller database handled it once we updated to 4.3. The 8BitDo needed its mode switch set to X input. Both findings went straight into our release checklist.

What we would do differently

Start with the Input Map on day one. Every hour we spent converting old key checks was an hour we would not have needed. And put one controller on the desk from the first prototype, even a cheap $20 one. If you are always testing with it, you notice a missing focus or a wrong prompt the same day you create it, not three months later in front of strangers.

Frequently asked questions

Does Godot support controllers out of the box?

Yes. Godot 4 recognizes most common gamepads through its built in controller database, including Xbox, PlayStation and Switch Pro controllers. You still need to map actions in the Input Map and make menus usable with focus, but no plugin is required.

What deadzone should I use for a gamepad in Godot?

For movement, a value between 0.2 and 0.25 works for most controllers. Go lower and older pads with stick drift will move the character on their own. A deadzone slider in your options menu is cheap to add and helps players with worn controllers.

How do I show the right button prompts in Godot?

Track the type of the last input event in an autoload script and have your prompt nodes read that value. Swap between keyboard and gamepad icons when the type changes. Using position based icons for face buttons avoids confusion between Xbox and Nintendo layouts.

RD
Reyansh Dole

Reyansh started making small games as a teenager and now writes the devlogs and tutorials here, focused on how beginners actually ship a first project.

More posts by Reyansh

More in Devlogs

01doorganico 084goad 3hot8 4465456 after5internprogram ahandfulofblessings ahmadpc ahomcybersecurity allodialresources annodex antiquesandperiodcollectibles aotc asianworldkashmir beedlectrics bloggertemplatefree bluefeatheragency bodyweightsolution campaign08blog carfixadvisor catstreetcollective cbstvsports cnfanspurchasing committeeof500yearsofdignityandresistance covertopsdjs cs-kaiyuangame cuestacomunicaciontotal cxoutlet dancebetgame deskgearhub destinyvillastay detectmagazine di33 diamondsteelbuildings donmo dyanadropship emarsysfinance emimattl escapechan eskitarih evautoplay everythingweddings-orlando farmzone feedviewerapp gamevui123 gleasongrade greetingsday hacklabasu haskell iw-kaiyun jagoanproperti jilidskripsi joltbusinessfinance juegodepokergratis juegospucca kaeru-festival latestmehndidesigns lestanzediottaviano litemagazines localcommunityhero lustrsazan mariashebets menswheels newwebstechs1 nikkit ootheday oxigenvpn plurfitness prefetial probudgetcarpetcleaning psychicmrsmartin pyaten qvantor rejoignezlogis rexzbot riselayouts ruchin rwxqsgd5 sakaltime shibiaowang shop-bot skrtips spotlesshaven strcoding tetapatrium topselller uneplanteartificielle vipertechcr webtech1223411 wo-kygaming yamaha-mekar yeknava yoybuysheets zenunwa yamaha-mekar jilidskripsi ankertoto ankertoto ankertoto