News for hackers. Stuff that matters.
Re:LÖVE: a framework to make 2D games in Lua by keyle on Wednesday September 13, 2023 @07:29AM (#37495310)
I love love2D. It's really a breath of fresh air. I've made many little games and prototypes with it. Lua is fun, and the doco is great. I highly recommend it as a very first dive into game programming.

If you're looking in that realm I also have to mention RAYLIB [1]. It might remind you of the XNA days, except it runs on many platforms and it actually works! (sic.) It's a Borland C style one-file include with some serious power. It's also a ton of fun until you segfault 3 mins into gameplay and you have no idea why. But then you can only blame yourself!

Final plug is of course PICO8. Very different style once again but so much fun[2]! Simple, cheat-sheet style programming, with all batteries included (pixel/spritesheet editor, mini DAW). And the productivity might surprise you, as you don't agonise for days on your third redesign this month.

All of these have vibrant, helpful, communities. You can't go wrong for fun.

[1] https://www.raylib.com/

[2] https://www.lexaloffle.com/pico-8.php

Re:LÖVE: a framework to make 2D games in Lua by dgb23 on Wednesday September 13, 2023 @07:51AM (#37495495)
> It's also a ton of fun until you segfault 3 mins into gameplay and you have no idea why. But then you can only blame yourself!

Raylib has a ton of language bindings. I've been using it with Zig, the integration was seamless and have not encountered these types of bugs yet.

Re:LÖVE: a framework to make 2D games in Lua by stratts on Wednesday September 13, 2023 @10:49AM (#37497489)
You don't even necessarily need bindings to use Raylib in Zig. It uses Zig's build system so you can just clone Raylib's repo, add a couple of lines to build.zig, and it's ready to go with autocompletion and everything.

Both Raylib and Zig include all dependencies too, so I was able to build a single 700kb .exe from Linux, copy that to my Windows machine, and it just worked immediately without any issues. Pretty amazing.

Re:LÖVE: a framework to make 2D games in Lua by rishav_sharan on Wednesday September 13, 2023 @01:18PM (#37499124)
Would you have any tutorial on how to do this? I am unable to get zig .11 to work with the latest raylib without binding libs. I am not sure what all changes I need to make to build.zig
Re:LÖVE: a framework to make 2D games in Lua by stratts on Wednesday September 13, 2023 @07:46PM (#37503132)
This is what works for me, assuming an clean project created using 'zig init-exe':

At the top of your build.zig, import the raylib build.zig inside raylib's /src folder (exact path will depend where you've cloned raylib)

  const raySdk = @import("raylib/src/build.zig");
Use the imported addRaylib() function to build raylib, then link to the exe and add include path

  var raylib = raySdk.addRaylib(b, target, optimize, .{});
  exe.addIncludePath(.{ .path = "raylib/src" });
  exe.linkLibrary(raylib);
After that, you should be fine to just use @cImport to use raylib within your project

  const ray = @cImport({
    @cInclude("raylib.h");
  });

  pub fn main() void {
    ray.InitWindow(800, 450, "raylib [core] example - basic window");
    ...
Re:LÖVE: a framework to make 2D games in Lua by rishav_sharan on Thursday September 14, 2023 @05:18AM (#37506662)
Thank you. It worked perfectly for me. I was doing most of these but I was messing up the include path. your code samples helped me fix the issues in my build file. Have a great day!
Re:LÖVE: a framework to make 2D games in Lua by archargelod on Wednesday September 13, 2023 @09:01AM (#37496189)
> Final plug is of course PICO8.

Cannot not mention a Tic80. It is a FOSS alternative to PICO8.

Main differences are: 16:9 aspect ratio, no cpu limits and many languages to tinker with: lua, js, moonscript, ruby, squirrel, wren, fennel, janet, wasm, ... and just recently - a Python support was added.

https://tic80.com

https://github.com/nesbox/TIC-80

Re:LÖVE: a framework to make 2D games in Lua by dicytea on Wednesday September 13, 2023 @09:04AM (#37496221)
Re:LÖVE: a framework to make 2D games in Lua by marttt on Wednesday September 13, 2023 @01:57PM (#37499570)
And also Load81 by Antirez: https://github.com/antirez/load81 (Lua).
Re:LÖVE: a framework to make 2D games in Lua by niutech on Sunday September 17, 2023 @06:08PM (#37549796)
Re:LÖVE: a framework to make 2D games in Lua by TylerE on Wednesday September 13, 2023 @11:59AM (#37498471)
What is so fun about lua? The few times I've come into contact with it I've been...less than thrilled with what I've seen. Looks like a lobotomized version of a language I'd like, with ugly, verbose syntax.
Re:LÖVE: a framework to make 2D games in Lua by brooke2k on Wednesday September 13, 2023 @01:17PM (#37499100)
it's kind of like lisp's ugly cousin. Super-duper simple at its core, built around a single data structure (tables instead of lisp's lists), and flexible enough, thanks to meta-tables, that you can build extensions on top of it to fit it to what you need
Re:LÖVE: a framework to make 2D games in Lua by keyle on Wednesday September 13, 2023 @07:05PM (#37502830)
It's a lot more consistent and predictable than Javascript.
Re:LÖVE: a framework to make 2D games in Lua by CodeL on Wednesday September 13, 2023 @12:00PM (#37498481)
Great to hear about the diverse tools available for game development. Whether love2D or PICO8, there's something for everyone, from beginners to seasoned developers.
Re:LÖVE: a framework to make 2D games in Lua by sssilver on Wednesday September 13, 2023 @12:00PM (#37498485)
I wish PICO-8 and TIC-80 doubled resolution for the IDE part. The fonts make it hard to do serious long work and working in an external IDE isn’t as fun for kids.
Re:LÖVE: a framework to make 2D games in Lua by TylerE on Wednesday September 13, 2023 @02:13PM (#37499761)
Seems like a good way to teach about sub-pixel rendering and HighDPI. Perhaps abstract so the screen is an addressable pixel (so as not to break the world), divide each virtual pixel into, say, a 4x4 submatrix (or even 8x8, 16x16, etc), and have new (prefixed?) functions that work on the sub-pixels (which ideally map 1:1 to actual screen pixels). For back compat, address pixels with two offets..one in the virtual grid, and one for the sub pixel.
Re:LÖVE: a framework to make 2D games in Lua by munificent on Wednesday September 13, 2023 @02:15PM (#37499788)
I've been working on a fantasy console for several years now that is essentially that: a sort of "16-bit" scale version where PICO-8 is more "8-bit" scale.

No idea if it will ever see the light of day, but it's been a very therapeutic hobby project.

Re:LÖVE: a framework to make 2D games in Lua by sssilver on Wednesday September 13, 2023 @07:21PM (#37502960)
Is it opensource? I'd love to check it out.
Re:LÖVE: a framework to make 2D games in Lua by munificent on Thursday September 14, 2023 @12:48PM (#37511386)
It isn't.

I love open source: my two books are open source, I work in open source, and almost all of my hobby projects are open source.

But after spending all day coordinating with users and combing through the issue tracker, there's something very relaxing to me to have a little project where I don't feel "on stage" whenn working on it. It's good for me to get a social break.