Embark on an exhilarating gaming journey with the proper pairing: Godot, the versatile and user-friendly open-source recreation engine, and the Steam Deck, an thrilling handheld gaming system by Valve. This dynamic duo opens up a world of prospects, empowering recreation builders and lovers alike to unleash their creativity and expertise gaming on the transfer like by no means earlier than!
On this tutorial, I’ll information you thru the method of getting ready a Godot undertaking particularly for the Steam Deck, sharing priceless ideas alongside the best way. The Steam Deck, developed by Valve, is a handheld gaming system that primarily capabilities as a conveyable PC, enabling you to take pleasure in your Steam library whereas on the transfer. With handheld gaming units gaining immense recognition, growing for the Steam Deck can open doorways to thrilling alternatives. Godot, an open-source recreation engine, is gaining recognition for its user-friendly interface and highly effective options. This makes it a super alternative for creating each 2D and 3D video games.
Getting Began
You’ll be able to obtain the supplies for this tutorials by way of the Obtain Supplies hyperlink on the prime and backside of this web page.
To observe alongside, you’ll want the next:
- Godot put in in your pc
- A Steam Deck to push the construct to
- (elective) A gamepad to arrange and take a look at the enter in Godot
After finishing this tutorial, you’ll be acquainted with:
- Understanding the Steam Deck {hardware}
- Establishing your Godot undertaking for the Steam Deck
- Detecting the Steam Deck
- Dealing with enter
- Sport efficiency concerns and testing
Understanding the Steam Deck {Hardware}
Earlier than delving into Godot, it’s a good suggestion to take a better take a look at what makes the Steam Deck tick.
Specs
Right here’s an summary of the Steam Deck’s specs:
- CPU: Customized Zen 2 AMD APU
- GPU: AMD RDNA 2 “Van Gogh”
- RAM: 16 GB LPDDR5 on-board RAM
- Display screen: 7-inch touchscreen with a 16:10 side ratio, 1280×800 decision
- Enter 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
- Working System: SteamOS (KDE Linux)
- Value: $399-$649
Issues for Sport Improvement
You could be questioning what all of this implies within the context of recreation growth.
For a small system at an inexpensive worth, the Steam Deck packs a punch. The Steam Deck is much more highly effective than the Nintendo Change, however not on par with trendy desktops. If you wish to evaluate it to a gaming PC, it gives about the identical efficiency as a GTX 1050 or an AMD Radeon RX 560. This implies you’ll want to think about its limitations when growing for it. Easy video games will work advantageous, however extra advanced video games will have to be optimized with a purpose to run easily.
The small display and low decision make it tough to learn advantageous textures and character animations. It is best to enlarge UI parts like textual content to make them simpler to learn. This can be a good observe anyway when it comes to accessibility.
An amazing upside is the Steam Deck’s controller structure. In case your recreation helps Xbox controller enter, it is going to be appropriate with the Steam Deck with none further work. Gamers may also customise the structure to their liking utilizing the Steam Deck’s controller settings, which may map keyboard, gamepad and mouse enter to the system’s controls. Some individuals have even made MMORPGs work with the Steam Deck this manner, that are identified for his or her ample keyboard shortcuts.
As a result of the Steam Deck has a battery, you’ll need permit for shorter play classes and optimize your recreation for battery life. Ideally, the participant can tweak the settings between battery life and efficiency.
I gained’t be overlaying sort out all of those concerns on this tutorial, however ensure that to maintain them in thoughts. It’s a good suggestion to check how nicely your recreation runs on the Steam Deck earlier than optimizing it. You could be stunned by how nicely it runs with none changes.
Up subsequent is looking on the pattern undertaking.
Exploring the Challenge
This undertaking is a small 3D automotive driving sandbox impressed by Micro Machines. There’s a observe and some mountains to drive on.
Operating the Challenge
Begin by opening the starter undertaking in Godot. It is best to see a 3D scene with a automotive.
Press F5 to run the undertaking and drive the automotive round. Listed below are the controls:
- A or Left: Steer left
- D or Proper: Steer proper
- W, Up or Area: Speed up
- S or Down: Brake
- Ctrl/Cmd: Change the digicam view
After testing the undertaking, check out the Scene dock of the stage scene.
Right here’s a fast rundown:
- CameraManager: An everyday node with a script connected to modify the lively digicam
- WorldEnvironment: The lightning settings for the extent
- DirectionalLight3D: A directional mild that acts as a digital solar
- BirdsEyeCamera: A digicam that follows the automotive from above
- LevelModel: The 3D mannequin and colliders that represents the extent
- Automobile: The automotive scene
- CanvasLayer: The canvas on which you’ll add Management nodes to make a consumer interface. There’s already a label right here with a clear background.
You’ll construct upon these nodes all through the tutorial.
Challenge Settings
Out of the field, new Godot initiatives are able to be run on the Steam Deck. Nevertheless, there’s one setting I like to recommend altering throughout growth: the viewport measurement. The default worth is about to 1152×648, which doesn’t match the 1280×800 decision of the Steam Deck. By setting the viewport measurement to match, it’s simpler to preview what the sport will seem like on the precise system.
To vary the viewport measurement, open the Challenge Settings by choosing Challenge ▸ Challenge Settings.
Now choose Window on the left.
Subsequent, set the Viewport Width to 1280 and Viewport Top to 800.
Lastly, click on the Shut button to shut the window. Open the 2D display utilizing the tabs on the prime, and also you’ll see a blue define within the heart display for those who zoom out. These are the bounds of the display you’ll be working in.
With that out of the best way, it’s time to get to the enjoyable components!
Detecting the Steam Deck
Godot doesn’t have a built-in variable to find out if a tool is a Steam Deck. What it does have is a set of capabilities that may learn each the software program and {hardware} info from the system. From this info, you may detect if the system is a Steam Deck if you realize what to search for. To try this, you may add a script to the data label on the prime left which is able to show the knowledge and detect in case your undertaking is operating on a Steam Deck.
First, choose CanvasLayer ▸ Data ▸ MarginContainer ▸ SystemInfoLabel within the Scene dock.
Now connect a brand new script to the label, identify it system_info_label.gd and place it within the scripts folder.
This could robotically open the Script display and show the brand new script. To learn the system info and add it to the label, change the _ready
perform with the next:
func _ready() -> void:
self.textual content = "" # 1
self.textual content += "OS: " + OS.get_name() + "n" # 2
self.textual content += "Distro: " + OS.get_distribution_name() + "n" # 3
self.textual content += "CPU: " + OS.get_processor_name() + "n" # 4
self.textual content += "GPU: " + RenderingServer.get_rendering_device().get_device_name() + "n" # 5
Right here’s a abstract of what this does:
- Clear the textual content of the label
- Use
OS.get_name()
to return the identify of the working system the construct targets. Confusingly, this gained’t at all times match the identify of the particular OS. Then
provides a brand new line on the finish. -
OS.get_distribution_name()
returns the identify of the distribution. On Home windows (and Proton), that is “Home windows”. On Linux, that is the identify of the distribution, akin to “Ubuntu” or “SteamOS”. - The
OS.get_processor_name()
perform returns the identify of the CPU. -
RenderingServer.get_rendering_device().get_device_name()
returns the identify of the GPU.
Now press F5 to save lots of the script and run the undertaking. It is best to now see the system info within the information label
If you happen to would export and run this undertaking in your Steam Deck at this level, you’ll see that the system information is crammed in accurately.
Right here’s the consequence with a local Linux construct:
And right here’s the consequence with a Home windows construct:
I’ll cowl export and run this undertaking on the Steam Deck in a while on this tutorial. For now, a very powerful factor to remove is what the Steam Deck studies as its CPU and GPU:
- CPU: AMD Customized APU 0405
- GPU: AMD Customized GPU 0405 (RADV VANGOGH)
Based mostly on this info, you may detect in case your undertaking is operating on a Steam Deck. To take action, add the next perform to the system_info_label.gd script:
func _is_steam_deck() -> bool: # 1
if RenderingServer.get_rendering_device().get_device_name().incorporates("RADV VANGOGH")
or OS.get_processor_name().incorporates("AMD CUSTOM APU 0405"): # 2
return true
else: # 3
return false
This perform will return true
if the Steam Deck is detected, and false
in any other case:
- This can be a perform named
_is_steam_deck
which returns aboolean
worth. - If the identify of the GPU incorporates the string “RADV VANGOGH” or the CPU identify incorporates the string “AMD CUSTOM APU 0405”, it returns
true
. - In any other case, it returns
false
.
Now add this line to the _ready
perform:
self.textual content += "Steam Deck: " + str(_is_steam_deck()) + "n"
It will present true
or false
relying on if the undertaking is operating on a Steam Deck. Run the undertaking once more to see the consequence.
On an precise Steam Deck, this might be true
in fact!
Listed below are some ideas on what you are able to do with this info:
- Allow gamepad help
- Present button prompts and different graphics particular to the Steam Deck
- Mechanically regulate efficiency settings to run optimally
- Transfer and resize UI parts for higher readability
- Collect analytics to enhance the undertaking’s efficiency
Dealing with Enter
The Steam Deck has enter controls and a touchscreen. On this part you’ll learn to get the enter from the Steam Deck and use it in your undertaking.
Enter Map Setup
The enter from the Steam Deck’s controller might be mapped in Godot as for those who have been utilizing an Xbox controller.
To begin off, check out the present actions within the enter map by choosing Challenge ▸ Challenge Settings ▸ Enter Map.
The actions outlined within the enter map are:
- speed up
- brake
- left
- proper
- switch_camera
For every of those actions, you’ll want so as to add a brand new gamepad occasion to help enter from a recreation controller. Listed below are the mappings I’ll be utilizing:
- speed up : Proper set off
- brake : Left set off
- left : Left analog stick left
- proper : Left analog stick proper
- switch_camera : Y button
You’ll be able to change these mappings as you like, or add additional ones. To map a brand new occasion to an motion, click on the + button subsequent to the motion’s identify.
Subsequent, both press or transfer the enter you wish to bind to the motion in your gamepad. If you happen to don’t have a gamepad, you may choose the occasion underneath Joypad Buttons or Joypad Axes. For the speed up motion for instance, you’d press the proper set off.
Now click on the OK button on the backside left to verify including the occasion. You’ll now see that the occasion has been added to the enter map.
Now do the identical for the opposite actions till all of them have gamepad occasions.
To check if the gamepad occasions are working, run the undertaking once more whereas utilizing a gamepad.
Nice! That’s all it’s essential do to help the Steam Deck’s controller. Subsequent up is utilizing the touchscreen.
Touchscreen Enter
Though the Steam Deck has a touchscreen, it shouldn’t be the first approach to work together along with your recreation as a result of small display measurement its decrease sensitivity in comparison with a smartphone. Nevertheless, you may add easy buttons or detect movement occasions as an elective function.
For instance, you’ll be including a button to the nook of the display to modify the digicam view.
So as to add the button, begin by including a Button node to CanvasLayer by right-clicking the CanvasLayer node and choosing Add Little one Node. Subsequent, seek for “Button” within the search bar on the prime, choose Button and click on the Create button so as to add it.
This could’ve added a brand new Button node under the CanvasLayer node.
Choose this new button and rename it to CameraSwitchButton by right-clicking it and choosing Rename or by urgent F2. Now swap to the 2D mode to see choice field across the button on the prime left. You’ll have to zoom in to get a greater view.
For the time being, there’s not a lot to see. To vary that, drag the camera_switch.png picture from the sprites folder within the FileSystem dock onto the Icon subject within the Inspector.
The button will now be lots bigger, with an icon within the center.
To get the button to the highest proper as a substitute of the highest left, change its anchor preset to High Proper by way of the Anchor dropdown within the toolbar.
This strikes the button to the highest proper as anticipated. To provide it a small offset from the sides of the display, maintain down Shift and press the left arrow key in your keyboard adopted by the down arrow key. This creates a couple of pixels of house from the sides.
To stop the button from being pressed by chance when urgent keyboard or gamepad button, it’s finest to disable the main focus mode of the button. You are able to do this by scrolling down within the Inspector, increasing Focus underneath the Management part and choosing None from the Mode dropdown.
Nice! All that’s left for this button is to hook up its pressed sign to the switch_camera
perform of the CameraManager node. Change to the Node tab within the Inspector and double-click the pressed() sign.
This opens a sign connection dialog window the place you may select a perform to name when the button is pressed. Now choose the CameraManager node and click on the Choose button. It will open a listing of capabilities that may be known as.
Subsequent, choose the switch_camera
perform and click on the OK button.
Again within the sign connection dialog, click on the Join button on the backside to complete the connection.
Right here’s what the switch_camera
perform appears like:
func switch_camera() -> void:
if birds_eye_camera.present:
behind_car_camera.present = true
else:
behind_car_camera.present = false
This toggles the lively digicam between the behind the automotive digicam and the birds eye digicam. With the button all arrange, it’s time for an additional take a look at drive!
Fireplace up the undertaking once more utilizing F5 and take a look at if the button works as anticipated.
The undertaking is now completed! Time to check it on an actual Steam Deck.
Exporting Builds
You’ll be creating each a Home windows and a Linux construct for the Steam Deck. This makes it simple to match what kind of construct will supply one of the best efficiency.
First off, choose Challenge ▸ Export… within the prime menu to open the Export Presets menu.
Now click on the Add… button on the prime and add a Linux/X11 export preset.
Notice: If you happen to get an error on the backside saying “No export template discovered”, click on the Handle Export Templates hyperlink and obtain the template by way of the Export Template Supervisor.
Now set the Export Path to any folder in your PC, ideally a folder that syncs to the Steam Deck.
So as to add the Home windows export preset, click on the Add… button once more and choose Home windows Desktop this time. Subsequent, choose an Export Path simply as you probably did for the Linux preset.
Now click on the Export All… button on the backside proper to export the undertaking utilizing each presets. For the export mode, select Debug. It will construct each a Home windows and a Linux construct within the folders you specified.
With the undertaking exported, now you can take a look at them on the Steam Deck. If you happen to’re undecided switch and run your builds to the Steam Deck, check out the How one can Switch Sport Builds to a Steam Deck article.
Sport Efficiency
The Steam Deck comes with a nifty efficiency overlay built-in that reveals you the way onerous the CPU and GPU are working. By analyzing the knowledge this overlay gives, you will get a greater understanding of how your recreation is performing.
Operating the Linux Construct
To begin off, run the native Linux construct first and take a look at if every thing is working accurately. It is best to be capable to management the automotive utilizing the built-in gamepad and clicking the digicam button on the display switches the digicam view. The system information ought to say you’re operating the undertaking on a Linux-based OS named SteamOS and the Steam Deck flag must be set to true.
Now allow the efficiency overlay by clicking the three dotted button on the backside proper of your Steam Deck and choosing the battery icon within the Fast Entry menu. From right here, slide the Efficiency Overlay Degree to 4.
Subsequent, check out the left facet of the display to see all of the efficiency info you could possibly ever need.
It could be a bit onerous to see what’s occurring due to the background, however right here’s a fast overview from prime to backside:
- GPU: GPU utilization, temperature, clock pace and energy draw
- CPU: CPU utilization, temperature, clock pace and energy draw
- CPU cores: The utilization per CPU core, with its clock pace
- VRAM: The quantity of VRAM utilized by the GPU to render the sport
- RAM: Quantity of RAM utilized by the sport
- BATT: The quantity of battery life left, the entire energy draw and the approximate time left earlier than the battery runs out
- FAN: The fan pace in rotations per minute
- FSR: Whether or not FSR (Constancy Tremendous Decision) is enabled or not
- GAMESCOPE: The body time and body rely
An important metric out of all of those is the body time. If the inexperienced line is flat on a regular basis, then your recreation will really feel clean because it’ll run at a steady 60 FPS. Nevertheless, if the inexperienced line is continually leaping up and down, then your recreation will really feel uneven and laggy. There’s no approach to completely keep away from some choppiness when instantiating new scenes and whereas the shaders are compiling, however throughout the primary recreation loop, the body charge must be steady.
To get an concept of how graphically demanding your recreation is, check out the GPU clock pace. The upper the quantity, the extra demanding the sport is. The Steam Deck tends to attempt to use the least quantity of energy potential, so it clocks down its 1.6 GHz (1600MHz) GPU at any time when it might probably. Within the case of the automotive recreation, it tends to hover between 1050 and 1100 MHz.
To know the quantity of leeway you might have when it comes to graphical efficiency, you may manually set the GPU clock pace by way of the efficiency settings. Press the three dotted button once more and scroll all the way down to Handbook GPU Clock Management within the Efficiency part. Now examine the checkbox subsequent Handbook GPU Clock Management and slide GPU Clock Frequency to 1600. It will lock the GPU clock pace to its highest potential worth for optimum efficiency.
If you happen to now exit the menu and take one other take a look at the GPU clock, you’ll discover it’s now set to 1600MHz.
The share above the clock pace is now far more priceless, as this means how a lot your recreation is utilizing the GPU in easy phrases. Because the automotive recreation isn’t optimized in any means, the GPU utilization is someplace between 58% and 70% more often than not, which is surprisingly excessive for such a easy recreation.
The CPU utilization is simpler to identify, as you simply want to have a look at the CPU utilization proportion. The upper the quantity, the extra demanding the sport is when it comes to CPU utilization.
Now exit the Linux construct of the sport because it’s time to maneuver over to the Home windows construct.
Operating the Home windows Construct
Begin up the Home windows construct and check out the system information on the prime left. As a substitute displaying the precise OS, it says the sport is operating inside Home windows. The Steam Deck flag is about to true although as anticipated.
The rationale why it says Home windows right here as a substitute of Linux like with the opposite construct is as a result of Home windows executables are run inside a Proton compatibility layer. Video games operating like this may “assume” they’re operating on a Home windows machine. Some video games run higher underneath Proton than their native counterparts, whereas some gained’t work in any respect. It’s finest to check out your video games totally earlier than deciding what model you wish to suggest for the Steam Deck.
Now lock the GPU clock to 1600 once more and examine the efficiency of the Home windows construct.
The sport is operating nearly similar to the Linux construct, so on this case the native Linux construct could be the most suitable choice. It’s a good suggestion to maintain testing each forms of builds as your recreation will increase in complexity.
The place to Go From Right here?
Congratulations! You’ve arrange a Godot undertaking for the Steam Deck, exported it and did some fundamental efficiency testing. You’ll be able to obtain the ultimate undertaking on the prime or backside of this tutorial.
If you happen to’re caught, don’t hesitate to hunt assist from the Godot group via their Discord, boards, or different platforms. You may also attain out by way of the Kodeco Discord and by becoming a member of the dialogue under.
If you happen to create one thing cool for the Steam Deck utilizing Godot, don’t overlook to share it!