LÖVE: 2D Game Framework for Lua

(github.com)

145 points | by cl3misch 1 day ago

14 comments

  • patapong 3 hours 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 2 hours 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 2 hours ago
        too bad universe doesn't ship with unobfuscated source so that you could see whether you're unlucky, or just skill issue
        • Tepix 2 hours ago
          The source is right there, you just have to grok it.
          • Sardtok 15 minutes ago
            Well, it's kind of a machine code for a self-modifying compiler, so there's that.
      • brooke2k 2 hours 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- 2 hours 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_ 1 hour 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

          • lovehashbrowns 1 hour ago
            The 8-ball joker is even more BS. I think I’ve only seen it trigger once ever.
            • mh- 1 hour 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.

        • sfn42 36 minutes 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.
      • Levitating 55 minutes ago
        Not on steam does it? I can only see the exe and dlls.
        • jared0x90 39 minutes 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
    • Neywiny 33 minutes 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
    • bsimpson 1 hour 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.

  • wwarren 3 hours 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…..
  • PacificSpecific 2 hours 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

    • turtledragonfly 59 minutes ago
      The Lua source code is also a masterclass in C, I recommend it to anyone learning that language. It's big enough to be an involved implementation, but small and focused and well-organized enough to (at least roughly) understand what's going on at the various layers. It's a very solidly-written mass of portable C, with only minor exceptions.
      • PacificSpecific 51 minutes ago
        Oh I hadn't considered looking at the source but considering how minimal and clean Lua is I should have assumed so :)

        Thanks for the tip. That should make for a fun weekend

  • yehoshuapw 3 hours ago
    my favorite game in love: mario, with portals

    https://stabyourself.net/mari0/

    • seqizz 2 hours ago
      I looove stabyourself. ortho robot was amazing. you know what, let me install again.. here goes my night.
      • jgtrosh 1 hour ago
        I like the Trosh game
    • ranger_danger 1 hour ago
      How have they not been sued by Nintendo yet?
      • mid-kid 30 minutes ago
        Same reason all the other mario flash games haven't, not a critical enough mass.
  • raincole 3 hours 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.
    • CyberDildonics 4 minutes ago
      There is a lot more that goes into Love2D than just SDL. It uses many other libraries for sound, image loading, etc as well as using luajit so that the lua runs very fast and has a super easy C FFI.
    • onehair 40 minutes ago
      Now why would you hate lua of all things?
      • raincole 27 minutes ago
        For all the reasons, but the 1-based index alone makes me uncomfortable.
      • onsclom 22 minutes ago
        I don't necessarily hate Lua, but I prefer C and Raylib for game dev. Lua is garbage collected, dynamically typed, strays far from standard syntax patterns, and has less existing tooling than C.

        I see why people might hate Lua. Especially for game dev!

        • krapp 1 minute ago
          Lua is extremely popular for game dev though?
    • newobj 2 hours ago
      SDL3
      • jasonjmcghee 2 hours ago
        Definitely SDL2.

        Author is currently building version 12 which will be using SDL3. But it's been in development for quite some time with no clear end date afaik.

        • krapp 1 hour ago
          It is easy to get Lua (with LuaJIT) working with SDL3, though.

          That obviously isn't a replacement for the framework but it is perfectly doable if someone just wants to write a game in Lua with minimal overhead.

          Edit: I mention LuaJIT specifically because it lets you create metaclasses around C objects, which is much easier than messing with the Lua stack from C, and it's easy to make a 2d vector class from an SDL Point or a spritesheet or what have you. There are a few rough edges like dealing with pointers and gc but to me it's the best of both worlds (the speed of C, and some implicit type checking, and the flexibility of Lua.)

          Obviously you could do it the hard way and the other way around with normal modern Lua but it's such a pain in the ass.

      • raincole 2 hours ago
        As far as I know only the latest (unstable) version uses SDL3.
  • K0IN 2 hours 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.

  • alprado50 54 minutes 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.
    • jtolmar 4 minutes ago
      Yeah, Love2d is a great option for gamedev. It doesn't have the same built-in tools as Godot so you'll need something else for putting together maps (use Tiled [1]), and you'll need to write your own main/render loops (these are just two for loops, nothing fancy).

      [1] https://www.mapeditor.org/

    • onehair 41 minutes ago
      Godot will be familiar to you if you then.

      Löve on the other hand is 100% just code. You'll not have the gui things and the pletora of different components that go with them. Still gives you freedom. Just too much freedom and not as much helpful preset tools.

  • 0xCAP 3 hours 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.
  • p2detar 3 hours 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?
  • nout 1 hour 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 :)
    • opan 51 minutes ago
      TIC-80 is a nice free as in freedom alternative to PICO-8, and it allows more inputs, which makes for better Tetris games (gotta have that hold piece).
  • VorpalWay 43 minutes 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.)

    • Sardtok 0 minutes ago
      The project was started by Norwegians. So I feel like you should apply juuuust the right amount of cheesiness and sort of push that Ø-vowel looong. Not sure if Ruud would agree, though.
  • herczegzsolt 3 hours 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.

    • actuallyalys 24 minutes ago
      I don’t usually push LÖVE to its limits because I tend to make simple games as a hobby but I do keep an eye on its framerate and often it‘s in the 100s of frames per second. So it may not be impressive (in sense of winning benchmarks) but it’s rarely perceivably slow.
    • small_scombrus 3 hours ago
      It isn't web based? It's a set of Lua scripts that run locally
      • squeaky-clean 2 hours ago
        They are saying web based solutions often out perform LÖVE, even though you would expect the opposite because LÖVE doesn't have the bloat of a browser engine.
        • usrnm 2 hours ago
          Browser engines are probably some of the most optimized pieces of software in existence, so it doesn't surprise me at all.
          • wiseowise 29 minutes ago
            Explain this to electron haters.
            • krapp 1 minute ago
              Browser engines are optimized for displaying web pages, not for applications.

              60MB+ for a calculator is not optimal.

  • davidkunz 2 hours 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.
  • marcomezzavilla 1 hour ago
    [dead]