Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any love for Lua? #4

Closed
gamedevsam opened this issue Jul 31, 2022 · 7 comments
Closed

Any love for Lua? #4

gamedevsam opened this issue Jul 31, 2022 · 7 comments

Comments

@gamedevsam
Copy link

I think this project is awesome, and a great sign of things to come for the Bevy / Rust game dev ecosystem.

With that said, I think JS/TS as a scripting language is suboptimal due to the complexity of the runtime. Many games use Lua for scripting due to its ease of integration with game engines and generally fast performance.

Have you considered tackling Lua as a scripting language for Bevy?

Might make for a fun project after this one, and possibly reach a "stable" condition much more quickly due to its simplicity.

@zicklag
Copy link
Contributor

zicklag commented Jul 31, 2022

I think JS/TS is a good solution for scripting because it's very commonly known and taught, and we are able to compile TS without needing tsc, so you get static typing with no need for additional JS toolchains such as npm. And TS type checking comes with VSCode, so it's very low barrier to entry.

Also, using the deno_core crate, it's actually very easy to embed V8, which can have quite good performance, too, so complication of embedding hasn't really been troublesome with deno_core yet in my experience.

Anyway, Lua is very common in the game development space too, though.


I didn't make this project and have barely looked through it so far, but I have been working on something very similar over the last week, and as far as I can figure, it seems that a lot of what's done here can be portable to other scripting languages such as lua.

I'm hoping the dynamic query design can probably be largely re-used and we just have to worry about binding it to another language using whatever Rust bindings or Rust scripting languages we want.

I'm not sure if it's something @jakobhellermann want's to pursue, but either way, I'm hoping that some of the dynamic query interfaces developed here will be able to be ported to other plugins that can use it to implement whatever language they want, after it stabilizes a little bit.

@jakobhellermann
Copy link
Owner

What @zicklag said is pretty much spot on. All the work required for making this crate possible is also required for building language integrations for lua, wasm, LISPs, ...
So far this is just a test bed for building and testing dynamic APIs in bevy.

The next steps would be to extract the language-independant bits like a dynamic query API (#5) etc., and then build specific language integrations for lua, js, etc. (which can be a split community effort).

@erlend-sh
Copy link

erlend-sh commented Aug 2, 2022

Meanwhile, @makspll is already exploring the Lua angle (with additional tealr superpowers, like types and better docs) in https://github.com/makspll/bevy_mod_scripting

For our game we will be trying out both approaches:

@makspll
Copy link

makspll commented Aug 2, 2022

My crate is very much missing the dynamic query component, but from a quick look it looks like it's possible in current bevy?

@zicklag
Copy link
Contributor

zicklag commented Aug 2, 2022

it looks like it's possible in current bevy?

Yep, apparently! I don't understand it all yet, but it's pretty much all self-contained in dynamic_query.rs. The workings are a little confusing if you don't know the details about the Bevy ECS ( which I don't yet ), but the code itself is clean and easy to read.

I'm going to try and copy that file to my crate and wire it up to my own script API bindings to see how it works. You could probably do the same with your plugin.

@makspll
Copy link

makspll commented Aug 2, 2022

Will definitely take inspiration haha, it looks like it'll be very easy to plug it in

@gamedevsam
Copy link
Author

@erlend-sh thanks for the link, I think that effectively closes out this issue, thanks for the discussion crew!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants