Last updated: 13 February 2020
Many people learn to code through making games for their computer or phone. One of the things I love most about the Librem 5 is that it’s a full computer in your pocket that isn’t locked-down like Android and iOS. This means you get access to more programming languages, tools, frameworks and engines than they do. In this post I’ll showcase popular free and open source game frameworks and engines running on, or building games for, the Librem 5. I’ll be continuously testing new projects and adding them to the list, so if you have a favorite that’s not here yet let us know and I will get to it.
LÖVE is a free, open source and fully-featured 2D game framework written in C++ and SDL and available on most platforms including PureOS for desktop and the Librem 5. Games are made with Lua, under-the-hood LÖVE uses LuaJIT – one of the fastest dynamic languages with the ability to call C code. You also get a simple and stable API and an active community with a wiki, forum, IRC server, Discord server and subreddit.
# install dependencies
sudo apt install libluajit-5.1-dev libopenal-dev vflib3-dev libmodplug-dev libvorbis-dev libtheora-dev libmpg123-dev
# clone the project and build
git clone https://github.com/love2d/love.git
cd love
./platform/unix/automagic
./configure
make
# run
./src/love
LÖVE runs really well on the Librem 5 easily maintaining stable frame rates.
All features of the desktop API work on the Librem 5 but mobile-specific features such as sensors and multi-touch aren’t implemented yet. To use touch input listen to mouse events.
The version in the repository is broken, but building from the latest source works as expected.
Pyglet is a 2D and 3D Python OpenGL game framework available for desktop operating systems and most Arm Linux distributions including PureOS on the Librem 5. Pyglet may not be as popular as PyGame but it has a simpler more “Pythonic” API and requires less boilerplate code making it perfect for beginners. But Pyglet isn’t limited by its simplicity, you get full access to SDL via the Python API, which means 3D, shaders and much more. Pyglet also has an active community, wiki, mailing list and Discord server.
# Python2 setup
sudo apt install unzip python-pyglet
# Python3 can be setup with pip
sudo apt install python3-pip unzip python3-setuptools freeglut3-dev python3-wheel
sudo pip3 install pyglet
# download examples
wget https://github.com/pyglet/pyglet/archive/v1.4.10.zip
unzip v1.4.10.zip
# run the asteroid example
export DISPLAY=:0
python2 ./pyglet-1.4.10/examples/game/version5/asteroid.py
python3 ./pyglet-1.4.10/examples/game/version5/asteroid.py
Pyglet also runs well on the Librem 5 but not as fast as LÖVE because Python is generally slower than Lua and significantly slower than LuaJIT. For simple games you won’t notice any slowdowns using Pyglet, but LÖVE and other C++/C based engines will allow you to make a more complex game.
All features of the desktop API work on the Librem 5 but mobile-specific features such as sensors and multi-touch aren’t implemented yet. To use touch input listen to mouse events.
We’re planning on testing Godot games and the editor but it won’t be useful on mobile until HDMI-out is enabled.
PyGame is probably the most popular Python game framework and it is often used for teaching so we’ll definitely be testing it soon.
Other things that comes to my mind are Allegro and MonoGame but I would love to hear the community’s suggestions.
Purism believes building the Librem 5 is just one step on the road to launching a digital rights movement, where we—the-people stand up for our digital rights, where we place the control of your data and your family’s data back where it belongs: in your own hands.