So I learned batch and made a batch script in half a day instead. It automates the process of building your game into an executable. No packages, no programs, no other complicated stuff, just a single script. It even copies the .dlls you need. All you have to do is set the variables with the correct formatting listed in the file, make sure it works, and package your game folder however you like. If you're like me and don't know much batch syntax, look at the examples.
Github Repo
lovebuild.bat
This script WILL overwrite the files in your output build folder, so if you want to archive your builds, backup the contents.
Code: Select all
@echo off
REM User settings
REM If you want paths relative to the .bat script's location, use %CD% or %~dp0, or use the full file paths. However you do it, you MUST include a `\` at the end. %~dp0 appends a `\` at the end, %CD% does not.
REM Do not add quotation marks around your folder or file names.
set src=<directory that contains main.lua>
set love=<directory that contains love.exe>
set build=<directory to output your .exe to>
set name=<name of your game>
REM Execute program
set output=%love%%name%
powershell Compress-Archive -Path '%src%*' -DestinationPath '%output%.zip' -Force
move "%output%.zip" "%output%.love"
copy /b "%love%love.exe"+"%output%.love" "%build%%name%.exe"
xcopy "%love%license.txt" "%build%" /r /q
xcopy "%love%love.dll" "%build%" /r /q
xcopy "%love%SDL2.dll" "%build%" /r /q
xcopy "%love%lua51.dll" "%build%" /r /q
xcopy "%love%OpenAL32.dll" "%build%" /r /q
xcopy "%love%mpg123.dll" "%build%" /r /q
xcopy "%love%msvcp120.dll" "%build%" /r /q
xcopy "%love%msvcr120.dll" "%build%" /r /q
del "%output%.love"
Folder Structure:
Code: Select all
C:\Users\Admin\Desktop\Game Project\
+-- Build
+-- Love
| +-- love.exe
+-- Source
| +-- libs
| +-- main.lua
+-- lovebuild.bat
A relative path ensures that the location of your project folder is irrelevant to the functioning of this build-automation, so long as the rest of your project folder structure remains the same. It is the setup I recommend. If you happen to place your script elsewhere and use a relative path, use ..\ to go up one level.
Code: Select all
set src=%~dp0Source\
set love=%~dp0Love\
set build=%~dp0Build\
set name=Giga Galactic Giants
Code: Select all
set src=C:\Users\Admin\Desktop\Game Project\Source\
set love=C:\Users\Admin\Desktop\Game Project\Love\
set build=C:\Users\Admin\Desktop\Game Project\Build\
set name=Giga Galactic Giants