Difference between revisions of "Game Distribution"

(Making a .love-file: Simplified instructions, added some examples)
(Making an executable file out of a .love-file: Restructured and clarified some instructions (e.g. modification of Info.plist))
Line 33: Line 33:
 
     zip -9 -q -r SuperGame.love .
 
     zip -9 -q -r SuperGame.love .
  
== Making an executable file out of a .love-file ==
+
== Creating a Windows Executable ==
  
Many people are (understandably) concerned about what end-users need to do in order to run a LÖVE-game. If users receive a .love-file alone, they will naturally need LÖVE installed (or at least unzipped) in order to run it. But, as of LÖVE 0.5.0, you can merge the .love file with the love executable.
+
Once you have packed your game into a .love file you can create a game executable that directly runs your game.
  
In general, it's recommended to offer a .love for download, and optionally "merged" versions for the platforms where this makes things simpler.  
+
For this you have to append your .love file to the love.exe file that comes with the official Löve .zip file. The resulting file is your game executable.  
  
Two things should be noted:
+
Once you have your game executable you can pack it together with all the other DLL files of the official Löve .zip file into a new .zip file and share this with the world.
# The end result will not be a single executable, you must also include some DLLs in your zip-file.  
 
# The resulting executable from the merge will still be readable by archiving software, such as WinZip.
 
  
Make sure that love.exe and the DLL files in the installation folder, and your game.love, are in the same directory.
+
'''Note:''' it is highly recommended to use the '''32-bit''' build of the Löve engine instead of the 64-bit version.
  
Then use one of these following methods:
+
=== Platform Specific Instructions ===
  
=== Windows ===
+
==== Windows ====
Here's how to do it on Windows. Open up a command prompt and type the following,  where ''love.exe'' points to the LÖVE executable and ''game.love'' points to your zipped game.
 
  
''<tt style="font-size:1.3em"> copy /b love.exe+game.love game.exe</tt>''
+
To create your game executable under windows use the command line to run
  
You can also make a .bat file, where you include the following:
+
    copy /b love.exe+SuperGame.love SuperGame.exe
  
''<tt style="font-size:1.3em">copy /b love.exe+%1 "%~n1.exe"</tt>''
+
Alternatively you can create a .bat (e.g. create_game_exe.bat) file with the contents
  
Now just drag your game.love on the .bat file (Thanks to Yellowafterlife).
+
    copy /b love.exe+%1 "%~n1.exe"
  
It's recommended to use the 32-bit version for this as it will run on every Windows. The 64-bit one only runs on 64-bit Windows.
+
and then you can simply drag your SuperGame.love file onto the .bat file and it will create the file SuperGame.love.exe which you could then use for distribution.
  
Then, all you have to do is zip game.exe and the required DLLs, and distribute them. Yes; this does mean that the game will have a private copy of LÖVE, but there's nothing wrong with that. It also means that you will have to create one package for each platform you would like to support, or simply offer the .love alone for the other platforms.
+
==== Linux / OS X ====
  
=== Linux ===
+
In the command line run
  
On Linux, it's similar:
+
    cat love.exe SuperGame.love > SuperGame.exe
  
''<tt style="font-size:1.3em"> cat /usr/bin/love game.love > game && chmod +x game</tt>''
+
to obtain the game executable <tt style="font-size:1.3em">SuperGame.exe</tt>
  
Then, you'll have to make a package for various packaging systems with dependencies as the love package. Were you to make a .deb package this way, for instance, the user would not have to install the love package separately.
+
== Creating a MacOS X App ==
  
Eventually, we will provide scripts which do this automatically for various package systems. You'll have to figure it out yourself until then.
+
Once you have your game prepared as .love file you can make your game available for MacOS/X users using the official Löve Zipped Universal Build from [https://www.love2d.org https://www.love2d.org]. This will then run directly your game instead of the Löve demo.
 
=== Mac OS X ===
 
  
As of 0.6.1, it is now easier to create ready-to-distribute stand-alone Love games by following these steps:  
+
These are the steps required:
# First create a copy of the löve.app
 
# Right-click (Control+Click if you have one button) to bring up the contextual menu and select "Show Package Contents"
 
# Navigate to Contents/Resources/. There should be two .icns files in there. Copy your already prepared .love file into Resources.
 
  
Next, you need to edit /Contents/Info.plist. The main reason is that if you don't, your game will conflict with another LÖVE installation present on the user's machine, so that double-clicking any .love might open your game instead. The reasons are that when you launch the game, the Dock icon is still the default löve icon and the title is "love". To change this, all you need is a small amount of computer knowledge and the right tools. A text editor, or the OS X Property List Editor.app which comes with the Developers tools on the install disc. You can use either, but the PLE is easier to understand. The file you need to modify is the Info.plist file located in the Contents folder. Once opened in PLE, you will see a list of "properties". You need to make a couple of big changes: (Make sure to double-click the "Value" column and not the "Key").
+
# Unpack the Zipped Universal Build from [https://www.love2d.org https://www.love2d.org]
* Bundle identifier - Make this something like com.yourcompany.whatever
+
# Rename love.app to SuperGame.app
* Bundle name - Changes the title in the Dock
+
# Copy your SuperGame.love to SuperGame.app/Contents/Resources/
* Bundle creator OS Type code - Make this unique if you can.
+
# Modify SuperGame.app/Contents/Info.plist
* Icon file - Optionally if you wish to make your icon a different file name. You could just replace the icon itself if you wanted to without renaming it though
+
# Zip the SuperGame.app folder (e.g. to SuperGame.osx.zip) and distribute it.
  
Then, remove these sections by clicking the '-' that appears when you hover over it. This will avoid your application launching for any .love file:
+
When modifying the file SuperGame.app/Contents/Info.plist make sure to change the values of the following XML-tags:
* Document Types
+
 
* Exported type UTIs
+
* <tt>CFBundleIdentifier</tt>
 +
* <tt>CFBundleName</tt>
 +
 
 +
and remove the section <tt>UTExportedTypeDeclarations</tt>. E.g.
 +
 
 +
{| border="1" cellpadding="1" cellspacing="0"
 +
!width="300"|Original Info.plist
 +
!width="300"|Modified Info.plist
 +
|-
 +
|
 +
    ...
 +
    <key>CFBundleIdentifier</key>
 +
    <string>org.love2d.love</string>
 +
    ...
 +
    <key>CFBundleName</key>
 +
    <string>LÖVE</string>
 +
    ...
 +
    <key>NSPrincipalClass</key>
 +
    <string>NSApplication</string>
 +
    <key>UTExportedTypeDeclarations</key>
 +
    <array>
 +
    ...
 +
    </array>
 +
    </dict>
 +
    </plist>
 +
|
 +
    ...
 +
    <key>CFBundleIdentifier</key>
 +
    <string>'''com.SuperCompany.SuperGame'''</string>
 +
    ...
 +
    <key>CFBundleName</key>
 +
    <string>'''SuperGame'''</string>
 +
    ...
 +
    <key>NSPrincipalClass</key>
 +
    <string>NSApplication</string>
 +
    </dict>
 +
    </plist>
 +
|}
 +
 
 +
== Distribution for Linux ==
 +
 
 +
For Linux there is not yet a simple way to distribute your game. The general approach here is to point to the official Löve packages at [https://www.love2d.org https://www.love2d.org]. Once the package is installed the .love packages are usually automatically executed using the installed Löve package.
  
 
== Distribution on the web ==
 
== Distribution on the web ==

Revision as of 21:34, 30 April 2013

Create a .love-file

Please note that some operating systems use case-sensitive paths. To avoid unnecessary hassle make sure that the path specifications you use in code matches that of your folders and files.

To create a .love-file you have to create a zip file of the whole game directory. Make sure that your main.lua is in the root of the archive, e.g. if you have

   <somedir>\SuperGame\gfx\character.png
   <somedir>\SuperGame\main.lua
   <somedir>\SuperGame\conf.lua

You must ensure the zip file containts

   gfx\character.png
   main.lua
   conf.lua

and not the directory SuperGame\.

Once you have your zip file you simply rename the ending from .zip to .love and you are done!

Platform Specific Notes

Windows

Windows supports creation of zip files out of the box. For detailed instructions see http://windows.microsoft.com/en-hk/windows-vista/compress-and-uncompress-files-zip-files

Alternatively you can use the Distribution Utility that is available here

Linux / OS X

Assuming your current directory is SuperGame/ you can create the .love file from command line directly using

   zip -9 -q -r SuperGame.love .

Creating a Windows Executable

Once you have packed your game into a .love file you can create a game executable that directly runs your game.

For this you have to append your .love file to the love.exe file that comes with the official Löve .zip file. The resulting file is your game executable.

Once you have your game executable you can pack it together with all the other DLL files of the official Löve .zip file into a new .zip file and share this with the world.

Note: it is highly recommended to use the 32-bit build of the Löve engine instead of the 64-bit version.

Platform Specific Instructions

Windows

To create your game executable under windows use the command line to run

   copy /b love.exe+SuperGame.love SuperGame.exe

Alternatively you can create a .bat (e.g. create_game_exe.bat) file with the contents

   copy /b love.exe+%1 "%~n1.exe"

and then you can simply drag your SuperGame.love file onto the .bat file and it will create the file SuperGame.love.exe which you could then use for distribution.

Linux / OS X

In the command line run

   cat love.exe SuperGame.love > SuperGame.exe

to obtain the game executable SuperGame.exe

Creating a MacOS X App

Once you have your game prepared as .love file you can make your game available for MacOS/X users using the official Löve Zipped Universal Build from https://www.love2d.org. This will then run directly your game instead of the Löve demo.

These are the steps required:

  1. Unpack the Zipped Universal Build from https://www.love2d.org
  2. Rename love.app to SuperGame.app
  3. Copy your SuperGame.love to SuperGame.app/Contents/Resources/
  4. Modify SuperGame.app/Contents/Info.plist
  5. Zip the SuperGame.app folder (e.g. to SuperGame.osx.zip) and distribute it.

When modifying the file SuperGame.app/Contents/Info.plist make sure to change the values of the following XML-tags:

  • CFBundleIdentifier
  • CFBundleName

and remove the section UTExportedTypeDeclarations. E.g.

Original Info.plist Modified Info.plist
   ...
   <key>CFBundleIdentifier</key>
   <string>org.love2d.love</string>
   ...
   <key>CFBundleName</key>
   <string>LÖVE</string>
   ...
   <key>NSPrincipalClass</key>
   <string>NSApplication</string>
   <key>UTExportedTypeDeclarations</key>
   <array>
   ...
   </array>
   </dict>
   </plist>
   ...
   <key>CFBundleIdentifier</key>
   <string>com.SuperCompany.SuperGame</string>
   ...
   <key>CFBundleName</key>
   <string>SuperGame</string>
   ...
   <key>NSPrincipalClass</key>
   <string>NSApplication</string>
   </dict>
   </plist>

Distribution for Linux

For Linux there is not yet a simple way to distribute your game. The general approach here is to point to the official Löve packages at https://www.love2d.org. Once the package is installed the .love packages are usually automatically executed using the installed Löve package.

Distribution on the web

There is an experimental project to run .love games in a WebGL capable browser (up to date firefox,opera,safari...) without needing extra plugins, see forum thread

Mobile distribution

There is an experimental project to run .love games natively on android phones, see subforum

Other Languages