9 ms·
How to make a game from scratch using Lua and Löve
- JohnKacz 9y agoWow, this is fantastic and I just realized Github has topics. Anyone have recommendations of other really well done complete tutorials on https://github.com/topics/tutorial https://github.com/topics/tutorial ?
- vlunkr 9y agoNice! I’ve had good experiences with love, I’ll definitely check this out
- HiroshiSan 9y agoAre there any more tutorials like this on creating games?
- ShaneWilton 9y agoIt's not a tutorial, per se, but Game Programming Patterns is a free online book that explores common design patterns in game development: http://gameprogrammingpatterns.com/ http://gameprogrammingpatterns.com/ As a non-game developer, it's been one of the most invaluable resources I jump too when trying to optimize something.
- philsnow 9y agoI bought this book and finished it in a couple hours. It's fun to read and the examples are well-illustrated, but it doesn't go into very much depth on anything and its breadth isn't terribly wide either. I would say it's good for people who are learning programming in order to learn to make games, but people who are already programmers won't get much from it.
- sitkack 9y agoAside, how does one archive/move/transform github issues? I like the low-friction aspect of blog posts as issues, but they aren't first class WRT git. The content is locked into the github ecosystem, not replicated/cloned/backedup. Github wikis can be cloned, https://help.github.com/articles/adding-and-editing-wiki-pages-locally/ https://help.github.com/articles/adding-and-editing-wiki-pag... But it doesn't look like github wiki pages can have issues/comments associated with them.
- adnzzzzZ 9y agoRight now I'm manually posting the markdown files on the repository when I'm done editing them https://github.com/SSYGEN/blog/tree/master/posts https://github.com/SSYGEN/blog/tree/master/posts But it's not a good solution I think.
- LyalinDotCom 9y agoDoes VS Code have a good enough Lua extension to be used for stuff like this?
- nrjames 9y agoIt does. There are Lua and Love2D extensions. I use Atom when working with Love2D, however. The tooling there is better. BTW, there’s a great short Love2D course on Udemy. https://www.udemy.com/lua-love/ https://www.udemy.com/lua-love/
- seibelj 9y agoThis is an unpopular opinion, but I wish Lua had won against python. It integrates seamlessly with C and for an interpreted language it’s super efficient. Rather than including every library under the sun in the standard lib, Lua is compact and the entire compiled binary is measured in kilobytes. You can read the Lua source code in C and comprehend a lot of it in a weekend. Lua Rocks package manager includes basically every library you could want. Lua doesn’t even include proper object oriented programming, but is so powerful you can add support for it quite easily, and is a good learning experience for aspiring Lua programmers. Lua is a great language, I wish it was mentioned and compared against more popular languages like Python and JavaScript.
- kirubakaran 9y agoDo you have any insights on why Lua didn't win?
- suby 9y agoI'm not OP, but I couldn't get past the fact that arrays start at 1 rather than 0.
- seibelj 9y agoTotally agree with you. Zero-indexed arrays are one of those language design dogmas that are simply set in stone, really awkward to switch between languages when Lua has such a fundamental difference of opinion.
- grzm 9y agoWhile many languages follow a 0-indexed convention, as you see here, not all do. Another couple of cases I run into are Postgres arrays, and switching between “first”, “second”, and “nth” in Clojure. If it helps, you can think 0-indexed as referring to the offset, and 1-indexed as referring to the position. It’s a shame to dismiss the entire language due to what one might argue is a minor aspect.
- 9y ago
- cableshaft 9y agoThanks for this. I've been thinking about sitting down and diving into Love recently and this should help save me a lot of time.
- djhartman 9y agoI'm trying to get in to game dev as a hobby and Love/Lua is great for someone who wants to make games, but would rather spend time writing code than learning something like Unity. Lua is simple and very easy to pick up, although I think the next time I touch Love and Lua I'll try out the OOP library the author mentions instead of rolling my own classes. Other things on my list to try are Phaser for the easy cross platform distribution (it's JavaScript) and Godot, because although I enjoy coding little games "from scratch" I feel like I would be much more productive with the tools that Godot or Unity offer. Here's my little game: https://github.com/dj/dinojump https://github.com/dj/dinojump
- alexeldeib 9y agoI’m in a similar boat. No experience with Unity or game dev in general, ran through some tutorials but it seems really heavy for doing something simple. I coincidentally picked up Lua recently and found it a delight, and this framework looks right up my alley.
- nunodonato 9y agoMy first "real" game[0] was made in lua and love. It was a great experience and I loved the community (pun intended). Godot engine has got me now, but I always keep an eye on lua and love. One thing that also made me laugh a lot (despite some people labeling it as unprofessional) is the funny love-related names people give to libraries. Stuff like: HUMP, Gspot, flUIds, Polygami, Swinger, Love Bone, etc. Such a funny community :D [0] http://www.bitoutsidethebox.com/autumn http://www.bitoutsidethebox.com/autumn
- fileeditview 9y agoAs a long time "Lover" I was delighted when I discovered that repo long ago. I starred it and forgot about it. Nice to see you finished it. I always wondered how to make an open source game but still sell it. This seems like a plausible way to do. Hope you have a decent income from it! That said, Love is a really great framework and I always wish there was something like it for Go. While I like Lua, I prefer compiled languages and I think Go could be nice for games but it is still lacking in that domain. edit:typos
- citeguised 9y agoYou could try RayLib, it works really well with Golang. http://www.raylib.com/ http://www.raylib.com/ https://github.com/gen2brain/raylib-go https://github.com/gen2brain/raylib-go
- fileeditview 9y agoHey thanks for the comment. In fact I know raylib. I made some simple particle library in C for it. I think raylib is really great. It is very comparable to Love in greatness :-) and I keep recommending it to people. However the go bindings have one problem (all go bindings for game frameworks i know of have this problem): it is not so easy/impossible to leverage the build target capabilities of raylib. E.g. the web target will just not work at the moment and the mobile targets will also involve a lot of fiddling. It is cool to play around with but if you really want to make a game and deploy it to many targets none of the current go "solutions" is great. Maybe "ebiten" is good in this regard but there are some other showstoppers for me (no shaders.. etc.)
- bringtheaction 9y agoI am currently writing a little game using vanilla JS and HTML5 Canvas. I plan on porting it to other platforms once I have a version of the game that is sufficiently complete and that is fun to play. I haven’t thought much about what languages to use for the ports yet but maybe I will give Lua a try. I want to target iOS first. Personally I am excited to port it to iOS but not so excited about Android because I want to try Swift and because I have an iPhone whereas my Android devices were all disappointing and I don’t like Java. According to https://love2d.org/wiki/Game_Distribution https://love2d.org/wiki/Game_Distribution it is possible to target both iOS and Android with Lua + Löve. If it turns out to be comfortable to work with and sufficiently performant I would prefer using Lua and Löve to target both of iOS and Android instead of Swift and Java respectively. Has anyone here had experience writing for iOS or Android with Lua + Löve? Did it work well both in terms of tooling and coding and performance of the finished game?
- omn1 9y agoHaven't worked with Lua + Löve on Android yet, but Kotlin might be an alternative. Comparably convenient like Swift IMHO.
- CJefferson 9y agoI looked at love for teaching school children. It looked great, except they unfortunately use some sexual names for many of the most common libraries (like anal and lube). Highly amusing I'm sure, but I'm afraid not safe for children!
- loup-vaillant 9y agoYou don't have to give all the context to the children. And if they're not already old enough to understand what "anal" means, you can just say it's a butt joke (or maybe just leave them to their ignorant innocence, they can just believe it's a made up name for a time). If they are old enough, I'm afraid avoiding the word is going to save them. "Lube" is used in non-sexual context. You can escape the puritan "inappropriateness" by referring to mechanics. Also, how about replacing all sexual names by something else? A little sed script should be enough, right?
- CJefferson 9y agoIn practice, modern teenagers are going to go to the love wiki to find libraries and documentation, that's the main place to find it. There is no point me giving them an incompatible variant, which won't let them take their programs home. Also, it's easy to say "oh kids, just tell them it's a joke", but in today's society, that is the kind of thing which could easily get one fired. If just one library was named sexually, it would be easy to say "oh, you are misreading that", but the pattern is obvious.
- loup-vaillant 9y ago> In practice, modern teenagers are going to go to the love wiki to find libraries and documentation, Crap, so much for find & replace then. > in today's society, that is the kind of thing which could easily get one fired. Oh, that bad? Well, one more reason for me not to move where you live, I guess.
- TulliusCicero 9y agoThe problem here is that even if the teacher does as you say, guess what will happen when the parents hear about it. If you guessed, "be really, really mad at the teacher and yell at the school administration", congrats, you win.
- babuskov 9y agoI never looked into it before, but their basic game loop is flawed. It would work fine on Windows, but Linux and Mac have high resolution system timers and SDL_Delay(1) which is called underneath would really sleep 1ms (or maybe 2-3ms, but rarely more). This means that the game would run at 1000 fps and consume much more system resources than needed. A much better approach would be to calculate how much extra time we have and then sleep that long (optionally minus 1ms to allow for that rare case where you get 2ms sleep). This can be #ifdef'd for non-Windows platforms only.
- fsloth 9y ago"This means that the game would run at 1000 fps and consume much more system resources than needed." I don't really see why this would be a problem for a game which, while running, is generally the most important process for the end user anyway. Of course for services and such background tasks this would be intolerable.
- johnday 9y agoYou're right that it is often the most important thing - but not always. For example, people (myself included) often have a YouTube video playing in the background, which also consumes a lot of resources. Having both may start to cause problems. Regardless it is a good thing to avoid over-computing. It helps those with lower powered computers or people on battery-powered machines.
- deleted 9y ago[deleted]
- fileeditview 9y agoYou can always overwrite the love.run() function and realize your own game loop logic. There are also community libs for this already.
- deleted 9y ago[deleted]
- Tempest1981 9y agoSaw the title, and thought Scratch was https://scratch.mit.edu https://scratch.mit.edu -- a popular way for kids to learn programming basics.