LÖVE: 2D Game Framework for Lua (github.com)

by cl3misch 220 comments 417 points
Read article View on HN

220 comments

[−] patapong 40d ago
One of the biggest recent indie hits, Balatro, was made in Löve!

I really like it, the developer experience is so smooth for beginners, just drag a zip onto the exe and it starts. And the APIs are simple enough to memorize while allowing pretty cool rendering stuff.

[−] KeplerBoy 40d ago
Balatro ships with the entire unobfuscated Lua source by the way.

I once checked if the odds stated on a card were implemented wrong. Turns out no, the code checks out, I'm just that unlucky.

[−] __s 40d ago
too bad universe doesn't ship with unobfuscated source so that you could see whether you're unlucky, or just skill issue
[−] Tepix 40d ago
The source is right there, you just have to grok it.
[−] lioeters 39d ago
Good news: the universe is written in LISP. Bad news: with no comments.
[−] latexr 39d ago

> the universe is written in LISP

Ostensibly. Honestly most of it was hacked together with Perl.

https://xkcd.com/224/

[−] mghackerlady 39d ago
I like to imagine perl was bootstrapped from forth and used to build a lisp
[−] dpcan 39d ago
You can ask AI to comment an entire code base now in as much detail as you need.
[−] embedding-shape 39d ago
Comments explaining what the code does, which is what an LLM could answer, are basically useless comments. Comments that describes why the code is how it is, is a bit more valuable, but also something LLMs cannot really reliably infer by just looking at the code.
[−] Sardtok 40d ago
Well, it's kind of a machine code for a self-modifying compiler, so there's that.
[−] chii 39d ago
The source is not just dna - that's just one type of architecture that exists. There might be others that operate on different instruction sets.

The real source is mathematics. But some might say it's incomplete.

[−] embedding-shape 39d ago
Mathematics is the FORTRAN of the real source. Closer to a real source is probably "real" things like atoms and other universal things.

If I remember correctly, Stargate-SG1 at one point had some ideas about this sort of universal language, that multiple species could use for communication, as any sufficiently intelligent specie probably been able to see atoms and so on, but may have completely other way of doing "math-like" stuff.

[−] RobotToaster 39d ago
I'm still waiting for the slackers at CERN to finish decompiling it.
[−] m_mueller 39d ago
that's great, could read the source code on how to unify gravity and quantum mechanics for all energy levels? vibeing to a nobel price will be cool...
[−] cableshaft 39d ago
I don't have to check the source code to know that for me it's a skill issue :/
[−] brooke2k 40d ago
hahaha, I did the exact same thing after the game came out to see if wheel of fortune was really a 1/4 chance
[−] mh- 40d ago
lol, love seeing that I'm not the only one who did this. Being suspicious of WoF was the first and last time I peeked at the Balatro source.
[−] QuantumNomad_ 40d ago
Game developers sometimes make the “randomness” favor the player, because of how we perceive randomness and chance.

For example in Sid Meier’s Memoir, this is mentioned.

Quoting from a review of said book:

> People hate randomness: To placate people's busted sense of randomness and overdeveloped sense of fairness, Civ Revolutions had to implement some interesting decisions: any 3:1 battle in favor of human became a guaranteed win. Too many randomly bad outcomes in a row were mitigated.

https://smus.com/books/sid-meiers-memoir/

Some threads on randomness and perceived fairness in video games can be found here on HN too, for example https://news.ycombinator.com/item?id=19399044

The original link being discussed in that thread is 404 now, but archived copies of the original link exist such as for example https://archive.is/8eVqt

[−] cableshaft 39d ago
I used to get so many comments about how the computer opponent in a tile-based board game of mine cheats and got all the high numbers while they always got low numbers, and I'd be like "that's mathematically impossible. I divide the number of spaces on the board in half, generate a deck of tiles to go into a 'bag', and then give a copy of those same tiles to the other player.

So over the course of the game you'll get the exact same tiles, just in a different random order.

Now to be fair, I didn't make that clear to the player that's what was happening, they were just seeing numbers come up, but it was still amazing to see how they perceived themselves as getting lower numbers overall compared to the opponent all the time.

Meanwhile on the base game difficulty I was beating the computer opponent pretty much every game because it had such basic A.I. where it was placing its tiles almost totally at random (basically I built an array of all possible moves where it would increase its score, and it would pick one at random from all those possibilities, not the best possibility out of those).

My Dad used to play a lot of online poker, and he used to complain when other players got lucky with their hands, be like 'I know the chances are like 5% of them getting that! They shouldn't have gotten that!' and it always reminded me of those people.

[−] renewiltord 40d ago
Games like Battle for Wesnoth which have it implemented right, you’ll look at a 90-10 scenario with 2 attacks and end up with the 1% scenario. Enough to make a man rage. I have degrees in Mathematics, I am aware of statistics, and all that. And yet when I played that game I would still have an instant “wait what, that’s super unlikely” before I had to mentally control for the fact that so many battles happen in a single map.

Was good because it identified a personal mental flaw.

[−] bajsejohannes 39d ago
I worked on a game where we added a "fairness" factor to randomness. If you were unlucky in one battle, you were lucky in the next, and vice versa. Mathematically you ended up completely fair. (The game designer hated it, though, and it wasn't shipped like that)
[−] deaddodo 39d ago
The better option would be to just increase the flat odds. DQM: The Dark Prince is brutal with it's odds, but fair. A 45% chance is 45%.

In games like Civ/EU/Stellaris/Sins/etc It makes sense that a 3:1 battle wouldn't scale linearly, especially if you have higher morale/tech/etc. Bullets have a miss ratio, 3x as many bullets at the same target narrows that gap and gives the larger side an advantage at more quickly destroying the other side. So just give it an oversized ratio to scale the base (1:1) odds at.

That keeps "losing" realistic...a once in an occasion happenstance of luck/bad tactics/etc but also a generally very favorable and reliable outcome for your side.

[−] addandsubtract 40d ago
I think XCOM does this as well.
[−] bsimpson 40d ago
Dispatch too. If your odds are above a certain threshold, the mission is a gimme.
[−] lovehashbrowns 40d ago
The 8-ball joker is even more BS. I think I’ve only seen it trigger once ever.
[−] mh- 40d ago
I've read the source a few years back. It's all implemented fairly as it says on the tin.

I've long been suspicious of the RNG/seed implementation.. but not curious enough to automate testing of it, though.

[−] StilesCrisis 40d ago
It's been done, it's a valid RNG. It's somewhere on Reddit if you want to try and search for it.
[−] mh- 40d ago
I figured it had been tested by someone more motivated than me, haha, thanks! Will look for it when I'm back at a computer.
[−] andrepd 40d ago
Neat example of cognitive bias, the brain perceives the Nope as being much more prevalent than it actually is!
[−] tertle950 40d ago
For a small while I've had the idea of a [game engine/fantasy console/Scratch clone?] that comes packed with a bunch of example games. The example games should be good enough that people download it just to play them, but they are also encouraged to peek into their source code. I'd hope for it to be a sneaky gateway into programming.

For that, I'll keep this in mind: "Unlucky players may look at the source code of a chance-based effect to check if the odds are actually as stated."

[−] sfn42 40d ago
I didn't know I could check but after losing like 20 times in a row I just stopped taking WoF. Never saw the good outcome.
[−] geraldwhen 39d ago
I’ve 100%’d Balatro and wheel of fortune is quite strong. It’s never worth taking before you’re at max interest though.
[−] sfn42 39d ago
I'm sure it's strong if you hit it, I never did so to me it was a waste of chips.
[−] Levitating 40d ago
Not on steam does it? I can only see the exe and dlls.
[−] jared0x90 40d ago
extract the exe like a zip file, that's how love packages itself. last i looked at the source myself it had comments in still from the dev
[−] bsimpson 40d ago
I'm really curious how they do version control.

The Steam version was created by one guy, but the platform ports have a couple different authors. The Google Play and Xbox PC versions, for instance, have divergences.

I wonder how the ports influence the upstream and each other. How do they keep the codebases in sync, while also accounting for platform differences?

[−] Levitating 40d ago
yep that works
[−] PufPufPuf 39d ago
I know which card. We were all there. Are the odds wrong? "Nope!"
[−] pwillia7 39d ago
come on you can blame whatever the program is using for randomness still
[−] bsimpson 40d ago
In case you're curious, here's a Nix derivation to make Balatro for any other system playable on Linux:

https://github.com/NixOS/nixpkgs/tree/master/pkgs/by-name/ba...

I wrote half a blog post when I did the derivation. One day, I should finish it and post it here.

[−] eek2121 40d ago
A lot of indie devs actually are fine with decompiling/viewing source. Even the STS2 devs have no issue with this. I think it is great and helps the indie dev community. Seeing this has actually made me excited about game dev to the point where I'm beginning to dig in myself.
[−] Lapel2742 39d ago

> One of the biggest recent indie hits, Balatro, was made in Löve!

Moonring[1] is another one that that is written in Löve (apparently by the co-creator of XBox's Fable series). The base game is even available for free. I had lots of fun playing it.

[1] https://store.steampowered.com/app/2373630/Moonring/

[−] Neywiny 40d ago
Haven't used it in almost 10 years but at least back then one sticky point was that unlike unity and the like, opening the exe didn't open an IDE. Just kind of a dummy window. Also building for Mac from Windows was a nightmare since my end user was not technically literate and it didn't just run on their end. But that's likely just a Mac issue
[−] wwarren 40d ago
I love LÖVE. For me it sits at the perfect intersection between high and low level abstraction. Unfortunately the latest released version is getting pretty long in the tooth now and a lot of devs use the latest HEAD from the repo since it has better performance and compatibility. One day the mythical 12.0 will get released for real…..
[−] nebula8804 40d ago
Anyone who is a fan of the TV Show Community MUST try out the recreation of the 8 bit video game episode(Digital Estate Planning) called Journey to the Center of Hawkthorne.

[1]: https://projecthawkthorne.com/

It is now available to play straight in the browser(I guess using LÖVE Web Builder?).

[1]:https://schellingb.github.io/LoveWebBuilder/

This engine has really come a long way and enabled such a memorable game for me.

[−] PufPufPuf 39d ago
I used LÖVE to build a simple Kodi alternative for my home media center setup. My first attempt was using Electron but rewriting to LÖVE meant much simpler code (turns out manually calculating coordinates is simpler than fighting CSS) and less resource consumption (not a high bar, yes). It works so well I might clean it up and open source it...
[−] PacificSpecific 40d ago
I generally very much dislike dynamic languages but for some reason I've always really liked Lua. I'm not exactly sure why to be honest.

Maybe because you can fit the whole language spec on a single sheet of paper and adding more advanced features is pretty easy.

Love looks really cool. I never got into it personally but I still might

[−] yehoshuapw 40d ago
my favorite game in love: mario, with portals

https://stabyourself.net/mari0/

[−] JSR_FDED 40d ago
Lua is very fast - even without the JIT it makes Python feel like wading through molasses.

Lua is so small and simple (but not simplistic) that you can keep it completely in your head. Even if you only get to work on your project once every weekend you won’t have to relearn half of it every time.

[−] delduca 39d ago
If you liked Love2D, please take a look at Carimbo (my engine).

https://github.com/willtobyte/carimbo

I have a game on Steam made with it, the game is open-source now.

https://github.com/willtobyte/reprobate

[−] 0xCAP 40d ago
My2c. Fintech tech lead who has only a far memory of hand coding games ages ago. Community makes tech awesome. Love2D discord changed my life. Never met a more awesome and welcoming community in my whole life.
[−] raincole 40d ago
Btw, Love2D is based on SDL2. If you hate Lua but needs the same cross-platform capabilities, you can use an SDL2 binding in other languages or make your own.
[−] K0IN 40d ago
I love löve I did some projects in it, lua was one of my fist programming language, i think it's a great fit for game dev.

Also move or die is running on love2d, which is an awesome game.

Also I love that trick that you can just zip your files and binary Comcast them to the love2d binary and it will load it.

[−] vanderZwan 39d ago
If, like me, you have too much "P5 api" muscle memory to really get into LÖVE (not a criticism of that library, tbc), then L5 might be a nice alternative:

https://l5lua.org/l5-for-processingp5/

[−] nout 40d ago
Am I really the first one to mention pico8 in this thread? Anyway, pico8 is another option that has a bit different spin, but you also implement the games in Lua :)
[−] akshatjiwan 39d ago
Yeah this is amazing. I'd love to see integration with raylib at some point, if possible that is.

Lua's small footprint is it's one big advantage in addition to its pleasent syntax but with tiny cc (which raylib supports when I last checked a few years ago) you can get a compact c runtime as well.

I haven't worked on a project with either of these frameworks but a couple of years back I was researching into some frameworks and was surprised to learn that I can use raylib on my phone with termux!

[−] quadruple 39d ago
Despite being a game framework, due to LuaJIT's great FFI you can just write whatever. I recently made a tool that captures frames from GTA:SA using GDI, and when holding ESC only show gameplay frames. It's an anti-epilepsy 'filter' for pause buffering intended for streaming. Now I just need to start streaming SA speedruns.
[−] marcomezzavilla 40d ago
LÖVE seems amazing, I’ve always looked at it with curiosity. There’s also the legendary Harvard CS50’s Introduction to 2D Game Development, which now uses it in its latest version.

But I’m wondering: why do mature tools like this sometimes end up on Hacker News’ front page without any particular news (like new releases or updates)? It’s just a curiosity, not a critique.

[−] p2detar 40d ago
As someone that used to write 2D games with things like phaserjs, sdl and even directx7, I always regret I never tried Löve2d. I think Android and iOS packaging was also supported. Is this still the case? What if one wants to integrate IAP?
[−] 1313ed01 40d ago
Was going to post a link to the minimal template for setting up Löve2D with Fennel, that I can really recommend, and found this recent article describing that...

https://itch.io/jam/love2d-jam-2026/topic/6082771/how-to-get...

... posted in the site of the 2026 Löve2D Game Jam, that sounds like something also worth mentioning: https://itch.io/jam/love2d-jam-2026

Too late to enter. Jam was last month. But there are 47 games to check out there, plus many from previous years.

[−] mghackerlady 39d ago
It also happens to be one of the better ways to do a GUI in Lua :P
[−] chunqiuyiyu 40d ago
I’m a big fan of Love2D as well. it’s simple, efficient, and really easy to get productive with. After just a short learning period, I was able to ship my first indie game on Steam, a small Chinese‑character puzzle game built entirely with Love2D. https://store.steampowered.com/app/4218330/WordJoy/
[−] alprado50 40d ago
Is Love2D a decent option for gamedev compared to Godot? I finished a really simple game using Unity3D and it was fun, but it sucks to use a closed source engine.
[−] kelvinjps10 40d ago
The website might have been better, in the submission https://love2d.org
[−] chadpaulson 40d ago
I love this framework, pun intended. I made a clone of Atari's Missile Command with it many years ago when the Portal / Mario mashup game made with LÖVE was popular. https://github.com/chadpaulson/missile-command
[−] mega-tux 35d ago
I find DragonRuby GTK somewhat similar, although not open-source sadly. ( https://dragonruby.org/ )
[−] user____name 39d ago
Someone should make a framework like this but with static typing and manual memory management. If you want a modable game you really need to have it in a managed language, and I spent enough time fighting with garbage collectors that it's just a non-starter. A shame because Love is really nice to use.
[−] flobosg 39d ago
Here are plenty of small apps developed with LÖVE: https://git.sr.ht/~akkartik, see also https://akkartik.name/
[−] yboris 39d ago
I ported my favorite pre-2000 game into LÖVE -- was easy and fun

Gravity Wars - turn based artillery game in space (planets' gravity affect shot path)

https://github.com/whyboris/gravity-wars

[−] RobKohr 35d ago
If you are looking to do some 3d in lua, try: https://lovr.org/
[−] marknote 39d ago
For anyone looking to code LÖVE2D games directly on an iOS device, I’ve created an app called love2d-studio: https://marknoteapp.com/love2d-studio
[−] herczegzsolt 40d ago
I've used this for many projects that are still working to this day.

That said, i'm not impressed. A web-based solution is usually better performing, despite all the bloatware necessary. This says a lot about the state of software development unfortunately.

[−] flykespice 39d ago
I wish lua would be more popular outside of its scripting language bubble, but its tendency to occasionally introduce breaking changes every release doesn't makes it very palatable as a main language for writting software.
[−] rwbt 39d ago
I use this framework to build prototype applications and it's always a delight. Something about Lua just feels right. Once I'm satisfied with a demo or prototype, I later on port it to native C/C++ implementation.
[−] nodesocket 39d ago
Interesting. I started playing with Godot this weekend and got something simple to render with some toolbar windows and a statusbar. I’ve always been fascinated by game and graphics programming.
[−] 0x3444ac53 39d ago
Fennel is really cool! And you can write games in it :) https://fennel-lang.org/
[−] anthk 40d ago
UXN can be interesting for 2D games too.
[−] sylware 39d ago
bluerevolver amazing shmup made with löve.

löve is getting a vulkan backend. I would have prefered löve to be plain and simple C coded instead of this abomination which is c++ (but it seems coding AIs may be very good at assisting mass c++ to plain and simple C port).

[−] Duplicake 39d ago
Interesting this is at the top of hacker news since this is pretty old, great project though
[−] pmarreck 40d ago
I need something like this but for cross platform utilities
[−] shooshx 39d ago
Could have compiled it to wasm and have an online demo
[−] miellaby 39d ago
Still think Gideros SDK had more potential
[−] SilentM68 40d ago
Interesting framework :)
[−] VorpalWay 40d ago
How is it supposed to be pronounced? Is it just gratuitous diacritics? Or should I pronounce it in my native Swedish (where the names makes me think of leaves rather than love)?

(Throwing diacritics on English words look extremely silly to me, since I know how åäö are supposed to be pronounced. It makes something like Motorhead just sound laughable rather than metal.)

[−] inzlab 39d ago
Best graphics ever
[−] davidkunz 40d ago
I haven't tried Löve, but I somehow enjoyed reading through the README.md, no AI slop, just a natural writing style with tiny indictors showing the authors' enthusiasm in creating software.