AngelScript 2.27.1 is here (so soon? yes)

Started by
8 comments, last by WitchLord 10 years, 8 months ago

This release of AngelScript is quite small as I wanted to get started on the next big update. Still, this version has a few bug fixes, a reduced memory footprint (especially for applications with a lot of registered functions), a new 'void' expression that can be used to skip output parameters in function calls, and finally the support for anonymous parameters with default arguments.

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

I'm actually really excited to hear anything about a reduced memory footprint. AngelScript is already so small and optimized that it's amazing you can squeeze any more performance out for the features we get.

biggrin.png

There is still room for more improvements.

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

The void expression sounds interesting. Would that be something like this?


bool GetInventoryItem(string name, out Item@ item)
{
    // if item exists, pass it out and return true
    // else return false
}

// ...

if (GetInventoryItem("map", void))
{
    //  we have the map but don't care about using it at the moment
}

I can't find any mention of it in the documentation, although that's probably since it's such a new feature that you haven't updated it yet.

Yes, that's how the 'void' expression would be used.

It is documented in the manual, but I didn't make any individual entry for this special case. You can read about it here:

- Function calls

- Default arguments

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

Nice! I like it a lot. I'm stuck in C# for my current language so I've had to use Lua (ugh), but I'm looking forward to getting back to C++ and playing around with the features you've added since I've been gone.

Hi,

This release of AngelScript is quite small as I wanted to get started on the next big update. ...

what are the next big features / addons / updates that you will add?

I'm working on improving the initialization lists. Not only will they be more efficient, but they will also be more versatile, and should allow AngelScript to be viable option for those looking for a script language to do a lot of data configuration.

Currently the initialization lists are very limited as the compiler is only able to use them via the index operator. It will then invoke the index operator for each element provided in the initialization list. This works well for ordinary arrays, but when you want something a little more complex, like a dictionary or grid of data, then the current solution doesn't work well at all.

With the new solution that I'm working on, the application will be able to define the pattern that the initialization list for a type must follow. The compiler will do the validation of this pattern at compile time, and will then provide a single buffer with all the data to the object constructor/factory. The object constructor can then parse this buffer to initialize the entire object before leaving.

The way the application will register the desired pattern will be something like this:

RegisterObjectBehaviour("array<T>", asBEHAVE_LIST_FACTORY, "array<T> @f() = {T repeat}", ...);

RegisterObjectBehaviour("dictionary", asBEHAVE_LIST_FACTORY, "dictionary @f() = {{string ?} repeat", ...);

RegisterObjectBehaviour("grid<T>", asBEHAVE_LIST_FACTORY, "grid<T> @f() = {{T repeat(x)} repeat}", ...);

For the array, the list will then be a list of values of the type T, e.g. {1, 2, 3, 4}

For the dictionary the list will be an array of key-value pairs, e.g. {{"car", @Car}, {"health", 23}}

For the grid the list will be an array of arrays, where the compiler will guarantee that each row has the same amount of elements as the first one, e.g. {{0,1,2},{3,4,5},{6,7,8}}

I will take a while to have this implemented, and I may not be able to finish it all for version 2.28.0. For now I'm focusing on just implementing the way the buffer is initialized and then passed to the constructor. This may seem simple but I need to make sure the exception handler is capable of handling errors in the middle of the execution and also to have the offsets within the buffer adjusted properly when saving the bytecode to keep it platform independent.

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

Is there any chance that the same syntax could eventually be used to register variadic function definitions?

Maybe not the same syntax, but I definitely have plans to add support for variadic functions in the future.

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

This topic is closed to new replies.

Advertisement