View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# AngelScript 1.10.0 FINAL (2004/11/02)

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

45 replies to this topic

### #1Andreas Jonsson  Moderators

Posted 02 November 2004 - 09:42 AM

This is the largest update ever made in one release, during the AngelScript history. A very shortened list of updates that were made is:
• Further optimized the VM with perhaps 1.5x average performance improvement
• Quite a few bug fixes
• A new boolean operator, xor, was added
• The library interface was improved, especially functions that returned strings
• ExecuteStep() now works as before (if the correct compile time flags are set)
• ExecuteString() has gotten a much needed overhaul. It's now possible to call it recursively, and also from multiple threads at the same time.
• The much awaited native support for arrays have finally been implemented. Now script writers can enjoy the full power of arrays in their functions. Application writers can easily register the exact array objects that they need for their functions, which makes the interaction very easy.
• Basic support for multithreading has been added, though it can be disabled at compile time for those who need the extra performance. Those are the most important points. You can read the complete list on the AngelScript site. Enjoy!
• AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Posted 03 November 2004 - 05:40 PM

Aaaargh! All these updates, and No time to implement!
Jayanth.KRaptor Entertainment Pvt. Ltd.http://www.raptorentertainment.com---------------------------------------------------------Why Mr. Anderson? Why? ...Why keep fighting? Do you think you're fighting for something - for more than your survival? Can you tell me what it is? Do you even know? Is it freedom, or truth, perhaps peace, could it be for love? Illusions Mr. Anderson, vagaries of perception. Temporary constructs of a feeble human intellect trying desperately to justify an existence without meaning or purpose.

### #3Andreas Jonsson  Moderators

Posted 04 November 2004 - 01:27 AM

No worries [wink]

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

### #4lxnyce  Members

Posted 04 November 2004 - 04:21 AM

I finally got some time to mess with AngelScript again, and it seems that the threading is causing crashes all over. None of the tests ran for me, they all crashed at ENTERCRITICALSECTION(criticalSection);

The crashes went away when I declared NO_THREADS in the project. I believe multi-threading is still not working fully yet, but they are on by default in MSVC project found in angelscript\projects\msvc6. Also the "compiling and linking with the library" link at the top of http://www.angelcode.com/angelscript/ is broken.

Not griping here, I LOVE angelscript. Just pointing out the problems I ran into just loading it up after a long break.

Forgot to mention I am using MSVC 7 with MSVC 6 libraries if that had anything to do with it.

[Edited by - lxnyce on November 4, 2004 10:21:25 AM]

### #5Andreas Jonsson  Moderators

Posted 04 November 2004 - 04:58 AM

The problem is most likely because you're using MSVC7. The library works just fine in all my tests with multithreading turned on.

Still I will set the NO_THREADS flag as on by default, since multithreading is not yet stable.

Thanks for pointing out the broken link as well.

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

### #6caesar4  Members

Posted 04 November 2004 - 01:39 PM

andreas
take a look at http://softwire.sourceforge.net, it might help with the performance issues uve havin

### #7Aggrav8d  Members

Posted 04 November 2004 - 06:50 PM

1. Congratulations! What's next on the agenda? :)

2. So, just to be clear:

int a[5](6);

would be the proper syntax in C++ to create an array of five floats initialized to the value 6. What is the syntax in angelscript?

3. I'm glad that you added the output message to Build(), but now I get an "Invalid Configuration" and an asINVALID_CONFIGURATION with no idea as to *why* it is invalid.

Dan Royer, OwnerMarginally Clever Games

### #8Andreas Jonsson  Moderators

Posted 05 November 2004 - 02:30 AM

ceasar4:

I'm aware of SoftWire, but AngelScript hasn't come so far as to compile directly to native code yet. Once it does I will most likely use SoftWire though.

Thanks anyway.

Aggrav8d:

1. Thanks. What's next is AS2, with the slightly changed syntax. AS1 will also be improved with a few things, like initialization lists, -> operator overload, better compile speed, etc.

2. AS still don't support automatic initialization of arrays, so in this case you'll have to write a loop to initialize each of the elements.

int[] a(5);
for( int n = 0; n < 5; n++ ) a[n] = 6;

3. AS doesn't store the function call that failed during configuration. You'll have to verify each of the return codes. I recommend doing it like this:

r = engine->RegisterObjectType(...); assert( r >= 0 );
r = engine->RegisterObjectMethod(...); assert( r >= 0 );
r = engine->RegisterObjectMethod(...); assert( r >= 0 );
r = engine->RegisterGlobalFunction(...); assert( r >= 0 );

This doesn't polute the code with lots of if statements, and it will let you easily find the problem in debug mode. In release mode the return codes aren't verified but they won't fail if they don't fail in debug mode (unless I made a mistake somewhere).
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

### #9Aggrav8d  Members

Posted 05 November 2004 - 06:44 AM

I manage to hit the assert(false) at the end of Dereference() without getting any kind of error message or code. What should I be looking for?

Digging a little further I see that it is trying to do a conversion but the type->dataType.GetSizeInMemoryDWords() is equal to 16 (!!)

[Edited by - Aggrav8d on November 5, 2004 1:44:23 PM]

Dan Royer, OwnerMarginally Clever Games

### #10Andreas Jonsson  Moderators

Posted 05 November 2004 - 07:53 AM

You have probably stumbled upon a bug. I'm guessing it is related to registered types and the way asCDataType changed for 1.10.0. Is it possible for you to give me a sample code that reproduces the assert failure?

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

### #11Aggrav8d  Members

Posted 05 November 2004 - 08:24 AM

Hmm...I can't really chop my code up to provide a simple example, but I can describe the situation. I have an array of pointers to a class with properties and methods. In a loop i call a method that returns new instances

MyClass *[] c(5);
int i;
for(i=0;i<5;++i) {
c[i]=RegisteredAllocatorForMyClass();
c[i]->RegisteredDoStuff(45.0f,1.0f);
}

And I get two problems:
the first, execution dies inside the for loop (but where, i'm not sure yet)
the second, if I change to MyClass [] and get rid of the allocation then I get No matching signatures to 'RegisteredDoStuff(const float, const float)'. I registered as non-const. If I change the registartion and internal methods to const I still get the error.

Also note that if I allocate like this

MyClass *ptr=RegisteredAllocatorForMyClass();

It does allocate (but I still get the No Matching signatures problem). That's all I've been able to figure out so far.

Dan Royer, OwnerMarginally Clever Games

### #12Andreas Jonsson  Moderators

Posted 05 November 2004 - 08:36 AM

Ok, that information might be enough for me to find the problem. I'll give it a try and let you know.

But before that I'd like to know if you noticed the post by Licu about the pointer related bug in AS 1.10? If you didn't then this may actually be what is causing your problems.

You'll find the bug fix for the -> operator in that thread.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

### #13Aggrav8d  Members

Posted 05 November 2004 - 08:51 AM

I added the fix for the -> operator and now I get an assert about
instr->StackSize == StackSize

Dan Royer, OwnerMarginally Clever Games

### #14Andreas Jonsson  Moderators

Posted 05 November 2004 - 09:25 AM

There seems to be a problem with arrays of pointers. I've written a test case using your example and it gives errors it shouldn't.

I'm looking into this right now, but I might not be able to fix it until Sunday.

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

### #15Aggrav8d  Members

Posted 05 November 2004 - 09:33 AM

Well that throws my schedule off a couple of days, but I'll find things to work on in the meantime. I wish you godspeed with whatever you're doing :)

Dan Royer, OwnerMarginally Clever Games

### #16Andreas Jonsson  Moderators

Posted 05 November 2004 - 10:19 AM

The problem I had found was related to me using integer to index the arrays. Once I change the type of n to uint it worked fine. (NOTE: I will improve the implicit casting rules for the next version)


void Test()
{
class1*[] c(5);
uint i;
for( i = 0; i < 5; ++i )
{
c[i] = class1Factory();
c[i]->function();
}
}


This compiles and executes without problem (except that the compiler reports c as uninitialized, which is a bug but not a critical one).

The assert(instr->StackSize == StackSize) is probably related to the first problem you mentioned. It seems the compiler is trying to dereference a registered object even though it shouldn't.

This might be related to how you have registered your type. Can you show me how you registered the type in question? The one that was being dereferenced?
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

### #17Aggrav8d  Members

Posted 05 November 2004 - 11:42 AM

I meant to type uint. Sorry.

  asEngine->RegisterObjectType("ObjectInstance", sizeof(ObjectInstance), asOBJ_CLASS);  asEngine->RegisterGlobalFunction("ObjectInstance *CreateObjectInstance(ObjectType *type)",asFUNCTION(::CreateObjectInstance),asCALL_CDECL);  asEngine->RegisterGlobalFunction("void ReleaseObjectInstance(ObjectInstance *)",asFUNCTION(::ReleaseObjectInstance),asCALL_CDECL);  asEngine->RegisterObjectMethod("ObjectInstance","GfxTexture *GetTexture()",asMETHOD(ObjectInstance, GetTexture), asCALL_THISCALL);  asEngine->RegisterObjectMethod("ObjectInstance","void SetTexture(GfxTexture *)",asMETHOD(ObjectInstance, SetTexture), asCALL_THISCALL);  asEngine->RegisterObjectMethod("ObjectInstance","GfxMesh *GetMesh()",asMETHOD(ObjectInstance, GetMesh), asCALL_THISCALL);  asEngine->RegisterObjectMethod("ObjectInstance","void SetMesh(GfxMesh *)",asMETHOD(ObjectInstance, SetMesh), asCALL_THISCALL);  asEngine->RegisterObjectMethod("ObjectInstance","bool ComesBefore(ObjectInstance *)",asMETHOD(ObjectInstance, ComesBefore), asCALL_THISCALL);  asEngine->RegisterObjectMethod("ObjectInstance","ObjectType *GetType()",asMETHOD(ObjectInstance, GetType), asCALL_THISCALL);  asEngine->RegisterObjectMethod("ObjectInstance","void SetPosition(float,float)",asMETHOD(ObjectInstance, SetPosition), asCALL_THISCALL);  asEngine->RegisterObjectMethod("ObjectInstance","void GetPosition(float&,float&)",asMETHOD(ObjectInstance, GetPosition), asCALL_THISCALL);  asEngine->RegisterObjectMethod("ObjectInstance","void SetVelocity(float,float)",asMETHOD(ObjectInstance, SetVelocity), asCALL_THISCALL);  asEngine->RegisterObjectMethod("ObjectInstance","void SetAngle(float)",asMETHOD(ObjectInstance, SetAngle), asCALL_THISCALL);  asEngine->RegisterObjectMethod("ObjectInstance","void SetAngularVelocity(float)",asMETHOD(ObjectInstance, SetAngularVelocity), asCALL_THISCALL);  asEngine->RegisterObjectMethod("ObjectInstance","void AssignPhysics(ObjectPhysicsDescription &opd)",asMETHOD(ObjectInstance, AssignPhysics),asCALL_THISCALL);  asEngine->RegisterObjectMethod("ObjectInstance","void SetName(string &)",asMETHOD(ObjectInstance, SetName), asCALL_THISCALL);  asEngine->RegisterObjectMethod("ObjectInstance","void SetStack(int pos,float v)",asMETHOD(ObjectInstance, SetStack), asCALL_THISCALL);  asEngine->RegisterObjectMethod("ObjectInstance","float GetStack(int pos)",asMETHOD(ObjectInstance, GetStack), asCALL_THISCALL);  asEngine->RegisterObjectMethod("ObjectInstance","void SetImmaterial(bool state)",asMETHOD(ObjectInstance, SetImmaterial), asCALL_THISCALL);  asEngine->RegisterObjectMethod("ObjectInstance","bool GetImmaterial()",asMETHOD(ObjectInstance, GetImmaterial), asCALL_THISCALL);

Dan Royer, OwnerMarginally Clever Games

### #18Andreas Jonsson  Moderators

Posted 06 November 2004 - 05:21 AM

Hmm, I can't see anything wrong with the way you registered the object.

I think I'll need to know what script function it is that is causing the assert failure. Would it be possible for you to find this? Simply comment out the script functions one by one until you find the one that fails compiling.

In the meanwhile I will look through the library code for possible causes.

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

### #19Aggrav8d  Members

Posted 06 November 2004 - 07:30 AM

ObjectInstance *[] instanceArray(5);
uint i=0;
instanceArray[i]=ObtainObjectInstance(type);
is causing the problem.

Dan Royer, OwnerMarginally Clever Games

### #20Andreas Jonsson  Moderators

Posted 06 November 2004 - 08:07 AM

Unfortunately I don't seem to be able to reproduce the problem. Everything seems to work fine for me.

I will continue to search but without being able to reproduce the problem myself it is highly unlikely I'll find 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

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.