Tuesday, October 15, 2019

Lua and Love2D

This was an unreleased post from last year.

Recently, I participated in a Linux game jam where I had to design and program a game in a little over a week. I've learned quite a bit by taking on this challenge especially since I've used Lua and Love2d. There were a few things that I think I should mention related to some of the trials I went through in dealing with this framework and what direction I plan to take going forward.

LuaJIT's performance with Love2d is impressive

I've always enjoyed using Lua to make small programs, its such a simple language to use and pretty much anyone can learn it in a week with little difficulty. Using an scripting language for game logic can cause serious consequence if it isn't fast enough. Fortunately, Love2d's framework uses LuaJIT, which speeds up the compiled lua code at runtime making most scripts perform close to binary runtime speed. A fast scripting language can be utilized to easily scrub out a game prototype in a short amount of time.

Entire games should not be entirely programmed in script

This is obviously a personal opinion of mine, but I find it quite troublesome that a framework is built entirely for a scripting language. Game engines that you are building that house your logic and game rules need boundaries and restrictions that you can easily control with an internal system. Some rules can be bent but it is hard to design these rules entirely on a language such as lua. In lua variables can be morphed into different datatypes, tables can be re-implemented and classes aren't necessarily enforced. Flexibility is one of Lua's strengths but also it's greatest weakness.

I hope to later talk about using data composition and decoupling patterns with Love2D as a way to manage Lua script