I've been looking into implementing a scripting language into
fs2_open, which is the engine of the game Freespace 2 (now open-source.)
FS2 uses table files like this:
#Section
$Name: Object name
$Variable 1: 10
$Variable 2: moo
;;etc etc...
#End
Now, what I'd like to do is make it possible to use a scripting language, using one of those variables. EG with Python:
#Section
$Name: Object name
$Variable 1: cmath.cos(35)
$Trigger: {
if conditional:
do_something()
}
#End
The preference of the modding community, however, is Lua. Which is where I run into a problem; Lua doesn't seem to let you precompile code chunks on runtime. Since some of the code chunks may be executed per frame, obviously I don't want it to be parsing the file or some text buffer in memory.
In addition, I understand that Python has large memory requirements. So, wish list here for a scripting language (in no particular order):
- Precompile code chunks
- Allow for object-oriented programming
- Small and fast
-
EASY TO LEARN for non-coders
- Lets you use named arrays, eg Array['element']
- Lets you extend variables, functions, classes from C/++
- Is cross-platform (fs2_open runs on Win32, OSX, Linux, and Linux64)
- JIT compile to machine code, as long as it doesn't interfere with cross-platformability
Thanks. :)