Advertisement

AngelScript 2.18.0 is here

Started by December 16, 2009 05:44 PM
9 comments, last by Wavesonics 15 years, 2 months ago
This new release took a while to get out because there were a lot of structural changes to make internally in order to prepare the library for the upcoming features. Script entities are now less tightly tied to each other so that they can more easily be modified dynamically without having to recompile the full module. This required adding them to the garbage collector to resolve circular references, so don't get surprised by the increase of objects in the GC statistics. The immediate benefit of these changes is the ability to dynamically add new functions and variables to an already existing script module, and also to remove them. I've implemented this support in the console sample so you can easily see how that works. Another side effect is that now the functionality that the ExecuteString method provided can now just as easily be implemented by the application, so I decided to deprecate that one. Don't worry, I've added a new helper function in the add-on that implements it for you if you relied on it. However, you do well looking into that one, as you may see ways to make this function even better suited for your needs, e.g. by adding parameters and return values to it. Some other improvements have also been contributed by the community: Fredrik Ehnbom took the time out of his busy schedule to implement full support for native calling conventions on the iPhone platform. Jubok Kim sent me some changes that adds official support for UTF-16 encoded string literals. If you prefer that over UTF-8 encoded strings, then you can turn that on by setting the engine property asEP_STRING_ENCODING to 1. Jeremy Harmon improved the compiler messages when no matching function was found. I also took some time to make some optimizations, especially to the function calling in the asIScriptContext, so hopefully you should see a noticeable performance gain if you have a lot of calls to script functions. I have some more ideas for optimizations that I hope to try out for 2.18.1 so if all goes as planned you should soon see another gain. For 2.18.1 I plan on implementing support for initialization lists to registered types by adding a special behaviour. This is the final piece to be able to fully move the built-in array type out of the core library, so the applications will have even better control over how the arrays work. I also plan on adding support global property accessors which have been asked for. Another major feature that I would like to implement for 2.18.1, is the addition of function pointers to the script language, so that things like callbacks and even function closures can be used. This is a big feature, so I may not be able to fit it into the 2.18.1 release, but I should at least be able to get started on it. At last, I would like to mention that Arroy One have provided a Russian translation of the AngelScript manual, so if that's your native language you can head on over to 13D Labs for that. Hopefully Arroy will be able to keep the manual up to date with new releases of the library. If anyone else have written translations, I invite you to add a link to them on the AngelScript wiki. 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

In version 2.17:

string dd="a汉字b";
cout<<dd;

it prints:a汉字b

But after update to 2.18.0 ,there are some new warning:
Waring : Invalid unicode sequence in source
and it prints:a b


Advertisement
Is your source code encoded in UTF-8 or normal 8-bit OEM? If you're using 8-bit OEM then set the engine property asEP_SCRIPT_SCANNER to 0. This should allow you to continue as before.

Let me know if the problem continues after that, and I'll look into it.

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

I had problem compiling it under gcc -


[ 7%] Building CXX object src/builds/angelscript/CMakeFiles/angelscript.dir/home/samuel/working/angelscript/angelscript/source/as_scriptengine.cpp.o
/home/samuel/working/angelscript/angelscript/source/as_scriptengine.cpp: In member function ‘int asCScriptEngine::RegisterMethodToObjectType(asCObjectType*, const char*, const asSFuncPtr&, asDWORD)’:
/home/samuel/working/angelscript/angelscript/source/as_scriptengine.cpp:1982: error: no matching function for call to ‘asCBuilder::CheckNameConflictMember(asCDataType, char*, int, int)’
/home/samuel/working/angelscript/angelscript/source/as_builder.h:117: note: candidates are: int asCBuilder::CheckNameConflictMember(asCDataType&, const char*, asCScriptNode*, asCScriptCode*)
make[2]: *** [src/builds/angelscript/CMakeFiles/angelscript.dir/home/samuel/working/angelscript/angelscript/source/as_scriptengine.cpp.o] Error 1

I replace the line (.../source/as_scriptengine.cpp:1982) with:

asCDataType x = asCDataType::CreateObject(objectType, false);
r = bld.CheckNameConflictMember(x, func->name.AddressOf(), 0, 0);

I think that gcc treats a temporary object as a pointer?
Samuel E. Henley OSRail.net

I love watching this language evolve :)

Even though I'm not actively developing my game at the moment, I keep updating it to the latest AS version so it will be ready if/when I return to it, so keep up the good work!
==============================
A Developers Blog | Dark Rock Studios - My Site
Quote:
Original post by SEHenley
asCDataType x = asCDataType::CreateObject(objectType, false);
r = bld.CheckNameConflictMember(x, func->name.AddressOf(), 0, 0);

I think that gcc treats a temporary object as a pointer?



Thanks, I'll have this updated as soon as possible.

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
In samples\tutorial\bin\script.as line 4 I write:

Print("recieve汉字: " + a + ", " + b + "\n");

save file as simplify chinese (2312) codepage 936:
prints:recieve潞潞脳脰: 3.14159, 2.71828

save file as Unicode (UTF-8 signature) codepage 65001:
prints:recieve姹夊瓧: 3.14159, 2.71828

save file as Unicode (UTF-8 no signature) codepage 65001:
prints:recieve姹夊瓧: 3.14159, 2.71828
This happens because Windows doesn't natively handle UTF-8 encoded strings. It's not a bug, the string really is correct. It's just when printing it with cout Windows attempts to interpret the string as Multibyte encoded, rather than UTF-8.

If you were doing this on Linux I think you would get the correct result, as I'm told Linux handles UTF-8 encoded strings natively.

If you wish to use the standard IO routines on Windows with Unicode you should be using UTF-16. You can change AngelScript to encode the string literals in UTF-16 with engine->SetEngineProperty(asEP_STRING_ENCODING, 1); But you also need to change the string type you register to use wstring instead of just string. Then you need to change the cout to wcout as well.

Another option would be to write a routine for converting the UTF-8 encoded string to UTF-16, then print that with wcout.

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

I'm upgrading to 2.18.0 and I'm getting some linking errors with:
asCGlobalProperty

Undefined references to a whole host of methods in there, any ideas?

Using GCC 4.4.0 (Win32)

[Edited by - Wavesonics on December 22, 2009 2:47:38 PM]
==============================
A Developers Blog | Dark Rock Studios - My Site
Make sure your makefile includes the as_globalproperty.cpp file. This file is new for version 1.18.0.

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

This topic is closed to new replies.

Advertisement