Love2D Tutorial Linux
September 15, 2018
Harvard’s CS50 created the Introduction to videogame development course that I started following with the Italian Gameloop.it community.
This course requires students to edit some pre-made game projects that were originally made with Love 0.10. Unfortunately they are not compatible with the newest Love2D version that you find in most Linux distros (v11.1 at the time of writing), but these simple guide will help you fixing this issue.
⚠ UPDATE: a new version of the push library has been released in 2020 🎉 Check it out, it should be compatible with the latest Love2D versions.
If you run the first assignment with Love v11.1, you will probably get this error:
Error push.lua:101: attempt to call field 'getPixelScale' (a nil value) Traceback push.lua:101: in function 'initValues' push.lua:48: in function 'setupScreen' main.lua:93: in function 'load' [C]: in function 'xpcall' [C]: in function 'xpcall'
The solution is to install an older version, but this is not trivial on Linux systems so here it is how to do it on Ubuntu and Manjaro (my main operating systems).
Luckily Love2D has a a list of older Ubuntu packages hosted on bitbucket
and that is what I used to download a Love2D Debian package
.deb and install it on Ubuntu 18.04:
# uninstall Love2D (this is needed only if you already installed it) sudo apt purge love # download Love2D 0.10.2 and the liblove dependency (links are for x64 architecture) wget https://bitbucket.org/rude/love/downloads/love_0.10.2ppa1_amd64.deb wget https://bitbucket.org/rude/love/downloads/liblove0_0.10.2ppa1_amd64.deb # install Love2D 0.10.2 sudo apt install libphysfs1 # required dependency sudo dpkg -i love_0.10.2ppa1_amd64.deb sudo dpkg -i liblove0_0.10.2ppa1_amd64.deb
Now you should be able to type
love in the terminal and see the correct
To start your game just specify the path to the game folder, in example
If you use Arch Linux (or Manjaro, Antergos and similar derivatives) you won’t find prebuilt Love2D packages on their website. So we have to download the source code and compile it by ourselves.
# download love 0.10.2 source code wget https://bitbucket.org/rude/love/get/0.10.2.tar.gz # decompress and extract the archive tar xzf 0.10.2.tar.gz # enter the project directory cd rude-love-afc69c4f7145 # Install the build dependencies. For me only this one was required: sudo pacman -S physfs # but feel free to install al the ones listed in here # in the official Love2D build instructions: https://love2d.org/wiki/Building_L%C3%96VE#2._Dependencies # build the binary ./platform/unix/automagic ./configure make # install sudo make install
In case you want to remove this package, go into the build directory and then:
# if you want to remove the packages sudo make uninstall
On a final note it’s probably better to create a package and then install it
pacman. Actually I never used the ABS (Arch Build System) so maybe now I have a good excuse to use it.
Hope this will help some new GNU/Linux user, I guess not everyone is a pro and sometimes a little guide like this one can be helpful.