Wednesday, September 12, 2012

Love2d - first encounter


Love2d is an awesome library to make games. In last few days I've experienced a bit with it and now I'm ready to present my thoughts about it.

Getting started

Just follow guide on the wiki and setup your notepad++. Installation is easy and painless: click, download, start. Once installed love, you can play love games from the web, just download ".love" files and run. This "magic" is possible just because love files are .zip files, with all game-related resources into it.
After some thinking I'm okay with this, but scanning amazing useful love2d forums I've realized that this can be a side effect: anyone start from scratch, build something, then build a framework on top of Love2d.. it's crazy, right?
Anyway, just setup a fast-keyboard-run command on my notepad++ and I'm ready with HelloWorld Love2d program:

function love.draw()
    love.graphics.print("Hello World", 400, 300)
end
Not so exiting, but is the first step!

Pros

One good think about Love2d is you write with Lua, Is something different from Java or Actionscript, or even C# and I'm not here to teach you Lua. But with a scripted language is a way to change your way of thinking (maybe, I know!).
So first, forgot about classes and so on: you have functions, structs (like in the old c) and a lot of useful functions do deal with it.

Cons

Well.. Lua is not so easy. You want to remove something from a table? Is not possible, not in a way you like: you need to store index of element in table and then remove it.
Or again, you want to declare a new anonymous-type with some new properties? You can, but after few lines code could be a mess. You can, sure, use require to split your code in different files, but without an IDE (I mean, something like LuaEclipse) dedicated to Love2d (and again I've tried some of them) it's hard to handle big projects.

Conclusion

Love2d is great for small projects and challenge, to get something quick on screen. Lack of a decent IDE and knowledge of Lua can stop you from move from simpler examples to more complex games.
Distribution of games is really easy, something valuable this days.. so my suggestion is to take a look to love2d, because deserve it!


Love2d required, move with WASD, use mouse to shoot

No comments:

Post a Comment