Live data from Hacker News

Grid – A Lua Game Engine

planimeter.org

21–30 of 79 posts

Re: Grid – A Lua Game Engine

#22

Why do people use Lua in a world where we have Python?

LuaJIT is much faster than Python, directly interfaces with C, incredibly small,and the language itself is very simple. This is also built on top of LOVE2D which is written in Lua and is arguably one of the best game frameworks out there.

just a minor nitpick: LOVE2D is written in C++ :-)

Re: Grid – A Lua Game Engine

#24

Why do people use Lua in a world where we have Python?

Does Python have any good game engines? PyGame project is a nightmare. Lua's https://love2d.org/ is amazing.

They are not comparable with Pygame, but easier for beginners:

https://pygame-zero.readthedocs.io

https://github.com/mjbrusso/game2dboard

Disclosure: I am the author of game2dboard

Re: Grid – A Lua Game Engine

#25

Thank you for posting this, Bambo! I was curious why we were seeing 10s of new stars all of a sudden and trying to figure out where the GitHubbers were coming from. Grid Engine 9 is now the largest pure-Lua game engine on GitHub. As s_y_n_t_a_x has mentioned in this thread, I built the Grid Engine on top of LÖVE. I came from the hlcoders world, having used the Source Engine for several years, and was upset the 2D wor…

Hey I know you mentioned it here and it is shown on the getting started tutorial, but may be useful to mention it on the front page too: the engine is built upon Love 2D.

Re: Grid – A Lua Game Engine

#26

Thank you for posting this, Bambo! I was curious why we were seeing 10s of new stars all of a sudden and trying to figure out where the GitHubbers were coming from. Grid Engine 9 is now the largest pure-Lua game engine on GitHub. As s_y_n_t_a_x has mentioned in this thread, I built the Grid Engine on top of LÖVE. I came from the hlcoders world, having used the Source Engine for several years, and was upset the 2D wor…

I also saw this on your repo [1], I was wondering if you are planning to move from Love to it, or what is it about? (just curious :-)

1: https://github.com/Planimeter/lgf

Re: Grid – A Lua Game Engine

#27

Lua is a little confusing language for me because you need to throw out most of the things you know because it has its own way of doing things, it is not necessarily a bad thing but it is confusing. Luckily, it is a very small language so it wouldn't take that long to grasp it all. The most confusing thing was the fact that (almost) everything seems like a hashtable.

Ignoring metatable weirdness, I think "you need to throw out most of what you know" is quite wrong.

The main thing you need to know is that Lua's table type can be numerically iterated between index 1 and the first gap where numeric index has nil value using the ipairs iterator in addition to the non-exclusively-numeric unordered pairs iterator. A common pitfall with sparse tables is that the length shortcut # returns seemingly the wrong result if you aren't aware of that first part.

Most of the difficulty writing in Lua comes from the fact that there's no first class support for OO-style Classes, so you have to fake them, and there's no standard library so you end up reinventing a lot.

But other than that, it's a dead simple language with few features.

Re: Grid – A Lua Game Engine

#28

Why do people use Lua in a world where we have Python?

Does Python have any good game engines? PyGame project is a nightmare. Lua's https://love2d.org/ is amazing.

I'm curious as to what you found nightmareish about Pygame... It's SDL.

Re: Grid – A Lua Game Engine

#29
post #27

Lua is a little confusing language for me because you need to throw out most of the things you know because it has its own way of doing things, it is not necessarily a bad thing but it is confusing. Luckily, it is a very small language so it wouldn't take that long to grasp it all. The most confusing thing was the fact that (almost) everything seems like a hashtable.

Ignoring metatable weirdness, I think "you need to throw out most of what you know" is quite wrong. The main thing you need to know is that Lua's table type can be numerically iterated between index 1 and the first gap where numeric index has nil value using the ipairs iterator in addition to the non-exclusively-numeric unordered pairs iterator. A common pitfall with sparse tables is that the length shortcut # return…

Even the OO shortcomings of Lua aren't very different from the Javascript of the recent past. The two languages are quite similar, save that Lua indices are 1-based and JS comparators are nightmare fuel.

My pet peeve is that it's somewhat verbose in using keywords rather than single-character punctuation to mark blocks and clauses.

Re: Grid – A Lua Game Engine

#30
post #27

Lua is a little confusing language for me because you need to throw out most of the things you know because it has its own way of doing things, it is not necessarily a bad thing but it is confusing. Luckily, it is a very small language so it wouldn't take that long to grasp it all. The most confusing thing was the fact that (almost) everything seems like a hashtable.

Ignoring metatable weirdness, I think "you need to throw out most of what you know" is quite wrong. The main thing you need to know is that Lua's table type can be numerically iterated between index 1 and the first gap where numeric index has nil value using the ipairs iterator in addition to the non-exclusively-numeric unordered pairs iterator. A common pitfall with sparse tables is that the length shortcut # return…

Lua's lack of integer support caused me some issues. Using floor() around everything wasn't really an ideal solution and I ended up changing languages for that project.

Metatables are cool, but have some weirdness to them. For OOP i ended up using metatables to make a simple prototype(rather than class) based system, but it was hacky at best.

Tables themselves are pretty awesome and powerful, but I have to admit, working with them gets a bit tiresome in ways working with dedicated arrays and hash maps don't. You have to remember exactly what kind of data is in your tables and looping through them can be a pain.

Overall though, I still love lua, it's the language that helped me 'get' programming and I wouldn't actually appreciate dedicated data structures and typed variables so much if I hadn't had the experience of starting with a more free, loose and simple language like lua. Also, its ability to easily interface with C and be easily embedded has made it appear in so many different and sometimes strange and just downright cool applications.

I've been playing with the solarus engine lately, it uses lua for its scripting, it's the first time I've written any lua in a while, but i've been enjoying it as I rediscover all the little cool things I like about it and i still think it makes a good first or second language for people.

Having the reinvent the wheel isn't necessarily a bad thing when you're learning. That hacky prototype system I made helped me understand OOP far better than just using classes in other languages had. Even if it didn't really work all that well in the end. It really made me appreciate what a built in class system actually gives you.

Post reply on HN