Difference between revisions of "Proposals/Client scripting plans"

From Minetest Developer Wiki
Jump to navigation Jump to search
(Created page with "Minetest is planned to get client side scripting. This page summarizes the plans for development, and tries to document the consensus inside the core development team. If your...")
 
Line 8: Line 8:
 
Unlike with web browsers, lua code should run in a separate thread.
 
Unlike with web browsers, lua code should run in a separate thread.
  
=== Base execution ===
+
=== Base execution setup ===
Every server mod can have a directory "client" whose content will be sent to the client upon connection. After all files have been sent, the client executes an "init.lua" file for every of those mods.
+
Every server mod can have a directory "client" whose content will be sent to the client upon connection. After all files have been recieved, the client executes an "init.lua" file for every of those mods.
  
To emphase the short-lived-ness of the code, the client shouldn't give any access to the filesystem, all lua files should be held in memory. There can be caches (even permanent ones), but lua code shouldn't be abled to "just access the filesystem".
+
To emphase the short-lived-ness of the code, the client shouldn't give any access to the filesystem. This implies that all lua files should be held in memory. There can be caches (even permanent ones, like with the texture cache), but lua code shouldn't be abled to "just access the filesystem", not even subdirectories.
  
 
=== Communication between server and client ===
 
=== Communication between server and client ===

Revision as of 22:47, 17 June 2015

Minetest is planned to get client side scripting. This page summarizes the plans for development, and tries to document the consensus inside the core development team. If your changes don't want to serve this **documenting** purpose, please **don't edit** this page (except trivial edits like grammar corrections), but rather edit the talk page, or suggest changes in irc. This is no Feature request page.

General design

The language will be plaintext lua (no bytecode, as it's insecure and against the open source nature of minetest). There won't be any restrictions on mod licenses though.

The general design should be much like the web browser / javascript relationship. During the connection, the server sends all code that should be executed to the client, which runs it inside a locked down sandbox.

Unlike with web browsers, lua code should run in a separate thread.

Base execution setup

Every server mod can have a directory "client" whose content will be sent to the client upon connection. After all files have been recieved, the client executes an "init.lua" file for every of those mods.

To emphase the short-lived-ness of the code, the client shouldn't give any access to the filesystem. This implies that all lua files should be held in memory. There can be caches (even permanent ones, like with the texture cache), but lua code shouldn't be abled to "just access the filesystem", not even subdirectories.

Communication between server and client

Client lua and server lua should be abled to communicate with each other.

API compartments

SAO/CAO control

There should be ways to modify CAOs from client lua.

Formspec replacement

There is still a debate with what to replace formspecs.