Quantcast
Channel: Envato Tuts+ Game Development
Viewing all articles
Browse latest Browse all 728

How to Learn LÖVE (Love2D)

$
0
0

LÖVE (aka Love2D) is a free, lightweight gamedev platform developed by a vibrant community, enabling everyone to create 2D games relatively quickly. In this article, we’ll introduce you to the LÖVE platform and its capabilities, and share books, tutorials, and suggestions to get you started developing games with it.


What Is LÖVE, and What Can It Do?

LÖVE is an *awesome* framework you can use to make 2D games in Lua. It’s free, open-source, and works on Windows, Mac OS X and Linux.Taken from love2d.org

The LÖVE platform is developed in C++ and implements some great cutting-edge techniques. The relatively short learning curve of LÖVE means you can start developing immediately – this is largely thanks to LÖVE using the lua programming language, which is fairly simple to pick up. Furthermore, the engine has a self-explanatory structure.

LÖVE in Action

Most of the games built with LÖVE are created by indie developers; check out this list for some examples.

Here are two great LÖVE games:

Mari0: This is one of the most impressive LÖVE games out there. It is a hybrid of Mario and Portal, creating a mind-blowing result.

Snayke: Snayke can be summed up in three words: snake on steroids.

As you can see, LÖVE is quite powerful.

Notable Features

  • Networking abilities
  • Box2D ported implementation (physics)
  • Support for many image and audio formats
  • Particle effects
  • User-created libraries (plugins)
  • Uses the super flexible license (zlib/libpng license)

Since LÖVE is open source, you are free to use the engine for commercial purposes.

Is LÖVE Bulletproof?

As mentioned above, LÖVE is mainly used for 2D games. While 3D tricks can be implemented, LÖVE was not created for these type of games. I’d also add that LÖVE is officially supported only for desktop machines.


Installing LÖVE

First you will need to download the latest version of LÖVE.

Then just go ahead and install it – it’s as simple as that!

LÖVE has no official IDE (Integrated Development Environment) yet, so you will need to choose a preferred editor, such as:

Here is a nice tutorial on choosing the right one for you: Windows / OSX. (Written By Headchant.)


Learning Lua

Let’s start by learning some lua.

As mentioned earlier, lua is the programming language LÖVE uses, so you will need to have at least some idea of how lua works to be able to create your game. Fear not – it is not that hard.

Lua is quite strong in the game development industry; some examples of games which use (usually embed) lua are: Garry’s-mod, Baldur’s GateCompany of Heroes, and Crysis. It’s also used to power Roblox games.

Lua is used so much mainly because it is easy to learn, extensible, lightweight, simple to embed, portable, and has OOP (Object Oriented Programming) capabilities.

If you really want to get serious and learn lua in depth, I recommend Programming in Lua, Third Edition:

Programming in Lua, Third Edition
Programming in Lua, Third Edition

If you already have some past experience with programming, then I also recommend Michael Ebens’ four-part Lua for Programmers tutorial series:

  1. Variables, Operators, Loops and Functions
  2. Tables, Strings, Numbers & Math
  3. Blocks and Scope, More Function Concepts, Loading files and Metatables
  4. Tips and Tricks

Michael Ebens’ entire blog, Nova-fusion, is a great place to start learning lua and LÖVE; I suggest bookmarking it!


Learning LÖVE

After learning lua, let’s implement it with LÖVE. There are plenty of tutorials out there waiting for you to read them. But what will it add if you “zig-zag” between advanced and novice tutorials? Nothing!

So here’s a breakdown of the tutorials into difficulty level and suggested order:

Official Tutorials

First off, lets break the LÖVE’s wiki tutorials into difficulty levels:

  1. Getting started
  2. Callback functions
  3. Using input
  4. Config Files
  5. Audio

All of the other tutorials in the wiki are quite advanced, so I suggest you return to them later on. In the meantime, check out some unofficial tutorials.

Unofficial Tutorials

Hello World in LÖVE
Hello World in LÖVE

Have a go at Vivid Reality’s Hello World Tutorial. What better way to start off than with a simple hello world game?

Next, to understand how LÖVE draws, including how it handles origins (drawing offsets), check out this tutorial.

Want to create a tile-based game? I recently found a great git-hub hosted tutorial with source code. (Created by kikito)

And as I mentioned above, Michael Ebens’ blog Nova-Fusion has lots of great LÖVE tutorials.

Invaders Must Die

Invaders in-game screenshot.
Invaders in-game screenshot.

Now that you feel more comfortable with lua and LÖVE, try creating a real game!

Create a classic invaders game with this two-part tutorial from Headchant:

  1. The LÖVE engine, Animation, Input
  2. Enemies, Bullets, Background Image

I Prefer Video Tutorials!

Josefnpat has made a great screencast tutorial explaining how to build an old-school scrolling shoot-’em-up game.

On YouTube, check out:


Advanced Subjects

At this point you can start diving into the more advanced sections in the wiki:

These are the more general tutorials. If you need something more specific, head out to the full list of wiki-tutorials.


The Community and Plugins

Are you creating something specific, meaning there are no tutorials out there to help you out? Don’t worry, the forums are here! The LÖVE platform is blessed with a great community willing to help and guide you though your obstacles.

Go ahead and sign up to the forums!

Another great aspect is the plugins (community created libraries). If you need a specific plugin to handle something like easy animations or networking, you’ll probably want to check out the library section.

Here is a list of some libraries I recommend using:


Notes

To learn about distributing your game, take a look at the wiki page.

More info about ports:

Some examples are spread throughout the wiki. To view the code, change the .love file extension to .zip and unzip the contents.

If you are looking at distributing your game on the web, there is a libary out there for you: love-webplayer


Conclusion

We started out explaining what LÖVE is all about. Then we took a look at the lua language. Next we went through some resources for learning LÖVE, from beginner material to advanced topics (with the option to chose between video and text) like networking and physics.

By now you are probably ready to create your own game. Good luck, and let us know how you get on!


Viewing all articles
Browse latest Browse all 728

Trending Articles