Targeting the Steam Deck with Godot
- Getting Started
- Understanding the Steam Deck Hardware
- 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?
Embark on an exhilarating gaming journey with the perfect pairing: Godot, the versatile and user-friendly open-source game engine, and the Steam Deck, an exciting handheld gaming device by Valve. This dynamic duo opens up a world of possibilities, empowering game developers and enthusiasts alike to unleash their creativity and experience gaming on the move like never before!
In this tutorial, I’ll guide you through the process of preparing a Godot project specifically for the Steam Deck, sharing valuable tips along the way. The Steam Deck, developed by Valve, is a handheld gaming device that essentially functions as a portable PC, enabling you to enjoy your Steam library while on the move. With handheld gaming devices gaining immense popularity, developing for the Steam Deck can open doors to exciting opportunities. Godot, an open-source game engine, is gaining recognition for its user-friendly interface and powerful features. This makes it an ideal choice for creating both 2D and 3D games.
You can download the materials for this tutorials via the Download Materials link at the top and bottom of this page.
To follow along, you’ll need the following:
- Godot installed on your computer
- A Steam Deck to push the build to
- (optional) A gamepad to set up and test the input in Godot
After completing this tutorial, you’ll be familiar with:
- Understanding the Steam Deck hardware
- Setting up your Godot project for the Steam Deck
- Detecting the Steam Deck
- Handling input
- Game performance considerations and testing
Understanding the Steam Deck Hardware
Before delving into Godot, it’s a good idea to take a closer look at what makes the Steam Deck tick.
Here’s an overview of the Steam Deck’s specifications:
- CPU: Custom Zen 2 AMD APU
- GPU: AMD RDNA 2 “Van Gogh”
- RAM: 16 GB LPDDR5 on-board RAM
- Screen: 7-inch touchscreen with a 16:10 aspect ratio, 1280×800 resolution
- Input Controls: Xbox controller buttons, bumpers, triggers and D-pad + trackpads and touchscreen
- Connectivity: USB-C, Bluetooth, Wi-Fi
- Battery: 40 watt-hour (2-8 hours of gameplay)
- Storage: 64 GB eMMC or 256-512 GB NVMe SSD
- Operating System: SteamOS (KDE Linux)
- Price: $399-$649
Considerations for Game Development
You might be wondering what all of this means in the context of game development.
For a small device at an affordable price, the Steam Deck packs a punch. The Steam Deck is a lot more powerful than the Nintendo Switch, but not on par with modern desktops. If you want to compare it to a gaming PC, it offers about the same performance as a GTX 1050 or an AMD Radeon RX 560. This means you’ll need to consider its limitations when developing for it. Simple games will work fine, but more complex games will need to be optimized in order to run smoothly.
The small screen and low resolution make it difficult to read fine textures and character animations. You should enlarge UI elements like text to make them easier to read. This is a good practice anyway in terms of accessibility.
A great upside is the Steam Deck’s controller layout. If your game supports Xbox controller input, it will be compatible with the Steam Deck without any additional work. Players can also customize the layout to their liking using the Steam Deck’s controller settings, which can map keyboard, gamepad and mouse input to the device’s controls. Some people have even made MMORPGs work with the Steam Deck this way, which are known for their abundant keyboard shortcuts.
Because the Steam Deck has a battery, you’ll want allow for shorter play sessions and optimize your game for battery life. Ideally, the player can tweak the settings between battery life and performance.
I won’t be covering how to tackle all of these considerations in this tutorial, but make sure to keep them in mind. It’s a good idea to test how well your game runs on the Steam Deck before optimizing it. You might be surprised by how well it runs without any adjustments.
Up next is taking a look at the sample project.
Exploring the Project
This project is a small 3D car driving sandbox inspired by Micro Machines. There’s a track and a few mountains to drive on.
Running the Project
Start by opening the starter project in Godot. You should see a 3D scene with a car.
Press F5 to run the project and drive the car around. Here are the controls:
- A or Left: Steer left
- D or Right: Steer right
- W, Up or Space: Accelerate
- S or Down: Brake
- Ctrl/Cmd: Switch the camera view
After testing the project, take a look at the Scene dock of the level scene.
Here’s a quick rundown:
- CameraManager: A regular node with a script attached to switch the active camera
- WorldEnvironment: The lightning settings for the level
- DirectionalLight3D: A directional light that acts as a virtual sun
- BirdsEyeCamera: A camera that follows the car from above
- LevelModel: The 3D model and colliders that represents the level
- Car: The car scene
- CanvasLayer: The canvas on which you can add Control nodes to make a user interface. There’s already a label here with a transparent background.
You’ll build upon these nodes throughout the tutorial.
Out of the box, new Godot projects are ready to be run on the Steam Deck. However, there’s one setting I recommend changing during development: the viewport size. The default value is set to 1152×648, which doesn’t match the 1280×800 resolution of the Steam Deck. By setting the viewport size to match, it’s easier to preview what the game will look like on the actual device.
To change the viewport size, open the Project Settings by selecting Project ▸ Project Settings.
Now select Window on the left.
Next, set the Viewport Width to 1280 and Viewport Height to 800.
Finally, click the Close button to close the window. Open the 2D screen using the tabs at the top, and you’ll see a blue outline in the center screen if you zoom out. These are the bounds of the screen you’ll be working in.
With that out of the way, it’s time to get to the fun parts!