AngelScript 2.28.2 is out

Started by
8 comments, last by gjl 10 years ago

My primary goal with this version was to implement the grid add-on, which basically a 2D array with rectangular dimension. Multi-dimensional were already supported in the script language as arrays-of-arrays, but this would often become cumbersome to work with when a rectangular area was wanted as each subarray had to be resized individually. Accessing elements in arrays-of-arrays is also not particularly efficient as there is a lot of overhead.

In order to properly support the grid add-on (and any other multi-dimensional array implementation that developers imagine) the library was enhanced to allow multiple arguments in the opIndex overload, and the list pattern declaration gained a new keyword 'repeat_same' to tell the compiler that all sub-lists should be of the same size.

The grid add-on itself is currently quite basic with very little functionality besides setting up a 2D area and allowing the script to access the elements, but it serves it's main purpose of showing developers how multi-dimensional arrays can be implemented. Ideas for how to make it a truly useful add-on are most welcome.

Other enhancements in this version that are worth mentioning include; added support for opCall operator to allow the implementation of functor objects in scripts, implemented support for anonymous objects initialized with lists, improved compiler rules for implicit casts in expressions, reduced size of saved bytecode, more efficient bytecode sequences.

Some other add-ons have also received improvements. The array add-on now supports custom memory routines (a side effect of this, is that when instantiated from C++ it is now necessary to use factory functions instead of allocating with new). The dictionary add-on has received enhancements to improve interaction from the C++ side with a method to retrieve the type id of a stored value, and an iterator with support for C++11 range-for loops. The math add-on also has a new function closeTo() that should be used to compare floats or doubles when one wants to do approximate comparisons to handle numerical impression in float and double calculations.

Regards,

Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Advertisement

Anonymous objects? Is that anything like in C#?

var obj = {
    str = "a string",
   num = 100
};

It's something like this:

void main()
{
  doSomethingWithArray( array<int> = {1,2,3,4,5,6} );
  doSomethingWithDictionary( dictionary = {{'apple', 1}, {'banana', 2}, {'orange', 3}} );
}

It's no longer necessary to first declare and initialize a variable, in order to use it in an expression.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Ah, very nice!

Great! Thanks for the opCall addition. Haven't had time to check it out yet (still running my patched 2.28!)

By the way, is there any change in the bytecode that would require a new version of the JIT that worked with 2.28.0?

There shouldn't be any changes in this version that break the compatibility with the JIT compiler from BlindMind studios. Though, I can't make any guarantees on that as I don't use the JIT compiler myself.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Thanks. The fact that there are new bytecode instructions in 2.28.1 does not impact existing JIT compilers? (I am not sure how JITs and angelscript handle this)

Our JIT falls back to Angelscript execution if it doesn't know a specific bytecode, so it will keep working as long as no existing bytecodes were changed. This can cause a performance hit.

ok, that's really cool, and well designed! Thanks :-)

This topic is closed to new replies.

Advertisement