Live data from Hacker News

Grid – A Lua Game Engine

planimeter.org

61–70 of 79 posts

Re: Grid – A Lua Game Engine

#61

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

IMO, these are the main reasons; 1. Embeddability. You can create a game engine in a performant systems language like c++ and embed lua in it for the scripting. 2. Speed. The lua interpreter is much faster than python in general. When you throw luajit into the fix, they are not really comparable at all. 3. simplicity: lua is tiny. and one of the easier languages for non coders (game designers, artists) to get started…

You could make the same 4 points about Pawn, I don't know why nobody uses it. Pawn has all of lua's strengths without any of its quirks and weaknesses.

Re: Grid – A Lua Game Engine

#62

This looks interesting but the documentation needs more information. I dont want to "mess around" for a few days to learn what this thing is good at. I want to read the docs and be ready to make stuff. eg) https://www.planimeter.org/grid-sdk/api/networkvar https://www.planimeter.org/grid-sdk/tutorials/Getting_Starte...

I will prioritize this immediately. I believe one should be able to understand all of the concepts the engine offers within short order, and clearly I need documentation to back that belief. Everything is there to get started in just minutes, reducing any installation friction typically found with larger game engines, but I agree that documentation should be able to reduce the cognitive friction such that one can get…

If you're looking for inspiration on how to organize your docs, I found this resource really valuable: https://documentation.divio.com

You can see the documentation system in action in this project: https://www.brachiograph.art

Regarding Grid, personally I always like to look at example applications built with framework/library/engine so seeing a list of projects that utilize Grid would be nice.

Re: Grid – A Lua Game Engine

#63
post #41

Earlier quoted context omitted.

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, wor…

Integer support was added in Lua 5.3 (released in January 2015). It also added binary operators, rendering the bitop module obsolete. One thing I never understood is the mania for OO programming---I regularly see people announce Yet Another OO Module for Lua on the mailing list, and I have to ask myself, "Why?" Is OO the only thing taught these days in school? There are other ways of organizing code than OO.

Serious question: How do you organize your data in a semantically meaningful way without something like an object/struct (in a strong type system preferably). I get functional programming and all, but structs just seem like a natural way to organize data.

Re: Grid – A Lua Game Engine

#64

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

I liked the speed and the power of tables. It's also an incredibly simple language. I learned the ins and outs in a couple of days and was able to get right to work on making a game. Almost never did I have to reference documentation after that--it all fit in my head without even really trying to memorize it. Python, on the other hand, has loads of features, but that results in me often looking up the right way to do something since there are so many layers to it. What Lua provides is rather bare, yet powerful and incredibly easy to jump right into.

Re: Grid – A Lua Game Engine

#65
post #63
post #41

Earlier quoted context omitted.

Integer support was added in Lua 5.3 (released in January 2015). It also added binary operators, rendering the bitop module obsolete. One thing I never understood is the mania for OO programming---I regularly see people announce Yet Another OO Module for Lua on the mailing list, and I have to ask myself, "Why?" Is OO the only thing taught these days in school? There are other ways of organizing code than OO.

Serious question: How do you organize your data in a semantically meaningful way without something like an object/struct (in a strong type system preferably). I get functional programming and all, but structs just seem like a natural way to organize data.

Object orientation is not really about making use of structs - many (most?) functional languages also use structs; it's just a grouping of related data.

Object-orientation is about grouping together functionality and data. I.e., an object consists of both a struct, and the functions that act on that struct, known as methods.

In OO, your type additionally refers to the functions called on the data, not just on the data. E.g. you might have a car and a boat and they both only have a position and velocity as data, but the boat has a "sink" method the car doesn't.

There are also debates on what qualifies as "true" object orientation. https://stackoverflow.com/questions/250062/what-is-meant-by-...

For games programming in particular, there is a paradigm known as ECS or Entity Component System. (Depending on your view you might call this a sub-paradigm of object orientation, but I think it's much more accurately described as an alternative.) As the Wikipedia article states:

> An entity only consists of an ID and a container of components. The idea is to have no game methods embedded in the entity.

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

EDIT: There's also the very interesting paradigm that e.g. Julia uses known as "Multiple Dispatch". This is kind of like defining methods on objects, except that the method is defined on a collection of objects instead of a single one.

E.g., in traditional OO, you might have a vehicle#crash method. And it might take another vehicle as argument, e.g. car.crash(truck). But in multiple dispatch you define a function crash that takes in two vehicles, and then depending on the type of the vehicles given, it changes its behaviour so that crash(car, truck) is different from crash(car, car).

In a sense, the function is not thought of as belonging to either the car or the truck, but as belonging to the pair of them, so conceptually this is different to OO.

I'm not particularly familiar with the paradigm so I'm sure I'm not doing it justice, but you can read further on Wikipedia and in the Julia docs, or the given video:

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

https://docs.julialang.org/en/v1/manual/methods/index.html#M...

https://www.youtube.com/watch?v=kc9HwsxE1OY

Re: Grid – A Lua Game Engine

#66

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…

Of course it is you!

Astounding work as always. Thanks!

Re: Grid – A Lua Game Engine

#67
post #63
post #41

Earlier quoted context omitted.

Integer support was added in Lua 5.3 (released in January 2015). It also added binary operators, rendering the bitop module obsolete. One thing I never understood is the mania for OO programming---I regularly see people announce Yet Another OO Module for Lua on the mailing list, and I have to ask myself, "Why?" Is OO the only thing taught these days in school? There are other ways of organizing code than OO.

Serious question: How do you organize your data in a semantically meaningful way without something like an object/struct (in a strong type system preferably). I get functional programming and all, but structs just seem like a natural way to organize data.

To second the use of structs, mostly this. Typically i use structs for most numeric types or anything that doesn't need a method and classes for any reference type with methods. Though, i'll stick to structs/stack allocated data as much as possible.

I try to make a clear distinction between stack and heap stuff and use one or the other where appropriate.

From lua i moved to D for a lot of my heavier projects. I like the way D separates types and uses appropriate reference and copy semantics. Being able to specifically separate heap and stack data and essentially use structs and classes as either copy or reference data just seems fairly straightforward to me.

A struct is just a bunch of stuff of different types grouped up in memory, while a class is essentially a pointer that can be moved to some places in memory and can point to data or functions, use each appropriately and where necessary.

Re: Grid – A Lua Game Engine

#68

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…

Would love to get your thoughts on Mun-lang: https://mun-lang.org/

Re: Grid – A Lua Game Engine

#69

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…

Would love to get your thoughts on Mun-lang: https://mun-lang.org/

Quite an impressive project! I'm curious how the authors went about their strategy for hot reloading in particular.

In Grid, I extend the package library, and utilize the implementation details of `module` which allow one to override or set new keys on subsequent loads of the same file.

It's one of the reasons I don't think I can use the newer module patterns beyond Lua 5.1.5, because as far as I understand, they require one to completely replace what's stored in `package.loaded` versus merging to any existing table.

I had also not given much thought to static typing with Lua until the last year or so working with Lua only because it makes generating documentation harder. Otherwise, I tend to share Roberto Ierusalimschy's opinions of dynamic typing.

I would read his most recent interview from Moscow in 2019. I think he's a very interesting person.

Re: Grid – A Lua Game Engine

#70

Earlier quoted context omitted.

A few casual notes, though I could continue to expand on this: lgameframework is a project I took on some time ago to provide a LuaJIT FFI alternative to LÖVE. It helped educate me on what was necessary to interact directly with the OpenGL layer, and understand what challenges the LÖVE developers will have in the distant future with OpenGL being deprecated on macOS. (Will they move to bgfx? Or Vulkan/MoltenVK? Who kn…

Thanks for the extensive answer! It is very commendable that you want to provide such level of stability for your users. On a side note, your comment made me check: hard to believe Love2d was released 12 years ago now!

Thank you for browsing my work, I greatly appreciate it!
Post reply on HN