Curious about feasibility of lua for bigger projects

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
Posts: 1
Joined: Thu May 11, 2017 1:29 pm

Curious about feasibility of lua for bigger projects

Post by HyperPowered » Thu May 11, 2017 1:38 pm

I just discovered löve (and lua in general) a few days ago and I am astonished in how easy it is to do things in this language.

I've been planning to write a somewhat more complicated rogue-like for a while, I originally started development in C# and used SadConsole. While also very nice, I am starting to think about if I should do it in lua instead since the language is just so simple and flexible and things are easy for a single developer to put together quickly. I am a bit worried though that lua might not be a good choice for bigger projects, also I have no idea how well it performs in regards to pathfinding and managing of big data sets. Any opinions on this from people a bit more experienced? Are there any examples of bigger projects where lua is most of the codebase? (I'm not talking about games where lua is used for scripting of very specific parts, I'm aware of those) I'm a bit conflicted in what way I should go here.

User avatar
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Curious about feasibility of lua for bigger projects

Post by raidho36 » Thu May 11, 2017 5:21 pm

What you're really asking, is feasibility o Lua for calculation-heavier projects.

As long as you stay on the desktop, you can readily enjoy JIT compilation, which greatly improves performance over interpreted Lua. You can technically also do it on mobile but it either violates the license or may not function, depending on target platform. If you have a lot of calculation-heavy code, you can displace it into a dynamically linked library written in C. LuaJIT has facilities to easily hook up native code libraries and interface with them. Even without it, JIT compiled code can run well within an order of magnitude of speed of raw C. Using FFI C data structures instead of Lua tables in calculation can bring JIT compiled code performance on par with raw C.

There is a number of complete games made with LÖVE such as Move Or Die.

User avatar
Party member
Posts: 3044
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary

Re: Curious about feasibility of lua for bigger projects

Post by zorg » Thu May 11, 2017 6:06 pm

And while pure lua might not have out-of-the-box support for real threads (coroutines don't count), LÖVE's own threads are real OS threads with separate lua states, meaning you can thread your code if you feel like it's warranted; pathfinding calculations could be a thing that may be heavy enough to thread on a whole, though tossing the data between threads is a bit limited; no tables in tables; as for Löve objects, they're shared between them, so as long as you keep to not modifying the same thing on more than one thread, it should be safe.

Still, i'd still recommend starting small, without threads, and when you feel like your code can't be made faster, then refactor, instead of straight going to the most complex route... but it's your decision of course.

In short, LÖVE should be perfectly capable of doing what you want.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.

User avatar
Party member
Posts: 650
Joined: Thu Jun 04, 2015 7:11 pm
Location: Not being time thief.

Re: Curious about feasibility of lua for bigger projects

Post by airstruck » Thu May 11, 2017 6:15 pm

In a turn-based game like a roguelike, you shouldn't need to worry about performance (of pathfinding, etc.) much at all. Lua's sparse ecosystem could have an impact on bigger projects, though. You'll find less prepackaged solutions for things, and they may not be as actively maintained or have as many contributors. Some might be kind of experimental or just of poor quality.

It's pretty easy to port stuff from other languages, though, so you'll find things like this.

User avatar
Party member
Posts: 1665
Joined: Fri Mar 07, 2008 1:39 pm

Re: Curious about feasibility of lua for bigger projects

Post by ivan » Thu May 11, 2017 7:45 pm

With larger projects, the difficult part is organizing/maintaining your own code and assets.
It's easy to hack things together in Lua, but it's hard to make a large game without cutting corners (it's hard to make a large game in any language!).
Airstruck is correct, the more established languages have an edge over Lua, when it comes to libraries and extensions.
While you can still probably find Lua bindings for your favorite C/C++ library, it's just not the same. :)
Other than that, Love2D can easily handle any genre of 2D.

Post Reply

Who is online

Users browsing this forum: No registered users and 28 guests