• 13
• 27
• 9
• 9
• 20

# The future of AngelScript

This topic is 4133 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

No, no, I'm not announcing that I'll stop working on AngelScript. Don't worry. This is my favourite project, and I'll probably never stop working on it. Unless perhaps I start over from scratch with another script engine. ;) No, what I want is to show a bit of the future for AngelScript, i.e. the features that I have planned for it. Some of these may never be implemented, others may still change, but all of them are things that I'm thinking about. Let me know what you think about these. Feel free to suggest improvements, or even tell me about potential problems that make a certain feature invalid.
• The list at the AngelScript site. List updated Nov 21st, at 17:45 GMT -3. [Edited by - WitchLord on November 21, 2006 1:45:19 PM]

##### Share on other sites
that may be completely offtopic, but however:

what about BMFont? are you going to continue to work on it too?

not that there is something wrong, besides a small bug:
when i choose a font that has no characters on another page and then reselect a font that has characters on other pages, the list on the right does not reappear ;-)

also it would be nice if zero-amount kernings would not be exported and if the header included the number of exported characters. :-)

thanks a lot!

##### Share on other sites
My 2 pennies... RE-EDITED

Quote:
 - Context redesign -The context as it is now will be removed, and replaced by a new contextinterface and a thread interface.The context holds the environment in which threads are executed. Thus it willkeep track of global variables and memory allocations, shared between threads.A thread will only control the execution of a script, i.e. hold the call stackwhile it is running. Thus it will not be necessary to keep the call stack inmemory when it is not used.Unless, non-shared global variables are implemented, this redesign is prettyuseless as the contexts will not hold anything.

perfect, i was just trying to hack the engine to hold scripts in multiple threads,
but with shared memory and locking mechanizms... i think a script could be
spanned over a new thread when executed, while the main program is receiveing callbacks
of the execution status. obviously the engine could allow to execute co-scripts instead
of threads, depending on the needs. the context will manage locking and memory
accesses of shared/non-shared globals.

Quote:
 - Namespaces -With the addition of namespaces the scripts that previously had to be compiledin separate modules, can now be compiled in one module and still use the samenames. The benefit for this is the better reutilization of common functions.Modules will still exist, of course.

the namespace addition is something very useful for not dirtying the global
namespace with lots of similar names, especially when dealing with global objects and configuration variables.

Quote:
 - Shared/non-shared global variables -A global variable can be marked as shared between contexts, i.e. all contextsreferencing the same module will access the same memory for that variable.A non-shared global variable is local to the context, i.e. each context hasit's own instance of the variable.By default the global variables are shared.

this is good, even if i don't use it too much, but some other people could...

Quote:
 - Registerable context properties -A context property is a non-shared global variable registered from theapplication. After creating the context, the context property must also beset, otherwise a null pointer exception will occur.

this is a bit obscure, could you explain it a bit more ?

Quote:
 - Remove the bits types -I'll remove the bits type. The bitwise operators will instead work on theinteger types.The advantage is the better compatibility with C++'s types. Easier automaticmapping of integer types to angelscript types and vice versa.The drawback is the lack of direct manipulation of bits in double or floattypes. But if this is wanted the application can easily write functions toallow the bitwise conversion for these types.

ok 100% with you ! i've never used the bits type since i've registered a BitArray class that manages and check individual bits internally.

Quote:
 - Add the int64 and uint64 types -Although not used a lot I want to add these types as built-in types, alsofor better compatibility with C++'s types.

perfect! i was lacking these types when i've encountered some functions to publish in scripts that was playing with overall frames of a a played video streams...

Quote:
 - Improved any type -I'll possibly rename the any type to 'var', which I feel is a better name.I want this type work more like the variants of javascript or VBScript, i.e.you should be able to assign any type to it, and then perform operations on it.All the operators should work, and the meaning will depend on the contents ofthe any type.It may not work for method calls, as that requires compile time knowledge ofthe type. So for objects, the type will only work as a container, but forprimitives the type should work just fine. It will also work for stringconcatenations etc.

yes, even this could throw in a lot of strange behaviours when dealing with multiple operations based on the "internal type" of the any: i think a massive use of the "var" will lead to a general confusion. one of the things that impressed my attention in AS is the strong typing: when u write script you are sure that what u write is what u intend to do. if i want to use dynamic objects that will hold everything i'll choose something like javascript, with function objects and all threated in the same way: but this can make you loose the control over the script and make you write something that can compile but produces incorrect unpredictable results (i've experienced this in a lot of web applications over there)...

Quote:
 - Unified way to access script arguments -The SetArgDWord, SetArgObject, etc, functions will be replaced withGetArgPointer and GetArgTypeId(), likewise for return value. This willsimplify the library implementation, and also make it easier to implementautomatic argument assignments from outside the library, e.g. throughtemplates.

you mean SetArgPointer and SetVarTypeId or i'm wrong here ?

Quote:
 - Static arrays -Allow use of static arrays in the scripts, e.g. int ar[3]. These will bedirectly compatible with C++ arrays. They will not be objects, so it willnot be possible to store a handle for a static array, but they can be passedby reference to functions.

whau this is weird ! it opens up a lot of interesting use cases
and saves a lot of typing too !

Quote:
 - Variable argument type -I'm thinking about allowing the application to register functions that takevariable types as argument. It would look something like this: void func(?&).The function would then receive a reference to the value, as well as the typeid.This can be useful for implementing generic container classes.When overloading a function with this type, the variable type has the leastpriority.- Variable argument count -I want to be able to support the ... parameter declaration. I will notimplement it as loosely as C does it. Instead the function will receive theargument count, and be able to access both the value and the type of thevalue. This will make the use of the ... in scripts just as safe as any otherfunction.The script will have to add an extra keyword for parameters if the argumentis support to be a return value, something like: func( (out)arg );

splendid! one of the thing i lack a lot is the default argument value
for the functions. if i have something like this in c++:
void x (int a = 0, int b = 1, int c = 2, int d = 3);
i have to register 5 different functions all with
"void x ();"
"void x (int a);"
"void x (int a, int b);"
"void x (int a, int b, int c);"
"void x (int a, int b, int c, int d);"
could be avoided with only one call:
register ("void x (int a = 0, int b = 1, int c = 2, int d = 3)",...)
isn't it ?

Quote:
 - Data structures -The struct will come back to AngelScript. Now it will be used to allow thescripts to declare the exact memory layout of a structure. There will be nohidden members of a struct, and the packing can be controlled exactly. Thiswill make the struct compatible with C++ structs, and allow for easier datamanipulation in complex memory layouts, such as data files, etc.It will not be possible to store a handle to a struct, nor will the struct beable to inherit from another class or struct.

nice one. i was asking myself why the script structure desappeared
from time to time !

Quote:
 - AngelScript Manager -This is an addon for the script engine. Kind of a layer above the library.* It will make the engine easier to use.* It should implement the script loading with include management.* It should implement script execution with timeout and garbage collection.* It should implement concurrent script execution, and also co-routines.* It should also implement debugging features, such as variable enumeration, setting breakpoints, stepping through the code, etc.

i agree with you, even if this could be difficult to delineate in a good
interface. if you look into the angeljuice trunk, under
AngelJuice_ScriptablEngine i've bundled all that features already. give it an
eye, but forget to find a clean / polished interface (not yet!)

Quote:
 - Engine properties -It should be possible to dynamically set some engine properties, such asALLOW_UNSAFE_REFERENCES, ALLOW_POINTERS, etc. This will make the libraryequal for all, and make it easier to test these features as I can test allfeatures without having to recompile the library.

why not ? i think of a general engine modularity in which you can deliberately
make use or completely remove support for unsafe references, pointers, structs and classes, interfaces, try catch blocks, and even let the programmer change slightly the "core" syntax, letting him choose if he wants "begin" over "{", or taking case into account when dealing with the syntax (use "InT x" instead of "int x" for example), even change the name of the registered base types (i know something of this can already be done, but i'm thinking more wisely) or suppress some of them (blocking the use of the floats/double type for examples).

Quote:
 - Return of pointers -Implement pointer support again. Now with full support for access, type casts,etc.

THIS IS THE MOST IMPORTANT THING I'LL LIKE TO SEE IMPLEMENETED SOON !
(POINTERS ARE THE ONLY THING THAT MAKES ME STILL STICK TOGHETER WITH C++)

Quote:
 - A super class for all script classes -Maybe a super class for all script classes can be implemented.

interesting, but not so important. what kind of functions/properties it will hold ?

Quote:
 - Automatic translation of the string type to other C++ built-in types -In C++ it is very common to use at least two different representations ofcharacter strings, e.g. std::string and char*. I want to allow AngelScriptto automatically translate the registered string type to either of them sothat the application doesn't have to use wrapper functions.It will probably need a new behaviour on the string type, as well as a newindicator when registering the function that needs the translation.

yeah this is a must have... but i have a really kicking ass registered String class...

Quote:
 Suggestion by Manu Evans.- Getters and Setters for properties -This will allow the application to register a couple of functions tomanipulate properties.I need to investigate the complications of this. What happens for exampleif a property is passed by reference to a function?

i don't see the point of being too similar with VB side of the moon...
i better manipulate directly the properties, and if i need to do more things
when getting/setting, i'll register the getters and setters manually from C++, and only if i need to !

Quote:
 - Function pointers -Allow use of function pointers. I think I'll require a typedef to define thesignature of the function, which will simplify the code.

YEEEEEES ! this is even better than pointers to classes or variables... i think about having the possibility of passing a "void*" in the script and then explicit cast the function ...

Quote:
 - Registerable cast behaviours -It should be possible to register cast behaviours for types, so that bothimplicit and explicit casts between registered types can be performed.

Quote:
 - Registration of true constants and enums -It should be possible to register literal constants, and also enums.

good one, but i also see a lot of use with the "static" word... static
globals, static Class members, static Class functions: it will mimics much better when mapping a C++ object to its AS couterpart (i have a lot of static Class members registered as global function... and is a dirty situtation, especially when i look at the global namespace...)

Quote:
 - Implement try/catch statements in the scripts -The catch statement will allow the script to recover from an exception. Thetype of exception that was thrown can be accessed from the application, if itwishes to implement such a function.

nice one, i lack this a lot !

Quote:
 - Persistent script states -It would be great if it was possible to save/load the script state, includingthe context stack.

interesting

Quote:
 - Compile to native code JIT -This would definitely speed up the execution speed. I do not want to loosefunctionality though, such as the ability to set breakpoints, co-routines,etc.

i agree, even this could slow down implementation of new features. i think
this should be planned before starting to grow much implementing new features...
i think this should be and addon, not a complete replacement...

- Give a common definition to the bytecode, that should look the same on all
architectures (big-little endian, mac, ppc, intel, mips) so a bytecode i have
here, i can run it on any other implementation without worrying about its endianness -
- Pragmas to configure the engine (stack sizes for example) when script will be executed -
- Objects class inheritance as well as interface inheritance -
- Possibility to decouple method declaration from implementation (ala C++) -
- Possibility to not use this keyword inside the methods of an object -
- Some sort of introspection tools to be used directly from the script side to know the type of the objects at runtime -
- Bytecode optimizer: while browsing some time ago i've found another scripting engine out there that have an interesting feature, a bytecode optimizer... give it an eye, overall optimization could be even ~40% gain in execution speed ! (http://www.jewe.org/jewelscript/) anyway i don't mean to copy another project... -

i think i'll sleep this night and post some more nightmares tomorrow ;)
i'll keep this updated...

[Edited by - kunitoki on November 6, 2006 4:16:20 PM]

##### Share on other sites
ehmdjii: Yes, I'll continue to work on BMFont as well. In fact, I have a new version of it already. I'll release it in a couple of days after just a little more adjustments.

kunitoki: Excellent. This is the kind of feedback I wanted. I'll go through your comments and update my list at a later time, and also answer your comments individually.

##### Share on other sites
This is slightly off topic (as per feedback), but you have done an amazing job so far and I wanted to congratulate you on that. We have used AngelScript in the past for a school project and it turned out to be quite an adventure. Although today I tend to stick with a CLR profile (as a scripting language), AngelScript will always be one of the things I keep close at hand :-).

NOTE: for function pointers in general, my advise would be to check out the latest C++ standard draft. They have a recently adopted a proposal for a neat fresh syntax for both static and member function pointers.

##### Share on other sites
Thanks for the compliments. Is there a link to your project anywhere, that we can check out, and I can link to?

I'll check out the new standard draft. Thanks for the tip.

Regards,
Andreas

##### Share on other sites
see previous post... edited ;)

##### Share on other sites
Quote:
 Original post by kunitokiperfect, i was just trying to hack the engine to hold scripts in multiple threads,but with shared memory and locking mechanizms... i think a script could bespanned over a new thread when executed, while the main program is receiveing callbacksof the execution status. obviously the engine could allow to execute co-scripts insteadof threads, depending on the needs. the context will manage locking and memoryaccesses of shared/non-shared globals.

I do not intend to implement a multithreaded solution. At least not at this time. You can easily put the script engine and all script execution in a separate thread, but having one OS thread for each script thread is just asking for trouble.

Quote:
 yes, even this could throw in a lot of strange behaviours when dealing with multiple operations based on the "internal type" of the any: i think a massive use of the "var" will lead to a general confusion. one of the things that impressed my attention in AS is the strong typing: when u write script you are sure that what u write is what u intend to do. if i want to use dynamic objects that will hold everything i'll choose something like javascript, with function objects and all threated in the same way: but this can make you loose the control over the script and make you write something that can compile but produces incorrect unpredictable results (i've experienced this in a lot of web applications over there)...

Agreed. But it's up to the script writer to use whatever he wants. The main advantage of the any type is that you can write generic containers for them, for example hash tables to store any value you want by name.

Quote:
 you mean SetArgPointer and SetVarTypeId or i'm wrong here ?

No, I mean GetArgPointer and GetVarTypeId. See my update.

Quote:
 nice one. i was asking myself why the script structure desappearedfrom time to time !

The structure that I had was identical to the current script class. I want to keep the language as clean as possible, so I removed the struct, but now I'll add it again with a new flavour.

Quote:
 - AngelScript Manager -i agree with you, even if this could be difficult to delineate in a goodinterface. if you look into the angeljuice trunk, underAngelJuice_ScriptablEngine i've bundled all that features already. give it aneye, but forget to find a clean / polished interface (not yet!)

Agreed, the manager will not fit everyone, that's why I'll make it an add-on instead of part of the core library. It will also serve as a good example for others wanting to implement their own managers.

I'll take a look at the solution you implemented for AngelJuice.

Quote:
 why not ? i think of a general engine modularity in which you can deliberatelymake use or completely remove support for unsafe references, pointers, structs and classes, interfaces, try catch blocks, and even let the programmer change slightly the "core" syntax, letting him choose if he wants "begin" over "{", or taking case into account when dealing with the syntax (use "InT x" instead of "int x" for example), even change the name of the registered base types (i know something of this can already be done, but i'm thinking more wisely) or suppress some of them (blocking the use of the floats/double type for examples).

I hadn't thought that far, but of course, the concept can easily be extended to allow even further customization.

Quote:
 - Pragmas to configure the engine (stack sizes for example) when script will be executed

I'm not sure this fits with the design. But I'll keep it in mind for the future.

Quote:
 - Bytecode optimizer: while browsing some time ago i've found another scripting engine out there that have an interesting feature, a bytecode optimizer... give it an eye, overall optimization could be even ~40% gain in execution speed ! (http://www.jewe.org/jewelscript/) anyway i don't mean to copy another project... -

I already use bytecode optimization. :) And yes, it gives quite a lot of performance gain. There's still a lot that can be done in the optimizer though.

I'll take a look at the implementation for jewelscript to see if I can get some new ideas (though I don't think so).

---

Check my update to my original list. You'll find more answers to your suggestions/questions there.

Thanks for the feedback.

##### Share on other sites
Well. Just don't F it up. :P

##### Share on other sites
The only request that I have is that classes be handled like Java. Extend a class and implement an interface. For example:

class B extends A{}// orclass B implements C{}

This will make your life easier and provide a familiar syntax. It also will kinda look like UnrealScript. ;)