[Tutorial][0.10] Distributing on all platforms

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
User avatar
yancouto
Prole
Posts: 8
Joined: Sat Jan 21, 2017 2:14 pm

[Tutorial][0.10] Distributing on all platforms

Post by yancouto » Thu Nov 29, 2018 2:20 am

My team released a LOVE game on Steam, Marvellous Inc. We had a lot of difficulty in getting it working on all platforms, since we couldn't assume the user had LOVE installed.

This tutorial shows how we managed to get everything working. It assumes you're using Linux. (If you're not, then it is pretty easy to get a VM running on VirtualBox)

Distribution

Windows/OSX

This ones are pretty straightforward. The only difficulty is installing love-release, since it depends on external libraries and luarocks isn't so easy to install.

You need to install luarocks 3.0.4 and libzip-dev to get it love-release 2.0.9-1 working. You can use the script below to get the correct versions and install love-release: (I tested it on a brand new Ubuntu 18.04 VM, so should work on most debian-based systems)

Code: Select all

#!/bin/bash
# Installing love-release may be cumbersome, this should help
# This works for love-release version 2.0.9-1
# Gist link https://gist.github.com/yancouto/f893b4bfe6c0a3f1ea8bdd3f01efcf68

set -e

sudo apt-get update
# These should already be installed, but who knows
sudo apt-get install -y git make
# love-release depends on libzip and luarocks needs lua
sudo apt-get install -y libzip-dev lua5.1 lua5.1-dev
wget http://luarocks.github.io/luarocks/releases/luarocks-3.0.4.tar.gz
tar xf luarocks-3.0.4.tar.gz
cd luarocks-3.0.4
./configure
make
sudo make install
sudo luarocks --tree=system install love-release 2.0.9-1
Now test it by running

Code: Select all

love-release --help
# It should print a bunch of options
Now that you have love-release installed, it should be easy. Go to inside your game folder (where your main.lua lies), and run the following commands

Code: Select all

love-release -W 32 # Windows 32 bit
love-release -W 64 # Windows 64 bit
love-release -M --uti public.executable # OSX
to create binaries for all platforms. This will create zip files for the platforms. The Windows zipfile will contain an .exe with the same name as your game. The OSX zipfile will have a .app folder, that in an OSX can be double clicked to run the game.

The good thing about this is that the the user will not need to have love pre-installed to run the game.

love-release has a bunch of options, I recommend tuning then in your conf.lua.

Linux

Ironically, distributing to Linux using Linux is the hardest. love-release has no support for linux (only for .deb packages, but they do not contain love and need sudo to be installed).

The best way we found to distribute is using AppImages: these are self-contained linux executables that work on most distributions. Building an AppImage from scratch, though, is no easy task. It is very complicated to get the libraries in the correct version, and make sure it works on other distros.

The best approach is to reuse another AppImage. You can grab ours :), it's on our releases page. Grab, for instance, this Marvellous_Inc-x86_64.AppImage file, and run the following commands:

Code: Select all

# This makes it executable
chmod +x Marvellous_Inc-x86_64.AppImage
# This runs the game, play a little :)
./Marvellous_Inc-x86_64.AppImage
# This extracts the useful files
./Marvellous_Inc-x86_64.AppImage --appimage-extract
This will create a squashfs-root directory with a bunch of stuff inside. The important files are:
  • AppRun - This is the file that runs when you run the executable
  • MarvInc.love - This is the game
You can then just replace MarvInc.love with your game. If it is called game.love, you can add the game.love file to the squashfs-root directory and modify the last line of the AppRun file so that is runs your game instead of MarvInc. It will look like this:

Code: Select all

exec "./usr/bin/love" "./game.love" --fused "$@"
Also check out the "marvellous.desktop" file and add the name and info from your game. After that, run the AppRun file to see if it is working. If it is, we just need to package it into a single file again. To do that, go back to the outer directory and run the following

Code: Select all

# Download the AppImage creation tool
wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage
# Make it executable
chmod +x appimagetool-x86_64.AppImage
# Run it on squashfs-root
./appimagetool-x86_64.AppImage squashfs-root
This should create a game-x86_64.AppImage file that you can run, and that's it! You have executables for your game in all platforms!

What about love 11?

Love 11 was released while we were developing the game, so we chose not to port to it. This guide focuses on 0.10.2, but the ideias may work for Love 11:
  • love-release: I'm pretty sure love-release still works with Love 11, so Windows/OSX should work the same
  • AppImage: Finally love is out of the box distributed as an AppImage. This makes it way easier for distributing. You can just make a shell script that runs the AppImage on your game.love, or you can try to mess up inside the AppImage to add your game there, as we did in this tutorial.
Deploying on Steam

After you have the executables, making them work with Steam is easy (After you figure out what depot and other terms are :D). If you're having difficulty in this part, let us know and we can help.

Steamworks Integration

To get achievements working (among others), you need to be able to use the Steam API. We managed to solve this (there are Steam achievements on our game \o/), and I can do a tutorial on that in the future.

Our game

Marvellous Inc. is available on Steam. You can see the code on our GitHub repository.

Our Team:
Renato Lui Geh (I don't think he has a forum account)
Yan Soares Couto (@yancouto)
Ricardo Lira Fonseca (@rilifon)
Last edited by yancouto on Sun Dec 09, 2018 10:44 pm, edited 1 time in total.

User avatar
Rucikir
Party member
Posts: 128
Joined: Tue Nov 05, 2013 6:33 pm
Location: Paris
Contact:

Re: [Tutorial][0.10] Distributing on all platforms

Post by Rucikir » Mon Dec 03, 2018 1:08 pm

Hi,

I’m happy to see that love-release worked for you.
If you'd like to contribute an AppImage script for love-release, or any new feature or bugfix, I'd be happy to include it.
Lua script to distribute your LÖVE games. love-release.lua : Forum | Github
@Rucikir

Post Reply

Who is online

Users browsing this forum: Exabot [Bot] and 5 guests