Skip to content

Script support #311

@olefasting

Description

@olefasting

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), where World is the hecs World 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...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions