Script support #322
olefasting
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This issue is created for planning and discussions around the creation of a scripting API for the game.
Scripts will be a feature for mods, so it is related to #192.
I am currently working on a refactor that will make use of hecs (ECS), so scripts will primarily be used to implement systems; currently just implementations of the following type
fn(world: &mut World)
, whereWorld
is the hecsWorld
type. This means that we need to expose methods for querying the ecs world for entities while the manipulation of the component data-types can be done by using the standard library of whichever language we choose. We will also need to facilitate declaration of component types. The way hecs works is by allowing any type as a component, so this will be fairly simple.When it comes to language, it is my opinion that LuaJIT is the best fit, as it is widely known and, as the name implies, is JIT compiled.
I don't think we should allow scripts to be used for core code, however. Implementation of systems will require little of Rusts low-level features and Rust already has very good type elision, making it almost as ergonomic as a scripting language, when it comes to verbosity, so doing that would bring few benefits but add a lot of headaches when it comes to verification and QA of code submissions to the core project. For mods, however, the benefits are many, as it allows for addition of logic, without having to recompile, which again ensures that clients are compatible, even though they have different mods/features added, either by simply disabling mods that are not present on all clients or by synchronizing missing mods across clients...
Beta Was this translation helpful? Give feedback.
All reactions