![](https://files.koenig.kodeco.com/uploads/2023/08/targeting_steam_deck_godot_featured_banner@1.5x.png)
Targeting the Steam Deck with Godot
This tutorial guides game developers through the process of preparing a Godot project specifically for the Steam Deck device. It covers understanding Steam Deck hardware, handling input, optimizing game performance, and detecting the Steam Deck in the project, providing valuable insights for creating engaging games tailored for this exciting gaming platform. By Eric Van de Kerckhove.
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress, bookmark, personalise your learner profile and more!
Create accountAlready a member of Kodeco? Sign in
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress, bookmark, personalise your learner profile and more!
Create accountAlready a member of Kodeco? Sign in
Contents
Targeting the Steam Deck with Godot
25 mins
- Getting Started
- Understanding the Steam Deck Hardware
- Specs
- Considerations for Game Development
- Exploring the Project
- Running the Project
- Project Settings
- Detecting the Steam Deck
- Handling Input
- Input Map Setup
- Touchscreen Input
- Exporting Builds
- Game Performance
- Running the Linux Build
- Running the Windows Build
- Where to Go From Here?
Exporting Builds
You’ll be creating both a Windows and a Linux build for the Steam Deck. This makes it easy to compare what type of build will offer the best performance.
First off, select Project ▸ Export… in the top menu to open the Export Presets menu.
Now click the Add… button at the top and add a Linux/X11 export preset.
Now set the Export Path to any folder on your PC, ideally a folder that syncs to the Steam Deck.
To add the Windows export preset, click the Add… button again and select Windows Desktop this time. Next, select an Export Path just as you did for the Linux preset.
Now click the Export All… button at the bottom right to export the project using both presets. For the export mode, choose Debug. This will build both a Windows and a Linux build in the folders you specified.
With the project exported, you can now test them on the Steam Deck. If you’re not sure how to transfer and run your builds to the Steam Deck, take a look at the How to Transfer Game Builds to a Steam Deck article.
Game Performance
The Steam Deck comes with a nifty performance overlay built-in that shows you how hard the CPU and GPU are working. By examining the information this overlay provides, you can get a better understanding of how your game is performing.
Running the Linux Build
To start off, run the native Linux build first and test if everything is working correctly. You should be able to control the car using the built-in gamepad and clicking the camera button on the screen switches the camera view. The system info should say you’re running the project on a Linux-based OS named SteamOS and the Steam Deck flag should be set to true.
Now enable the performance overlay by clicking the three dotted button at the bottom right of your Steam Deck and selecting the battery icon in the Quick Access menu. From here, slide the Performance Overlay Level to 4.
Next, take a look at the left side of the screen to see all the performance information you could ever want.
It might be a bit hard to see what’s going on because of the background, but here’s a quick overview from top to bottom:
- GPU: GPU usage, temperature, clock speed and power draw
- CPU: CPU usage, temperature, clock speed and power draw
- CPU cores: The usage per CPU core, with its clock speed
- VRAM: The amount of VRAM used by the GPU to render the game
- RAM: Amount of RAM used by the game
- BATT: The amount of battery life left, the total power draw and the approximate time left before the battery runs out
- FAN: The fan speed in rotations per minute
- FSR: Whether FSR (Fidelity Super Resolution) is enabled or not
- GAMESCOPE: The frame time and frame count
The most important metric out of all of these is the frame time. If the green line is flat all the time, then your game will feel smooth as it’ll run at a stable 60 FPS. However, if the green line is constantly jumping up and down, then your game will feel choppy and laggy. There’s no way to totally avoid some choppiness when instantiating new scenes and while the shaders are compiling, but during the main game loop, the frame rate should be stable.
To get an idea of how graphically demanding your game is, take a look at the GPU clock speed. The higher the number, the more demanding the game is. The Steam Deck has a tendency to try to use the least amount of power possible, so it clocks down its 1.6 GHz (1600MHz) GPU whenever it can. In the case of the car game, it tends to hover between 1050 and 1100 MHz.
To know the amount of leeway you have in terms of graphical performance, you can manually set the GPU clock speed via the performance settings. Press the three dotted button again and scroll down to Manual GPU Clock Control in the Performance section. Now check the checkbox next Manual GPU Clock Control and slide GPU Clock Frequency to 1600. This will lock the GPU clock speed to its highest possible value for optimal performance.
If you now exit the menu and take another look at the GPU clock, you’ll notice it’s now set to 1600MHz.
The percentage above the clock speed is now much more valuable, as this indicates how much your game is using the GPU in simple terms. As the car game isn’t optimized in any way, the GPU utilization is somewhere between 58% and 70% most of the time, which is surprisingly high for such a simple game.
The CPU usage is easier to spot, as you just need to look at the CPU usage percentage. The higher the number, the more demanding the game is in terms of CPU usage.
Now exit the Linux build of the game as it’s time to move over to the Windows build.
Running the Windows Build
Start up the Windows build and take a look at the system info at the top left. Instead showing the actual OS, it says the game is running inside Windows. The Steam Deck flag is set to true though as expected.
The reason why it says Windows here instead of Linux like with the other build is because Windows executables are run inside a Proton compatibility layer. Games running like this will “think” they’re running on a Windows machine. Some games run better under Proton than their native counterparts, while some won’t work at all. It’s best to test out your games thoroughly before deciding what version you want to recommend for the Steam Deck.
Now lock the GPU clock to 1600 again and inspect the performance of the Windows build.
The game is running almost identical to the Linux build, so in this case the native Linux build might be the best option. It’s a good idea to keep testing both types of builds as your game increases in complexity.