Skip to main content

LOVE2D Game Distribution | Windows

 



Go through the previous two posts if this is your first time getting started with LOVE2D.


Hello World With LOVE2D

Flappy Box Game With LOVE2D

After creating my first game with LOVE2D, i wanted to create an executable file, like we always do with games. And we can share that executable (.exe) file with our friends who can then play the game, without downloading the LOVE2D engine or Sublime text editor. 

I love that LOVE2D has so many options for Game distribution. You can distribute your game for the following platforms.

  • Windows
  • macOS
  • Linux
  • Android
  • iOS
  • Web
That's pretty cool. Right?

In this post, I am going to share how I created a .exe file in Windows to distribute my game. 

First, Let's know  a little about .love file

LÖVE Game File

LÖVE game files or .love files are games, packaged for the LÖVE engine.

The file format is the same as a Zip file format with a ".love" file name ending instead of ".zip".

LÖVE game files contain the main.lua at the top-most directory level of the Zip archive script and other assets (e.g. fonts, images, music, scripts, sounds, etc.).


Here's an interesting description I found on stackoverflow when I was browsing for solution that I came across while making the exe file.

Lets start by talking about how runnable 'lovechives' work: When love.exe starts up, it first checks its own name, if its called something other than love or love.exe it immediately checks to see if there is something stuck to its end. if there is, then it tries to interpret it as if it were a 'lovechive'.

So basically, we want to stick a zip-file to love's bottom

         - by Textmode

Let's find love.exe in your computer. It is located inside the folder where LOVE2D was installed (in your very first step). Mine is located in the default location.: C:\Program Files\LOVE>

So you can see love.exe and some other files inside the LOVE folder.  Double-click to open love.exe.


I hope this small animation thingy opened up for you as well. If you see closely, you can see the text "NO GAME" hanging from the bird's tail. Yes, that bird is our love. And you can call this animation thingy the default love game.
Now, what we will do is 'attach our own game to the bird's tail' i.e. take our game's .love file and bind it to love.exe. 


Okay, let's start. 

Create .love File

 First, we will just create a .love file of our game. We will just create a zip file of our and change the extension to .love. This sounds like a hack method, but it is actually the official way of doing it. 

It is a simple process. But I passed my whole day trying to do this. I misunderstood that when it said "create zip file", it meant any kind of archive file. So I created a .RAR archive. And that didn't work. Finally figured out that I'm supposed to make a .ZIP file exactly.
  1. Go inside your game folder. 


    Here, my game folder is flapbox. And it has only one content right now - main.lua

    1. Create zip archive of the contents of folder.

      - Select the contents of your game folder.
      - Right click on the selection to see the options. Click on "Add to archive" .



      Make sure you select ZIP. And rename the archive name to any_name.love.  You file can have any name, but MUST have .love extension.

      REMEMBER! You're supposed to archive the contents of the folder, not the folder flapbox itself.

    2. Is a .love file created?


    3. Open the love file.

      Opening up the love file should open up the game. If it doesn't open. you won't be able to make the executable file. 

    Create .exe File

    Like previously said, we will use the love.exe and bind our .love file to that file. 

    1. Open up your Command Line. You may have to run the command as an administrator on your computer. There are many ways to do this though.

      In Windows 10, I just search CMD and then run it as an administrator. 

    2. In command line, go to the LOVE2D folder. Mine is located in the default location.: C:\Program Files\LOVE> 

      If you are unsure how to do this, you can take help from this article.

    3.  Open up this LOVE folder in File Explorer. 

    4.  Copy the .love file (mine is flapbox.love) that you previously created and paste it in the LOVE folder that you opened above. 


    5. Now go back to your command line. And run the following command. 

      copy /b love.exe+flapbox.love flapbox.exe


      Here, flapbox.love is your .love file's name. And flapbox.exe is the name of the exe file that will be created. 

      PS: If you want to learn more about the copy /b command that we used, read here.

    6. Check your LOVE folder. There will be an exe file created with the name you wrote above. 


      Double-click to run the exe file and check it.
      This should open up your own game instead of the default love.exe animation we saw previously.


    Distributing the Executable

    Now that we have created the executable file, it's time to distribute it to your friends or any other game sharing platforms. 
    1. Go to the LOVE folder where your .exe file was created. 
    2. Select the necessary files and add them into an archive. (JAR or ZIP or any archive)


      The important files are : your .exe file and the dll files. Other files like changes.txt, readme.txt etc are optional. You can edit these text files according to your need. 

    3. Rename your archive file and move it somewhere else.


    4. Now you can just send this archive file to your friends or upload in some platforms for sharing. All they will have to do is --> Extract the file --> Run the .exe file. 

    5. To make sure, check yourself too. Extract the archive and run the .exe file.
    6. Run the exe file to play the game.

    Comments

    Popular posts from this blog

    Timi Uta Ma Yeta (Sunsaan Raat Ma) Guitar Chords - Pratik Gurung Cover - Original by Milan Newar, Rajan Raj Shiwakoti

     I came across this song when Kanden Limbu sang this in Nepal Idol.  He was one of the contestants. I thought it was his original. Surprisingly, it is not. His was based on Pratik Gurung's cover. This is actually a full fledge song with a music video. Here's the original one. However, I like the cover version. Here are the chords for a portion of the song. The chords are based on this tutorial . In the tutorial, plucking is used. You can strum as well if that's what you prefer.  CAPO: 2nd fret STRUMMING: D-DU Plucking used: 5-2-3 (C and Am), 4-2-3 (FT and GT), 6-2-3 (G) Chords: C, Am, G Major, F Major Triad (FT), G Major Triad (GT) NOTE: It's easier if you play G Major in C's original position; just move 2 and 3 fingers one step up.   C                             Am (Sunsan raat ma yo mero aatma FT               GT    C Chasakka bi...

    Bikharney Ka Mujhko Shauq Hai Bada | Qala | Guitar Chords and Lyrics

    Full song here:  https://youtu.be/-lcd1ixHqjE?t=670  or here  https://youtu.be/1Hd7Gl_mLzw G                                             C Bikharney Ka Mujhko, Shauq Hai Bada G                D                        C  G  D Sameitega Mujhko, Tu Bata Zara... G                                                C Haaye, Bikharney Ka Mujhko, Shauq Hai Bada G                D                        C  G  D Sameitega Mujhko, Tu Bata Zara... G D G G        ...

    Pokhiyera Ghaam Ko Jhulka Guitar Chords|| Narayan Gopal || Ambar Gurung || Hari Bhakta Katuwal

      Pokhiyera Ghaam Ko Jhulka Guitar Chords || Narayan Gopal  Composer: Ambar Gurung Lyrics: Haribhakta Katwal Vocals: Narayan Gopal Guitar Chords based on tutorial by Nepali E-Chords . I take no responsibility if the chords are not absolutely right. But it sounded good enough for me.  Chords used: G, C, D, Am, Em, Bm Strumming: D-DUDU Intro: D       G      D             G              D      G Pokhiyera Ghamko Jhulka, Bhari Sangharama G                     D                     Em                G Timro Jindagiko Dhoka, Kholu Kholu Lagchha Hai Am                     C  ...