diff --git a/Cargo.toml b/Cargo.toml index 6b43c45..10f089d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,9 +6,9 @@ edition = "2024" license = "MIT OR Apache-2.0" readme = "README.md" categories = ["game-development"] -description = "Plugin for Bevy engine that allows you to write some of your game logic in a scripting language" +description = "Plugin for Bevy engine that allows you to write some of your game or application logic in a scripting language" repository = "https://github.com/jarkonik/bevy_scriptum" -keywords = ["bevy", "rhai", "scripting", "game", "gamedev"] +keywords = ["bevy", "lua", "scripting", "game", "script"] [features] lua = ["dep:mlua", "mlua/luajit"] diff --git a/README.md b/README.md index 85f507a..a78498f 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ![demo](demo.gif) -bevy_scriptum is a a plugin for [Bevy](https://bevyengine.org/) that allows you to write some of your game logic in a scripting language. +bevy_scriptum is a a plugin for [Bevy](https://bevyengine.org/) that allows you to write some of your game or application logic in a scripting language. Currently [Rhai](https://rhai.rs/) and [Lua](https://lua.org/) are supported, but more languages may be added in the future. Everything you need to know to get started with using this library is contained in the diff --git a/book/src/introduction.md b/book/src/introduction.md index 63a6a32..823fa41 100644 --- a/book/src/introduction.md +++ b/book/src/introduction.md @@ -1,6 +1,6 @@ # bevy_scriptum 📜 -bevy_scriptum is a a plugin for [Bevy](https://bevyengine.org/) that allows you to write some of your game logic in a scripting language. +bevy_scriptum is a a plugin for [Bevy](https://bevyengine.org/) that allows you to write some of your game or application logic in a scripting language. Currently [Rhai](https://rhai.rs/) and [Lua](https://lua.org/) are supported, but more languages may be added in the future. API docs are available in [docs.rs](https://docs.rs/bevy_scriptum/latest/bevy_scriptum/) diff --git a/book/src/workflow/live_reload.md b/book/src/workflow/live_reload.md index 447e84c..72e21bd 100644 --- a/book/src/workflow/live_reload.md +++ b/book/src/workflow/live_reload.md @@ -9,18 +9,18 @@ within bevy dependency in `Cargo.toml` bevy = { version = "0.16", features = ["file_watcher"] } ``` -## Init-teardown pattern for game development +## Init-teardown pattern -It is useful to structure your game in a way that would allow making changes to -the scripting code without restarting the game. +It is useful to structure your application in a way that would allow making changes to +the scripting code without restarting the application. A useful pattern is to hava three functions "init", "update" and "teardown". -- "init" function will take care of starting the game(spawning the player, the level etc) +- "init" function will take care of starting the application(spawning the player, the level etc) -- "update" function will run the main game logic +- "update" function will run the main application logic -- "teardown" function will despawn all the entities so game starts at fresh state. +- "teardown" function will despawn all the entities so application starts at fresh state. This pattern is very easy to implement in bevy_scriptum. All you need is to define all needed functions in script: @@ -35,7 +35,7 @@ local function init() player.entity = spawn_player() end --- game logic here, should be called in a bevy system using call_fn +-- application logic here, should be called in a bevy system using call_fn local function update() (...) end @@ -45,7 +45,7 @@ local function teardown() despawn(player.entity) end --- call init to start the game, this will be called on each file-watcher script +-- call init to start the application, this will be called on each file-watcher script -- reload init() ``` diff --git a/examples/lua/side_effects.rs b/examples/lua/side_effects.rs index e3567ff..2bf4a86 100644 --- a/examples/lua/side_effects.rs +++ b/examples/lua/side_effects.rs @@ -4,7 +4,7 @@ use bevy_scriptum::runtimes::lua::prelude::*; fn main() { App::new() - // This is just needed for headless console app, not needed for a regular bevy game + // This is just needed for headless console app, not needed for a regular bevy application // that uses a winit window .set_runner(move |mut app: App| { loop { diff --git a/examples/rhai/side_effects.rs b/examples/rhai/side_effects.rs index 28a6770..f91ca3b 100644 --- a/examples/rhai/side_effects.rs +++ b/examples/rhai/side_effects.rs @@ -4,12 +4,14 @@ use bevy_scriptum::runtimes::rhai::prelude::*; fn main() { App::new() - // This is just needed for headless console app, not needed for a regular bevy game + // This is just needed for headless console app, not needed for a regular bevy application // that uses a winit window - .set_runner(move |mut app: App| loop { - app.update(); - if let Some(exit) = app.should_exit() { - return exit; + .set_runner(move |mut app: App| { + loop { + app.update(); + if let Some(exit) = app.should_exit() { + return exit; + } } }) .add_plugins(DefaultPlugins) diff --git a/examples/ruby/side_effects.rs b/examples/ruby/side_effects.rs index 031bdea..85c8564 100644 --- a/examples/ruby/side_effects.rs +++ b/examples/ruby/side_effects.rs @@ -4,12 +4,14 @@ use bevy_scriptum::runtimes::ruby::prelude::*; fn main() { App::new() - // This is just needed for headless console app, not needed for a regular bevy game + // This is just needed for headless console app, not needed for a regular bevy application // that uses a winit window - .set_runner(move |mut app: App| loop { - app.update(); - if let Some(exit) = app.should_exit() { - return exit; + .set_runner(move |mut app: App| { + loop { + app.update(); + if let Some(exit) = app.should_exit() { + return exit; + } } }) .add_plugins(DefaultPlugins) diff --git a/src/lib.rs b/src/lib.rs index 173dda0..5e57a21 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,6 @@ //! ![demo](demo.gif) //! -//! bevy_scriptum is a a plugin for [Bevy](https://bevyengine.org/) that allows you to write some of your game logic in a scripting language. +//! bevy_scriptum is a a plugin for [Bevy](https://bevyengine.org/) that allows you to write some of your game or application logic in a scripting language. //! Currently [Rhai](https://rhai.rs/) and [Lua](https://lua.org/) are supported, but more languages may be added in the future. //! //! Everything you need to know to get started with using this library is contained in the @@ -15,7 +15,7 @@ //! - flexibility //! - hot-reloading //! -//! Scripts are separate files that can be hot-reloaded at runtime. This allows you to quickly iterate on your game logic without having to recompile your game. +//! Scripts are separate files that can be hot-reloaded at runtime. This allows you to quickly iterate on your game or application logic without having to recompile your game. //! //! All you need to do is register callbacks on your Bevy app like this: //! ```no_run