Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: I open sourced a game I just released on Steam, written in Lua (github.com/a327ex)
496 points by adnzzzzZ on May 23, 2021 | hide | past | favorite | 97 comments



Love2d (the lua engine used here) is really great. If I were teaching a newbie to programming, I'd probably have them start with love. It makes it super easy yo just get something on screen, and you're not screwing around with configuration, build systems and package managers etc (the death of productivity IMO, especially for a beginner). I used it on a recent jam game too (https://wheybags.itch.io/drilbert)


Been using Love2d for few years now, and you are right on point that it's great for education.

You can get fun things to happen with few lines of code. The whole API fits into your head, and together with Lua's simplicity this is a powerful combo. Any complexity in code comes from your side. With live reloading, development happens in tight loop with running environment, and this easily drags you into the zone.

At the same time the framework is low level. The included functions cover only interfacing HW and rendering graphical primitives. It's just a thin abstraction layer that greatly simplifies accessing OS features. Everything else like scene management, AI navigation, live code reloading, skeletal animation, common graphics shaders, tile maps, sound management, UI, that's all left out of the framework. Numerous Lua libraries were made to fill in the missing stuff.

You get to pick from different solutions and glue them together with script code. This is very consistent with general Lua mindset. Neither functional constructs nor OOP are not included in Lua, but both can easily be brought in with any of dozen libraries. It creates fractured space and it's kind of bazaar of different tech stacks that are same but different.

Other frameworks and engines (Defold, Solar2D, Roblox) that use Lua all take integrated approach where more of functionality is crammed into engine itself. This is a more closed solution where you aren't supposed to extend the engine much, just script inside it.


> Neither functional constructs nor OOP are not included in Lua

That’s hard to read.


I think they didn't mean the double negative, since they continue with "both can be brought with libraries" which implies they are not included in the core language, which is the opposite of this doubly negated statment.


It's very likely, given the occasional dropped article, that the poster in question is not a native English speaker, and probably from a language where 'double negative' is agreement, as in "we don't need no education".


You are correct that I'm not a native speaker, and also that my language uses double negatives. Alas, this mistake was due to editing small part of sentence and neglecting to re-read the whole thing. I won't try to avoid not making this error never again.


Also, thanks for pointing out the dropped articles. The gmail spell checker often wants to insert those into my texts. While in most cases it felt they were not necessary, obviously the omission gets noticed.


Another good beginner game dev framework is kaboom.js

https://kaboomjs.com/

Example project online: https://kaboomjs.com/examples#level

And just to add, if anyone has been using love2d or other frameworks like it, give GoDot a try.

I started using it a few weeks ago and it's amazing how much I'm getting done with my game.


Flash with ActionScript 2/3 was incredible for this sort of thing as well.


People argue that Flash has been completely replaced with HTML5, but, there is no GUI / interface for designing games / animations for the web that even comes close to what Flash had. I miss me some movieclips =(


Flash-the-format is gone, but Flash-the-editor never went away. It's just called Adobe Animate now. It now exports projects (incl. arbitrarily-complex ActionScript-based games) to HTML5 rather than SWF, with literally no loss of functionality (and in fact gains in functionality instead) compared to the SWF days.

Animate also exports to Adobe's AIR runtime — which isn't just "that weird Adobe thing you had to install on your PC once to run a business presentation", but much more importantly translates to the ability to export a project to a native mobile app for iOS/Android, since these platforms have AIR-runtime implementation as libraries you can link into an app project.

Not sure why everyone seems to have forgotten it existed. It's not like it went unmaintained or anything, the way Fireworks was for a while before its death. Animate is still a great and modern tool, with new features being added all the time. It's become a first-in-class tool for animation studios to produce cartoons with — thus the updated name/branding. People just seem to have lost, in the process of that rebrand, all awareness of the fact that it can still be used to make games/interactive experiences. Which is a shame.


I believe what went away was the ability to get Animate for cheap. Flash was extremely highly pirated and that served as an entryway for young would be web devs/game makers. In the Creative Cloud era, pirating Animate has become a lot harder to do. So fewer people know of what it can do after the easier to pirate eras, and in turn fewer people see it as an on ramp to web animation and/or game development.

Not that pirating is the right solution nor that Adobe doesn't have a right to make money from their software, but that Adobe is missing a possibly huge audience they could attract with more "middle options" than super locked down Creative Cloud accounts such as for kids without access to the family's purse strings, for lower income and education use, for try before you buy needs, etc.


I learned to program with Flash MX 2004. I had no idea what I was doing but within a day or so I had made some pretty cool stuff that I was proud of. Was hooked from then on.


The Flash IDE was top notch. And the fact that it made a one-file executable was pretty cool too. And their version of javascript with classes was damn cool (was it es6?).

Flash had a nice dev-to-executable experience, too bad it was soured by its browser inclusion. It could've been a great alternative to Java/Electron as the build once run anywhere lang. Adobe was a bit too early with Air


AS 3.0 was ecmascript and similar to typescript! I loved actionscript 3.


AS 3.0 was the closest we got to an ECMAScript 4 implementation.


HaxeFlixel + FlashDevelop


Flash Player can be emulated with https://ruffle.rs/ but there's still no viable replacement afaik for Flash IDE.


wickeditor.com is trying to fill this niche, still pretty young but under active development.


I really enjoyed this set of tutorials for Tic-80, which also uses Lua (or Fennel/Moonscript/Wren/JS). The series was a really great intro not just the tic-80 engine, but programming concepts in general. A friend of mine was able to take some of the concepts he learned and was able to improve the bit of spreadsheet/data munching that he has to do for his otherwise non-technical work.

(https://m.youtube.com/playlist?list=PLvOT6zBnJyYF3FzmfXz2QXM...)


Love2d was the first 'real' game engine I ever played around with. I made a bunch of silly little games with it. My only real problem is not really to do with love2d but lua itself. Debugging lua is a pain. There was one debugging addon I remember finding for love2d that was sort of hacky and didn't work that well.

Otherwise, honestly it's a great little engine and like you say, if you're pretty new to programming and want to try making games for fun, lua and love2d is a great way to go.


Seems like it could be nice next step up from Pico-8, especially for users who’ve moved on to using external art tools and text editors anyway.


Solar2d is also quite good. https://solar2d.com/ its technically older than love, but it started as Corona (not opensource)


For anyone else looking to make a game in Lua + Love2D, a developer wrote an entire tutorial for how they made their game, which is also released on Steam: https://github.com/a327ex/BYTEPATH. Both the game and the tutorial are high quality, and provide really useful insights.


The same developer authored this game.


There is other complete tutorial for Love2D: https://www.sheepolution.com/learn/book/


The day-by-day dev log[0] is worth a read on its own. It's impressive what a single developer can do with the right determination and discipline.

[0]: https://github.com/a327ex/SNKRX/blob/master/devlog.md


I'm reminded of the talk "Juice It of Lose It" <https://www.youtube.com/watch?v=Fy0aCDmgnxg>. This looks like a very juicy game. There's also an excellent video by Mark Brown, a fantastic resource for game design discussion <https://www.youtube.com/watch?v=216_5nu4aVQ>


Löve2d is the best. I actually like to code for it in TypeScript and then use the https://github.com/TypeScriptToLua/TypeScriptToLua transpiler to spit out Lua code. Best of both worlds scenario IMHO. Once my Lua codebase hit 10k lines or so I found it very difficult to maintain. TS has really helped there while maintaining all the dynamism and fun of Lua.


Looks like Wu has a Löve wrapper

https://github.com/wu-lang


Interesting. Never heard of Wu before. The love wrapper "lover" however seems to be very immature. At least its roadmap indicates this.


I'd love to play it, but it seems to be Windows only. Any plans to support other platforms, for example macOS? FWIW, I'd probably prefer to play it on iOS if the controls are decent.


Since the game is open source and developed with LÖVE, you can probably just download the source code, go into the root directory of the game and type 'love .' in a terminal. You need to have LÖVE installed of course.

The game might not run (rather crash) if the game uses some Windows specific dependencies.

I am also gonna add a little bit of self promotion here ...

So far I've finished one game in LÖVE, which is Paratrooper (available on macOS AppStore [0]). I have almost finished my second LÖVE game called Lethal Pongbat [1] which I will release for macOS and Windows on Steam.

I have already plans for a 3rd game that I hope to start on in the coming months and which will be a BOOM clone [2].

I learned LÖVE through the Harvard Game Programming course [3], which I can recommend anyone as a starting point into game dev. In later lessons the course also uses Unity. The course can be followed for free, but you can pay some money for some extra features.

---

[0]: https://www.youtube.com/watch?v=dFX0FlO_g9Q

[1]: https://www.youtube.com/watch?v=mNhn77ipGTc

[2]: https://macintoshgarden.org/games/boom

[3]: https://online-learning.harvard.edu/course/cs50s-introductio...


> The game might not run (rather crash) if the game uses some Windows specific dependencies.

It links against Steam, so you'll need to make that available to avoid the crash, but that seems to be the only part of the code that wouldn't work out-of-box on other platforms.


Can't you link against the macOS or Linux version of Steam libraries?


Yes. It's the same API - you'll just need to do that linking yourself, because the build scripts assume Windows.


Since it has requirements for steam here a quick hack to get it working without https://gist.github.com/BlackLotus/164cbdd2352adc6c67d807a13...

Tried getting it to work with lutro (the libretro love implementation), but didn't get too far (am too lazy). But if someone gets it working with lutro you can play it on nearly any platform (every platform with retroarch and lutro so nearly every 32/64bit platform you can imagine)


It's an open source project, and the engine supports Mac OS, though Apple being Apple you can only target any of their platforms by investing in their overpriced hardware.

You realize you're on hacker news, right? Anyone with the right machine can fork it, strip out the Steam integration and ship it on your preferred platform.


Yeah, I realise I could do that. But I'd prefer to just play the game and reward the author financially for the convenience.


Maybe he would like to see it supported for Linux on Steam and perhaps send the creator a little cash as well?


LÖVE works well on Wine.


LÖVE works well natively on Linux.


Ancedotally, LÖVE software written for Windows can be hard to get running natively on Linux properly.


Hence the cash motivation for real support.


Just to be clear I want to give cash even if it takes no effort to get it working on Linux.


You don't need any apple build tools for this. The engine is an application that reads lua files you edit to make your game. Then you can repackage all that as an application.


From the Love2D documentation [1]:

> Compiling Mac apps requires a Mac running macOS with XCode installed

Same for iOS.

[1] https://love2d.org/wiki/Game_Distribution


There's an easier way: create a zip file with all your .lua files, and just drag the zip file into the LOVE app (which you can download from the website). This isn't for distribution and more for game testing, but it works perfectly fine.


For distribution on the mac store, yes. But you can make stand alone builds by including a main.lua (and other code) next to the Love executable inside of the application (you can just make a copy of it for your game).


I'm glad to see that GitHub finally allows embedding videos in the README.md so that people can stop using gifs there.


In Firefox under linux I see a "No video with supported format and MIME type found". It seems that Gifs are still more widely supported...


You need to install non-free video codecs. It would be great if GitHub recommended using open video codecs for people uploading videos. AV1 would be a good candidate, but Safari still doesn't support it.


It's really not the time to embed AV1 only everywhere.

Lots of hardware around doesn't have hardware video decoding for it. If a free codec is needed, better to use VP8 (or _maybe_ VP9).

(AV1 decoding appeared in hardware for Intel Tiger Lake, NVIDIA Ampere and AMD RDNA2)


Hmm, I use Firefox (dev edition) on Linux and the video is playing with no problem


Also works for me, Firefox Nightly on Mac OS.


Really? I'm down-voted for trying to help uncover where it doesn't work?


Maybe you use umatrix? You have to allow githubusercontent.com


I can see it in firefox stable under macos


I can see it in firefox stable under fedora


I could see it with Firefox on iOS


Firefox iOS is just Safari.


Didn't work for me in Safari because Apple stopped updating my iPad. I wish Epic would bring that up at the trial.


There is an interesting blog post by the author on the development and his experiences and lessons, on LÖVE, coding style, reuse of code, etc: https://www.a327ex.com/posts/lessons_second_game/


I really like the author's transparency, seems like an awesome person.


I just played through it and found the game style and design really appealing. And it also felt really well polished. Really nice music and juicy animations!

It felt like it would be thrice as fun with a bit more challenge though. A bit of balancing of the numbers. Right now I managed to beat the game without understanding my choices and without improving my technique.


It's really odd to me Lua is only used for games. It could take the same place Python has and many other things. It's a nice platform for scripting.


> It's really odd to me Lua is only used for games. It could take the same place Python has and many other things. It's a nice platform for scripting.

I’ve written quite a bit of code in Fennel [1], a Lisp language which compiles to Lua, and enjoyed thoroughly the simplicity of Lua. I implemented map, filter and reduce by hand using Lua tables and genuinely experienced joy with how Lua tables are such a unifying concept throughout the language. I even enjoyed 1-based array indexing after a short while.

(Furthermore, I have to say Lua is meant to be a Lisp, insofar as homoiconicity is the simplest language syntax, and being Lua underneath removes all the esoterica from Lisp, making the end result even simpler.)

But Lua was designed from the very beginning with the assumption it would be embedded within a systems programming language like C. Lua lacks basic functionality other, more full-featured scripting languages ship support for out of the box, e.g. Lua doesn’t even have mkdir. Also, once you survey the landscape for argument parsing in Lua, or cross-platform statically linked binary compilation in Lua, you realize the Lua ecosystem itself expects you to be using Lua as an embedded scripting language.

I was able to get really far embedding Fennel in Rust, for example [2]. Rust is miles ahead of Lua in all the areas Lua is lacking. Instead of clumsily tacking on an object system on top of Lua, write Rust structs. Or instead of using ancient libraries for cross-platform filesystem and IO handling, leverage the native Rust ecosystem (see: dirs-next, clap).

My idea was to just embed Fennel in Rust, and write almost no Rust. And while it does certainly work, I’m increasingly of the belief you should use the language best for the task. Lua is best at being an embedded scripting language, good when you want to ship an interpreter on top of a C/Rust application for instance, or when you want something fancier than TOML or INI for config.

(In this department, see also the work being done on Starlark in the Bazel ecosystem [3].)

[1]: https://fennel-lang.org/

[2]: https://git.sr.ht/~ioiojo/include-fnl

[3]: https://github.com/facebookexperimental/starlark-rust


I believe you would like https://janet-lang.org/

It is lisp-like language with Lua like semantic and implementation, but it is separate from them.


Janet is what introduced me to Fennel. Conjure [1] sold me on Fennel over Janet. The Neovim community is rallying around Lua.

(And in fact, what sold me on Rust was its truly excellent Lua FFI support [2].)

[1]: https://github.com/Olical/conjure

[2]: https://github.com/amethyst/rlua


I would agree that generally Lua has been used for games... But NodeMCU is one of the more well known ESPxx microcontroller firmwares, Adobe Lightroom uses Lua for plugins, and just now I found this big list as well on wikipedia:

https://en.wikipedia.org/wiki/List_of_applications_using_Lua

More notably for myself, my work's robotics applications are developed with Lua 4.1, so you might actually find the small embeddable language used in more places than you might expect, especially where you don't want to do the scripting level work ( business layer) in C/C++ at the same layer your low level real-time stack operates.


Exactly my thought when I started working on LadyLua https://github.com/tongson/LadyLua


Lua is also used for:

- AwesomeWM configuration

- Wireshark dissectors

- Nmap scripting


And OpenResty extensions (and sometimes configuration of the built-in ones), as one can see in use by the nginx kubernetes ingress controller

IIRC the Kong api gateway uses it in a similar way

There's a Lua interpreter in Redis, too


I will buy every game you release :)


Amazing, I purchased it to show support and I love this. The music is cool too, this will be the game I play while waiting for Unity builds ! Please port to Android/IOS !


Also purchased it after seeing this; looking forward to trying it out, and will check out the source code as well.


I wish that people who abandon their early access games would always release the source code for people who are passionate about the project.

For example, objects in space seems to have a lot of potential. And as a person who bought the game it sucks to see that the development was stopped.


Thanks for this, will pick through it to see if we can pick up any better practices or patterns. My 11yr old son and I playing with Love for a few weeks, learning OO, LUA, and some game engine principles.

https://github.com/ppriest/love if interested.


Why snake like? Just curious.


There's a sort of mini genre of build simulators stapled on to a simple shell game (which the OP is one of the main contributors to). It works well because the controls are simple, the mechanics that builds tie in to are simple to grasp, and it takes way less dev effort.

For this specific game, snake works super well because it's very inspired by auto battlers, so different units as segmentd doing their thing and being killed individually works very well with snake.


> There's a sort of mini genre of build simulators stapled on to a simple shell game

Where can I find more games like that?


I wish there was a steam tag people used but I think it's too niche lol.

Here's the ones I've found on steam - Nova Drift - SNKRX - BYTEPATH

Back in the day I played so many flash games like this, but unfortunately it didn't seem to spawn as much of a genre lol.


I don't think there's any central place or tag that captures this idea properly. Generally games like this tend to happen a lot in roguelike/roguelite tags (https://store.steampowered.com/tags/en/Roguelite/), but they can be anywhere really since theorycrafting/build-making is a very common theme in games.


LOVE is great for anything that isn't too crazy complex.

Also, I bought both your games today on steam and thoroughly enjoyed both of them. Thank you :)


The game looks very well made. I like the LOVE framework as well!


I kept wanting to zoom out while watching the demo video.


fun fact: there's an easter egg on https://love2d.org/


It's cool. Really great.


Lua is great, too bad about the array count tho.


That's just part of the language to keep nitpicky people out of the community ;)


Go Adonaac!


Looks sick!


Quote: "You need to have Steam up to run it successfully"

So for an open source game I need to have a proprietary 3rd party software running and I am not talking about video card drivers? Yeah, hard pass.


How dare someone release something that was otherwise paid for free and not cater to my individual moral interests?

If only there was a way to change the game so it did not depend on the evil library...


Is it illegitimate to criticize something which was freely obtained?


With moral grandstanding? Yes. Especially when OP made it clear they were not going to actually obtain and run the software. After all, they could've added a non-Steam patch being OSS.


>With moral grandstanding? Yes.

So stop criticize air pollution?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: