-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Add support for non compiling scripting language #2352
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
Comments
Adding an first party scripting language is officially a non-goal. However, there are plans for making it possible to tightly integrate scripting languages in third party modules. |
Rhai is an interesting one, but probably not ideal scripting language. I myself will try to use it to program separate systems in runtime (mostly for prototyping purposes, but maybe also for "games about programming") I didn't tried Rhai+Bevy yet, but Rhai alone seems nice. |
This is not completely true, you can distribute a binary of your game that you compiled, and then anyone can play it without having rustc. That said, it really depends on what you want to be able to script:
|
Can I ask why this is the case? I assume you see the value in a scripting language. I understand if your motivation is to not force bevy users to use any specific language. Some research around using wasm could be the answer here. Our friends over at swc are currently developing a plugin system using wasm (Wasmer I believe). This could be a good way to provide a first party solution for scripting. Maybe even a first party language since it would be as easy to integrate any language that supports wasm. |
Scripting languages create a strict barrier between the engine and game code, which can be undesirable. On another note, wasm is definitely considered as a possiblity for modding and scripting. |
Just thought i would mention a few use-cases in support of this issue.
for example, with godot, they have gd-native to write libraries to load at runtime or compile time from gdscript. they can afford that because C has a stable ABI. meanwhile, bevy uses rust features heavily like Traits and most of them are not ABI Safe, so exposing bevy to any scripting lang would be a pain. bevy is just not designed with the use case of FFI. godot doesn't really need to expose a "modding" interface. games can just load godot scenes as well as gdscripts from random folders at runtime. mods are as easy and safe as putting into a folder. any kind of runtime modding support with Bevy is much much harder. having first class support for scripting langauge is a huge benefit for being "accessible" to a lot of people. modders, devs and users. |
+1 @coderedart |
#4474 is going to help move this forward. |
You can probably implement interpreted language support for user generated content with the help of something like boa. I don't think an interpreted language should become part of the engine. I have used jint in Unity before, it took ~5 C# files to implement a little framework where people could use JavaScript to interact with a tiny API. Admittedly, the project would grow much more if the API actually did things other than updating object positions, but I would leave this out of the engine |
I agree the language shouldn't be part of the engine, but facilities for enabling one should be provided |
There's an up-and-coming third party crate for scripting here: https://github.com/makspll/bevy_mod_scripting |
What problem does this solve or what need does it fill?
Currently Bevy require to have on computer rustc compiler to be able compile and use game which user created.
What solution would you like?
Adding new interpreted language will allow to run games without needing to compile anything.
Such language is really great to create fuzzers or tests
Engines like Godot or Unreal Engine have their own scripting languages GDScript and Unreal Verse(still WIP) which doesn't require compiling and works on almost any computer out of box.
Other engines use e.g. Python or Lua but this greatly increase its size since additional software must be present inside game engine to properly parse and execute code written in this languages
The text was updated successfully, but these errors were encountered: