Choosing a Scripting Language #4

Closed
opened 2024-08-27 11:04:40 +02:00 by faraphel · 1 comment
Owner

Core Script Language

The core of the Atlas Launcher will rely on a script language that will allow the modder to describe how the games files shall be modified.

This script language shall be :

  • (required) simple definition of new class, functions and variables to allow for our new comportments

  • (required) sand-boxed, to prevent potentially unsafe instruction from affecting the host machine

  • (recommended) well documented so that new users can easily start discovering it

  • (recommended) low level since modifications for theses type of games require precise control on the data

  • (recommended) a clear and explicit syntax to avoid potential implicit comportment that could make debugging hard

  • (recommended) can support important programming concept such as class, import, and potentially allow for our own extensions

  • (recommended) support debugging instructions to simplify the debugging process of the modder

  • (recommended) allow navigations across the functions and variables currently declared in its engine for autocompletion

# Core Script Language The core of the Atlas Launcher will rely on a script language that will allow the modder to describe how the games files shall be modified. This script language shall be : - (required) simple definition of new class, functions and variables to allow for our new comportments - (required) sand-boxed, to prevent potentially unsafe instruction from affecting the host machine - (recommended) well documented so that new users can easily start discovering it - (recommended) low level since modifications for theses type of games require precise control on the data - (recommended) a clear and explicit syntax to avoid potential implicit comportment that could make debugging hard - (recommended) can support important programming concept such as class, import, and potentially allow for our own extensions - (recommended) support debugging instructions to simplify the debugging process of the modder - (recommended) allow navigations across the functions and variables currently declared in its engine for autocompletion
faraphel added the
enhancement
label 2024-08-27 11:04:40 +02:00
faraphel self-assigned this 2024-08-27 11:04:40 +02:00
faraphel added this to the Atlas-Launcher project 2024-08-27 11:04:40 +02:00
Author
Owner

Python

Python is a high-level programming language.

The base project was written in Python, but sand-boxing Python is incredibly hard because of all the features and syntaxes in the language : even by restricting almost all possibles instructions, stripping all the standard functions, or even preventing the instantiation of some object, it will still be possible to access objects such as the importer to import them back and run malicious code.

Some project tried to sandbox Python such as Restricted Python or PyPy, but they either cannot guarantee full sandboxing or strip too much of the base programming language to even be usable.

For theses security reasons, Python cannot be used as the script language of this project.

JavaScript

JavaScript is a very common scripting language often used to create web page.
The language is very high-level, semi object-oriented and present an absurd amount of implicit syntax making the language prone to hard to find bugs.

JavaScript can be implemented thanks to either the v8, SpiderMonkey or Qt Engine. Tests have been realized with Qt QML, but some importants features were pretty hard to register and implement. This engine does not guarantee any sandboxing, leading to potential security risks. The two others engine are pretty hard to setup, embed, and sandbox to fit our need.

Because of all the difficulties that might be encountered later by using JavaScript, it was decided to not use it for this project.

Lua

Lua is a very simple script language, 1-indexed array, high level.

Lua is a common language that can be easily sand-boxed, implemented and compiled. JIT compiler even exists that might allow for big performances.

The base language might not provide many functionalities by default, requiring the modder to reimplement common functions manually, which might be annoying. The high-levelness of the language might also cause trouble when manipulating data.

While this language check all our required points, it misses many of our optional ones. We will keep this language only if no other better alternatives can be found.

AngelScript

AngelScript is a low-level language that try to be close to the C++ syntax. It is primarly used as a scripting language for games.

This language allow for sand-boxing, while being totally customizable. The base version does not even provide a string type, but it can be registered thanks to standard add-on. Thanks to that, it is possible to registers most of the language features while excluding the features that might be dangerous such as the filesystem of the system commands.

Class, functions and variables can be very easily registered and don't even require some specials conversions.

It is pretty well documented and since it is close to C++, most people could already write code with AngelScript. Only small difference such as the classic C++ pointer (*) becoming an AngelScript difference (@) and the automatic garbage collector are visible.

Features such as an integrated debugger with breakpoints or access to the current declared functions or variables will make way more easier the programmation of the GUI and the work of the modder on his project.

AngelScript ticks all the boxes that we need for this project, so we are going to base it on this language.

# Python [Python](https://www.python.org/) is a high-level programming language. The base project was written in Python, but sand-boxing Python is incredibly hard because of all the features and syntaxes in the language : even by restricting almost all possibles instructions, stripping all the standard functions, or even preventing the instantiation of some object, it will still be possible to access objects such as the importer to import them back and run malicious code. Some project tried to sandbox Python such as [Restricted Python](https://pypi.org/project/RestrictedPython/) or [PyPy](https://pypy.org/), but they either cannot guarantee full sandboxing or strip too much of the base programming language to even be usable. For theses security reasons, Python cannot be used as the script language of this project. # JavaScript [JavaScript](https://developer.mozilla.org/fr/docs/Web/JavaScript) is a very common scripting language often used to create web page. The language is very high-level, semi object-oriented and present an absurd amount of implicit syntax making the language prone to hard to find bugs. JavaScript can be implemented thanks to either the v8, SpiderMonkey or Qt Engine. Tests have been realized with Qt QML, but some importants features were pretty hard to register and implement. This engine does not guarantee any sandboxing, leading to potential security risks. The two others engine are pretty hard to setup, embed, and sandbox to fit our need. Because of all the difficulties that might be encountered later by using JavaScript, it was decided to not use it for this project. # Lua [Lua](https://www.lua.org/) is a very simple script language, 1-indexed array, high level. Lua is a common language that can be easily sand-boxed, implemented and compiled. JIT compiler even exists that might allow for big performances. The base language might not provide many functionalities by default, requiring the modder to reimplement common functions manually, which might be annoying. The high-levelness of the language might also cause trouble when manipulating data. While this language check all our required points, it misses many of our optional ones. We will keep this language only if no other better alternatives can be found. # AngelScript [AngelScript](https://www.angelcode.com/angelscript/) is a low-level language that try to be close to the C++ syntax. It is primarly used as a scripting language for games. This language allow for sand-boxing, while being totally customizable. The base version does not even provide a string type, but it can be registered thanks to standard add-on. Thanks to that, it is possible to registers most of the language features while excluding the features that might be dangerous such as the filesystem of the system commands. Class, functions and variables can be very easily registered and don't even require some specials conversions. It is pretty well documented and since it is close to C++, most people could already write code with AngelScript. Only small difference such as the classic C++ pointer (*) becoming an AngelScript difference (@) and the automatic garbage collector are visible. Features such as an integrated debugger with breakpoints or access to the current declared functions or variables will make way more easier the programmation of the GUI and the work of the modder on his project. AngelScript ticks all the boxes that we need for this project, so we are going to base it on this language.
faraphel reopened this issue 2024-08-27 11:34:19 +02:00
faraphel added a new dependency 2024-08-27 11:34:32 +02:00
faraphel changed title from Implement the Core Engine to Choosing a Scripting Language 2024-08-27 11:35:04 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Blocks
#2 Implement the Core}
Atlas/Atlas-Launcher
Reference: Atlas/Atlas-Launcher#4
No description provided.