Expand description
§
1
2
§Bevy Scripting
Although Bevy doesn’t directly support scripting, efforts are underway to incorporate it. This crate represents an initial attempt to enable scripting within Bevy’s existing framework. It’s important to note that this is a work in progress and not yet optimized or complete. As Bevy evolves, significant changes to this API are anticipated.
§Why Use Scripts?
- Update your game mechanics without the need for re-compiling
- Encapsulating game logic in scripts paves way for modders to create custom content easilly
- Scripting game logic/UI in a simpler language broadens development accessibility to non-programmers on your team
§Features
- Script management via commands
- Hot loading
- Support for multiple scripting languages
- Extremely flexible bindings
- Attach bindings to ANY reflect implementing types including foreign types.
- Globals and bindings are set in one place and translated to all supported languages
- Broad set of core Bevy bindings generated for you
- Dynamic systems & components registerable from scripts
- Scripts can run in parallel to existing rust systems or other scripts
- Customizable event driven communication between bevy and scripts (
on_update
,on_init
etc..) - Documentation generation
§Benchmarks
BMS applies continuous benchmarking and the latest benchmark results can be found over at bencher.dev.
The tested scripts themselves are placed in the assets/benchmarks
directory.
§Support
The languages currently supported are as follows:
Language |
---|
Lua |
Lua51 |
Lua52 |
Lua53 |
Lua54 |
Luajit |
Luajit52 |
Luau |
Rhai |
§Documentation
For examples, installation and usage instructions see our shiny new book
§Bevy Compatibility
BMS generates code based on each bevy release, which is why we pin the patch version of bevy too.
bevy_mod_scripting | bevy |
---|---|
0.11.1+ | 0.15.3 |
0.9.5+ | 0.15.2 |
0.9.1+ | 0.15.1 |
0.9 | 0.15.0 |
0.8 | 0.15.0 |
0.7 | 0.14 |
0.6 | 0.13.1 |
§Supported Platforms
platform | is supported? |
---|---|
Windows | yes |
Linux | yes |
MacOS | yes |
WASM | no, see this issue |
the coverage does not include generated bindings. ↩
The crate strictly enforces no
unwrap
,expect
,panic
ortodo
’s via clippy lints. ↩Due to the recent re-write of the crate, documentation generation as well as rune support are temporarilly on hold. They will likely be re-implemented in the future. ↩
Modules§
Macros§
- impl_
get_ type_ dependencies - Proc macro equivalent of
GetTypeDependencies
which does not generate a type, purely the impl. Useful for generating implementations against remote types.
Structs§
- BMSPlugin
ScriptFunctionsPlugin
CoreScriptGlobalsPlugin
BMSScriptingInfrastructurePlugin
LuaScriptingPlugin
RhaiScriptingPlugin
- Script
Functions Plugin - A plugin that registers the core scripting functions.
Functions§
Attribute Macros§
- script_
bindings - Derive macro for generating script bindings from an impl block.
- script_
globals - Derive macro for generating script globals from an impl block.
Derive Macros§
- GetType
Dependencies - Derive macro for generating
GetTypeDependencies
implementations. - Into
Script - Default implementation for the
IntoScript
trait - Typed
Through - Default implementation for the
TypedThrough
trait