Page 1 of 1

Curious about feasibility of lua for bigger projects

Posted: Thu May 11, 2017 1:38 pm
by HyperPowered
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.

Re: Curious about feasibility of lua for bigger projects

Posted: Thu May 11, 2017 5:21 pm
by raidho36
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.

Re: Curious about feasibility of lua for bigger projects

Posted: Thu May 11, 2017 6:06 pm
by zorg
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.

Re: Curious about feasibility of lua for bigger projects

Posted: Thu May 11, 2017 6:15 pm
by airstruck
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.

Re: Curious about feasibility of lua for bigger projects

Posted: Thu May 11, 2017 7:45 pm
by ivan
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.