Run Godot games on the GameShell!
In the last weeks I investigated a bit on how to compile the Godot Engine and run Godot games on the GameShell. This is a tutorial on how to do the same on your machine!
Godot is a very powerful free and open source 2D and 3D game engine, although we’re sticking only with 2D on the GameShell!
The entire Godot documentation is at your disposal if you want to learn how to use the engine in general. The “About” and “Step by step” sections are the recommended ones to begin with!
Here we’ll focus on GameShell-specific Godot tips and tricks to get you started!
NOTICE: there seems to be issues and crashes with the 512 MB of ram version of the GameShell using the lima driver.
Fbturbo seems to work fine even if with lower performance.
Feel free to try the procedure on a 512 MB GameShell and let me know how it goes in DM.
- A GameShell with Clockwork OS v0.5 installed.
- Another PC to develop the game on.
- The Godot Engine 3.2.3 standard editor binaries.
- A 2D game developed with Godot, or a new one you’re about to make!
- GameShell Godot export templates, download them here!
Your Godot game will probably not work out of the box on the GameShell, a few tweaks are usually needed. So let’s see what are the guidelines and the changes needed to have your game up and running!
1. Create a new export preset
Project -> Export...and add a new
Linux/X11preset, you can call it GameShell or however you like.
64 Bitsoption and fill the custom template fields with the contents of the templates zip file you downloaded.
godot.x11.debug.32is the debug build and
godot.x11.opt.32is the release one.
If you plan to release the game on other platforms besides the GameShell, it is a good idea to create a custom feature for it in the
2. Change your project settings
You can override values for the GameShell only if you select the label of a property and click on
Override For...in the top right corner of the popup window, then select the feature you created earlier. A new property named
<property_name>.<feature_name>will appear, this is the property you’ll have to change.
Project Settings -> Display -> Window: set the window width and height to 320x240. This is the GameShell screen resolution.
Set the aspect and the mode too.
2dusually work best, but it may depend on the game you’re making.
Project Settings -> Rendering -> Quality: the GameShell supports GLES2 only. Change the driver name.
It’s recommended to change the framebuffer allocation to
2D Without Sampling, but you can try setting it to
2Dif you need.
3. Map the
One of the GameShell conventions is that when you press the
MENUbutton, you exit the app or game you’re currently in.
MENUbutton is mapped to the escape key, so just create a new action
Input Mapsettings that activates with the escape key and add this snippet somewhere in your code, where it is always running:
if OS.has_feature("GameShell") and Input.is_action_pressed("ui_escape"): get_tree().quit()
Remove the feature check if you didn’t create one.
4. The other inputs need to be remapped
- This is the GameShell keypad mapping:
One way you can do it is by adding a similar piece of code inside a function that is called on startup:
if OS.has_feature("GameShell"): InputMap.action_erase_events("ui_accept") # Erase the previous mapping. var ev = InputEventKey.new() # Create a new event that will activate the action. ev.pressed = true # Action activates on key pressed. ev.scancode = KEY_K # The key to press is K, which is the B button. InputMap.action_add_event("ui_accept", ev) # Add the action back into the InputMap. ... # Repeat for each action you want to remap.
5. Export your project
- Go into
Project -> Export..., select the GameShell preset and click on
Export Project, make sure to disable the
Export With Debugoption.
6. Add the game into your GameShell
There are a few ways you can do this. The simpler one is to connect to your GameShell’s file system through network share, the needed ips are listed in Tiny Cloud under “For Windows network”.
Your OS should be capable of mapping a network drive using those ips. Choose the one for games (
~/games/). Add your game (executable + .pck files) inside a new
Alternatively you can transfer your files with SCP using the command line.
The game needs to have execute permission, SSH into your GameShell:
cd ~/games/GameName/ sudo chmod +x *
From the GameShell, you can then open the Bean file browser, navigate to
/home/cpi/games/GameName, highlight the game executable, press MENU and choose
Execute. That’s it!
7. Add a launcher entry
It is generally preferable to have a shortcut to your game directly in the launcher. To do that, SSH into your GameShell and create a new script file inside the
cd ~/apps/Menu nano GameName.sh
The contents of this file should be:
Important, add execute permission, the launcher may not be able to boot correctly otherwise:
sudo chmod +x GameName.sh
The GameShell launcher uses the directory structure and the executable scripts inside
~/apps/Menuto generate its entries each time the launcher is reloaded, so feel free to add your entries wherever you like.
Reload the UI or reboot your GameShell and you should be good to go!
8. Set a custom icon for your launcher entry.
To assign a custom icon to your game, by default you’ll have to add a new image file in the directory structure under
~/launcher/skin/default/Menu/GameShell, in the same location and using the same name of the script you created earlier.
In case you changed your default launcher, the same procedure should apply changing the base directory to the appropriate one.
That should be it!
Here’s one of my games, Gumgem, running on the GameShell!
More info and instruction to compile Godot yourself are available here on my repository:
Have fun developing games for the GameShell!
Post your Godot projects and screenshots here in this topic!