🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

AngelScript 2.11.0 is here

Started by
13 comments, last by WitchLord 16 years, 6 months ago
I just downloaded and built the new libs and holy man theres been a lot of changes since September. I'm going to have to wait a bit until I get some time to rewrite a bunch of my code to work with the new version.

It looks like asOBJ_CLASS_CDA has been removed and theres a new way to create C++ classes in scripts that will require me to do some research.

Thanks for all the great work, i'm looking forward to seeing what the next version holds.




Adamhttp://www.allgamedevelopment.com
Advertisement
WitchLord,

Yes, our Vector/Matrix/etc classes are pretty special. They come from an outside library that we can't change. They also take advantage of the vector registers on the PS3, and so we can't pass them by value (or, worse, return them by value). However, we also do not have the ability to add AddRef/Release support to them and we don't want to wrap them in yet another class. And because they use vector registers they need 16 byte alignment.

So, based on how you explained things, we would be completely broken if we were to update our code.

In Summary, we need:
* Our own allocate/free - so we can control alignment
* Constructor/Destructor support (with args for constructor)
* Pass/Return by reference

A special sub-version of the new reference type may work out.

I'll implement it something like this:

engine->RegisterObjectType("vector", 0, asOBJ_REF | asOBJ_SCOPED);engine->RegisterObjectBehaviour("vector", asBEHAVE_FACTORY, "vector @f(float, float, float)", asFUNCTION(Vector_Factory), asCALL_CDECL);engine->RegisterObjectBehaviour("vector", asBEHAVE_RELEASE, "void f()", asFUNCTION(Vector_Release), asCALL_CDECL_OBJLAST);vector *Vector_Factory(float x, float y, float z){  return new vector(x,y,z);}void Vector_Release(vector *v){  if( v ) delete v;}


There will be a new flag asOBJ_SCOPED. This flag will tell AngelScript that this type should have at least one constructor, and the release behaviour, but no addref behaviour. This means that variables of this type will die as soon as the variable goes out of scope. Being a reference type it also means that the type cannot be passed by value to application functions that use native calling conventions.

Will that work?

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

That should work out just fine.
I've added the scoped reference type to the version in SVN. Would you mind giving it a try and see if it works out ok for you?

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