Quick! Set up a LÖVE2D dev environment on Windows ! – A tutorial

love

This article is based on notes I had made to help quickly setting up projects using the Löve 2D game framework on Windows environments.

Not so quick… Or why you should or shouldn’t read this guide

If you aren’t interested in the context of creating this little guide, you can skip this section.

In summary:

  • this guide was written with a game jam in mind, so it may not present the very best technologies at hand for the task, but the fastest, easiest ones to install and get running I could find
  • this guide isn’t a tutorial on how to program in Lua and/or Löve
  • your mileage may vary — I personnally tested on my machines that the procedure worked on Windows 8.1 and Windows 10, but even with those versions, you may face problems I didn’t have

Long version:

I originally made this prior to attending a game jam, to be able to speed up the actual environment setup phase of the jam project. Hence, the environment presented in this guide may not be the best ever, but it aims to solve « real life problems » ( © )  that arise when you’ve got to start a project very quickly because you’ve got so little time to do it.

Ultimately, I didn’t participate to the jam I initially wrote it for, so I’m not sure how well it works within an actual team working on a real game with two days to make it. I’ve just been able to assess how it worked on my own, basic installation of Windows 10, so what I can say is that basically, it works at least on Windows 10, it probably works on Windows 8.x, and I can’t think of a reason why it wouldn’t work on a Windows 7. But of course, YMMV.

As to why this guide targets Windows ? Well, until now I’ve mainly seen Windows users in game jams (mainly because they’re used or expecting to work with Unity), so I thought it would be more useful to have this kind of stuff handy for a Windows environment. Plus, I already knew how to do this on Linux, but I was unsure of how it would work on Windows, so it also was a learning experience.

Enough words – let’s get it started !

First things first – install LÖVE and Lua

If you’re still reading it probably isn’t a mystery for you that Löve is built on top of the LUA scripting language.

Lua-logo-nolabel.svg

So the first thing you have to do is actually to install LÖVE and Lua in order to be able to work on games.

Once it is done, I had to add the paths to LÖVE and Lua to my PATH environment variable so we’re able to use the « lua » and « love » executables from anywhere.

The way I usually do it is to start typing « env » in a Windows search and it brings up the proposal  « Edit environment variables for your account », which is what we want. Otherwise, you can also set it system-wide. All you have to do is to append those paths to the PATH variable (remember to separate them with semicolons !). On my machine (64-bit), LÖVE was located in C:\Program Files\LOVE whereas Lua installed itself in C:\Program Files (x86)\Lua.

If you want to check your edits worked, you can open a command prompt and try using lua and love commands: it it works, then you’re ready to go to the next level.

 

Which development environment ?

The IDE to use is a pretty big question when working on a very short period of time. Basic comfort of use, especially decent syntax hilighting, is key when working for a game jam: unless you’re a veteran coming with a full-fledged preinstalled development environment, you’ll want something quick to install that doesn’t require hours of configuration just to get pretty colors and some useful features (think: you may have to make someone that doesn’t have all this stuff install all of it as quickly as possible).

Baiscally, the right answer to this question should primarily be:  what you’re the most comfortable with. In other words, it may be an error to try and use a text editor you’ve never seen before just because it seems it has pretty good support for Lua. First of all, check the Lua and / or Löve support on your editor of choice to see if it’s a good match for the language, or if you’ll need to get something else.

Amongst the possible candidates for an IDE to use with Löve, these were the ones looking most promising to me :

  • Visual Studio
  • Atom
  • ZeroBrane Studio
  • Sublime Text

vs

I first tried with Visual Studio because I know it well and I’m currently working with it.

I saw there was an extension for VS called Babelua I could use to program in LÖVE : yay ! Lua support in Visual Studio ! Plus, with the recent release of VS Community Edition, anyone can install it and use it for free, so that deserved a try. Unfortunately I was quickly disappointed: the extensio failed to install on Visual Studio, giving a cryptic error message about a dynamic library, Decoda.dll. That was on Visual Studio 2015 Enterprise Edition, with Windows 8.1, so using a pretty recent setup, and I couldn’t find any fix for it. Running into a problem so early in the process discouraged me from using Visual Studio for this task.

atom

The other editor in the list I knew is Atom. Atom is the open source Github text editor, supposed to be kind of a text swiss-army knife, with a lot of languages supported and some cool features available out of the box. Since I had it already installed I gave it a go.

First, decent LUA syntax highlighting is immediately available. I don’t know if it’s the best one in town (I never programmed in Lua before digging into LÖVE), but it was fulfilling my needs.

Then I sought to install helper modules to make working on LÖVE games specifically easier. That’s when I found a little cool package: love-ide (warning ! dependencies need Git). It enables you to add more syntax highlighting and smart suggestions based on specific Löve types and functions, which is very valuable. Plus, it adds a little « Run » icon on top of the editor, which enables you to quickly restart your application to see the changes you just made. I think this is pretty fantastic. It also depends on other packages that may or may not be of interest to you, such as a GLSL syntax highlighter (for shaders), so it maybe isn’t the lightest « Löve friendly » package out there, but I think it is a pretty good, polyvalent one. I had a minor problem with it though: it seems it didn’t find the Löve executable at first (although I already added it to the PATH…), so you may have to do like me and specify it explicitly to the package in its settings to make it work. I didn’t encounter any problems after this one.

You may also want to install the sublime-style-column-selection package that enables you to make rectangular selection by holding Alt when selecting, which is pretty useful to indent blocks of code.

Nevertheless, Atom has one drawback that you may consider a major one, based on the size of your project: it isn’t an IDE. Hence it doesn’t have fancy features such as a debugger, breakpoints, console output, watches etc… It stays pretty basic. But once again, what I searched for was an application easy to install, decently quick to launch and configure to start working efficiently, not the best tool ever that has lots of killer features but may need hours of configuration. For the use I intended to have of it (let’s be clear: quick’n’dirty games !), Atom, augmented with the little packages I found, seemed to perfectly fit the bill.

The others

So as you perhaps expect, I did not try out ZeroBrane Studio (which, on the other hand, is said to be the perfect match when you want to program in Lua, with debugger support and all), nor Sublime Text (which is a lot like Atom), first because I had found a tool that worked « well enough » for what I wanted to do (Atom), then also because I never used them, and I didn’t want to lose more time trying to learn how to use editors I knew next to nothing of.

However if you don’t know anything about the editors I presented, maybe you should try ZeroBrane first if you want to make LÖVE games. I understood that, as an IDE specifically designed to support Lua, it also supports the main frameworks using Lua such as LÖVE, and so, perhaps it would be the best tool for the job. Once again, I did not have the time to really investigate it. But if you have lots of time to look around, I think you should at least take a peek at what it’s capable of.

 

The version control system : Git

git-logo_bv0ydu

Git is my usual go-to tool when I want to do version control on a project. It is free (as in free software) and quite simple to use once you’re used to it. In this context, I admit I also chose it because some dependencies of the Atom love-ide package I mentioned previously needed to have Git available on the system. If you would like to have a project management workflow a bit more sophisticated than passing files around on an USB stick, you’ll probably want to use this kind of tool. In this part we’re going to see how to quickly install it from nothing and how to get it going with our project.

Installing

Fortunately, the state of Git on Windows, as an originally Unix-world tool, has much improved in the past few years. You can start by installing it at https://git-scm.com/download/win. Note that the guide has been written using general default parameters. If you customize your installation, some steps may not exactly be the same…

Clone the repository

Once it is done, you’ll be able to use Git Bash (the command-line tool) and Git GUI. Since the command line can be a pain to use for newcomers, I tried to use the GUI in my test as much as possible. Note: it isn’t a guide on how Git works. We’ll just see how to work with it.

To be able to share your work with others you need to clone a Git repository. If you have no server at hand on your own, you can use either Github or Bitbucket online ones (all it takes is an account), though private repos aren’t an option with Github free accounts, so that’s your choice. If you’re working in the same space with your team,  you should even be able to host a repository on one of your PCs and access it on the others, but I didn’t try that.

Anyway, as far as I tested, the Git GUI only works with SSH keys. You can interact on the repository with passwords, but you’ll need to use Git on the command line then. If using SSH keys isn’t a problem for you, here’s how to do in the GUI:

  • In the main menu, locate the « Help » tab, hover it and select « Show SSH Keys »
  • You should have none. You can generate one using the « Generate Key » button (passphrase is optional)
  • Once it is generated, you need to provide the contents of the public key (the « .pub » file) to your remote repository, on Github or elsewhere, to be able to pull and push commits on it.

If the procedure is complete, by going back to the main menu you should now be able to « Clone existing repository », specify the address of the remote Git repository, and a target directory on your PC to clone into (note: the folder you provide must not already exist).

I noticed one problem, however: it seems (may it be a bug in the GUI or something else ?) that you can’t clone an empty repository that way. It is strange since it perfectly works when using the command line. So your best bet would probably be to use the command line this one time to « initiate » the repo with a kind of empty commit (like adding a README file. README files are cool). Once it is done you’ll be able to clone the repository in the GUI.

I also noticed a similar problem (bug ?) when looking at the master branch history: you’ll need to make at least one commit to see it. But I can’t tell you why…

end


This article comes to an end, this is how you can rather quickly kickstart yourself using tools such as LÖVE and Git to start your jam project !

If you’d like to go further, you could check out the following…

  • How to make a .gitignore file on Windows
  • You could install the love-release tool to help streamlining the process of releasing new versions of your LÖVE game. However, when I tried to install it, I failed because of some error in LuaRocks (since love-release depends on it), so I wasn’t able to test it. But I thought that since bundling a LÖVE game is basically making a ZIP file of the game files and concatenate it with your love.exe file, it is easy to make a quick and dirty batch script that basically makes it for you, so you can just run it to generate a new version…

That is it. Have fun !

Laisser un commentaire

Votre adresse de messagerie ne sera pas publiée.