Live data from Hacker News

I open sourced my game along with a tutorial on how to make it using Lua

github.com

81–90 of 96 posts

Re: I open sourced my game along with a tutorial on how to make it using Lua

#81
post #55

What was the process of compiling your love to a standalone executable? I'd love to try out LOVE but I dont want to sink time in unless the process of packaging it up into something I can send my friends is painful or not well supported. Also, are you using moonscript and SDL2 in this? Great project by the way! The pixellated graphic effects are clever and unique.

https://love2d.org/wiki/Game_Distribution

Re: I open sourced my game along with a tutorial on how to make it using Lua

#82
post #75

Earlier quoted context omitted.

rxi indeed is awesome! Do you know in what language/engine his (her?) tools on itch.io are written? They all have an awesome pixelart look to them and I wonder if (s)he uses lua for them too.

The tools are all written in C and use microui[1] for the UI. The games are typically written in LÖVE with the exception of SCANLINE which uses Nim [1] https://github.com/rxi/microui

First time I heard about 'lite'. I have to say the first impression is really great. Fast and smooth. Nice work!

Re: I open sourced my game along with a tutorial on how to make it using Lua

#83

Cool project with awesome visuals! It's always interesting to see games published made with LÖVE in lua. I'm writing an "Advance Wars 2" clone at the moment in LÖVE and hope to get some inspiration from your code. You seem to use a lot of global variables. Is that on purpose? I try to do as much as possible with local variables (although especially in game logic global entities are sometimes just the easiest way). I'…

The author explains their reasoning about globals here.

https://github.com/a327ex/blog/issues/24

It mainly boils down to the fact that an indie game written by one person and never maintained after release doesn't need to be written for maintainability. Supposedly there are productivity gains the author receives from doing this.

Personally, I disagree from past experiences dealing with hundreds of globals in legacy code, but to each their own.

Re: I open sourced my game along with a tutorial on how to make it using Lua

#84
post #20

Earlier quoted context omitted.

You wouldn't end up with this: s:sub(0, #s) You would end up with: s:sub(0, #s - 1) Which demonstrates the off-by-one error.

That would be strange, in Ruby s = "foo" s.length #=> 3 s[0, s.length] #=> "foo" Same in JavaScript s.slice(0, s.length) and Python s[0:len(s)]

Yet, none of those are consistent with that on non-string objects:

To get the last object of an array in JS is:

    arr = [1, 2, 3]
    arr[arr.length - 1]
To get the last object of an array in Python is:

    arr = [1, 2, 3]
    arr[len(arr) - 1]
To get the last object of an array in Lua is:

    arr = {1, 2, 3}
    arr[#arr]

Re: I open sourced my game along with a tutorial on how to make it using Lua

#85

I've never heard of Lua, but now that I am looking at it, it seems very friendly. Love how they call things what they are, for example `local` is just a local variable, or `repeat X until Y` for a loop. It's a joy to see, to be honest.

Planimeter's Grid Engine[1] was posted to HN recently, which is entirely built in Lua and the largest pure-Lua game engine![2]

[1]: https://www.planimeter.org/grid-sdk/ [2]: https://github.com/topics/love2d

Additionally, adnzzzzZ and I are both from the Facepunch/Knockout community, where a lot of Lua developers have come from due to its popularity in Garry's Mod. It also had a wonderful web dev community.

There are a lot of cool developers from that community, like Gran PC who works at itch.io and worked on The Stanley Parable, and TheBerkin who designed rant, among many other highly skilled individuals, though most people at HN are probably more familiar with developers like sebmck who wrote 6to5, which later became Babel, and Gabriele Cirulli who wrote 2048.

Re: I open sourced my game along with a tutorial on how to make it using Lua

#86
post #84

Earlier quoted context omitted.

That would be strange, in Ruby s = "foo" s.length #=> 3 s[0, s.length] #=> "foo" Same in JavaScript s.slice(0, s.length) and Python s[0:len(s)]

Yet, none of those are consistent with that on non-string objects: To get the last object of an array in JS is: arr = [1, 2, 3] arr[arr.length - 1] To get the last object of an array in Python is: arr = [1, 2, 3] arr[len(arr) - 1] To get the last object of an array in Lua is: arr = {1, 2, 3} arr[#arr]

There is a difference between order and offset, both consistent and makes sense. We use both models in everyday life. Examples of offset are ruler (marks 0, 1, ...), time offset (this hour, next hour, ..), age (newborn, one year, two years), count (last, last but one). That's reflected in our languages [1].

> non-string objects

There is no difference between array and string access in ruby, python, js.

There are better ways to access last element (python, ruby):

    >>> arr[-1] # meaning first element from back (1-indexing!)
    3
I mentioned your comment is wrong. I do not know why you are turning it into 0-indexing vs 1-indexing, looks like changing topic for me.

[1] https://en.wikipedia.org/wiki/Comparison_of_programming_lang...

Re: I open sourced my game along with a tutorial on how to make it using Lua

#87

I've never heard of Lua, but now that I am looking at it, it seems very friendly. Love how they call things what they are, for example `local` is just a local variable, or `repeat X until Y` for a loop. It's a joy to see, to be honest.

There’s a successor to Lua in the works called Mun: https://mun-lang.org/

It is written in Rust and aims to be 100% hot-reloadable.

Re: I open sourced my game along with a tutorial on how to make it using Lua

#88

Earlier quoted context omitted.

I think the main problem with 1-indexing is that it makes some formulas that depend on the length of an array more complicated. Not a huge problem, but it's kind of annoying.

It replaces the standard [0,len()) with an [1,len()], though, which correspondingly makes other tasks easier. Plus it matches normal mathematical vector indexing. In the end, in a language where you aren't doing pointer arithmetic, the sides are pretty even. We just tend to side with tradition, because it's easier to.

I found it uncomfortable when drawing on screen:

   y = margin + (i - 1) * lineheight

Re: I open sourced my game along with a tutorial on how to make it using Lua

#89

I've never heard of Lua, but now that I am looking at it, it seems very friendly. Love how they call things what they are, for example `local` is just a local variable, or `repeat X until Y` for a loop. It's a joy to see, to be honest.

There’s a successor to Lua in the works called Mun: https://mun-lang.org/ It is written in Rust and aims to be 100% hot-reloadable.

To be fair, Lua is already "100% hot-reloadable." Module definitions are just tables, so references can be redefined during runtime.

Re: I open sourced my game along with a tutorial on how to make it using Lua

#90

Cool project with awesome visuals! It's always interesting to see games published made with LÖVE in lua. I'm writing an "Advance Wars 2" clone at the moment in LÖVE and hope to get some inspiration from your code. You seem to use a lot of global variables. Is that on purpose? I try to do as much as possible with local variables (although especially in game logic global entities are sometimes just the easiest way). I'…

The author explains their reasoning about globals here. https://github.com/a327ex/blog/issues/24 It mainly boils down to the fact that an indie game written by one person and never maintained after release doesn't need to be written for maintainability. Supposedly there are productivity gains the author receives from doing this. Personally, I disagree from past experiences dealing with hundreds of globals in legacy c…

Thank you for the link, that's exactly what I was looking for.

I see the point that a single developer does not have to focus on maintainability so much. And if it works for him -- as it obviously does -- more power to him.

But for me, I do not think I am mentally capable to reason about my program if it has to many globals. If I can have as much as possible local, my mental model also can be local.

I am very new to gamedev, so this way of thinking may not be appropriate in the long run.

Post reply on HN