function registration is very very slow

Started by
28 comments, last by brightening-eyes 10 years, 5 months ago

i'm trying to make a game engine using AngelScript when i registered some of my functions, and tryed to testit, it show's a console window and nothing happens for a while what i have to do? this is the engine's source code:

http://amir-ramezani.3owl.com/AGC.zip

what i've done incorrectly?

what is the problem?

these are some of my functions that i've registered

i want to work on Artificial intelligence, 3d renderring and many many functions

if it wants to be slow, it can't be successfull

i want to make it very fast

thanks in advance

when you can't see well like me, you can't test your applications and you can't read something

Github

Advertisement

I'll take a look at what might be causing the bad performance in your setup. It might be some optimizations are needed in the angelscript engine.

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 think that the problem is for wxWidgets i'll ask it on there forums, but please check AngelScript at last: i updated the source code but that problem and please note that i'm optimizing my application with -O3 thanks

when you can't see well like me, you can't test your applications and you can't read something

Github

You do know that -O3 doesn't guarantee more performance, don't you? In fact -O3 has a quite high probability of performing worse than -O2. At least that is what I've read on various forums, though I don't have personal experience with either.

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

yes, an error acurs: Expected identifier but it doesnt provide a function': system function no line, no colom, nothing els how can i know that what is the problem and fix it? thanks

when you can't see well like me, you can't test your applications and you can't read something

Github

Sounds like the error occurs in one of the calls to register the interface. You're probably passing an invalid declaration that the parser doesn't understand.

Look for the function that returns an error. You're checking the return values, aren't 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

no, i don't check the return values i updated the source now please help, i'm working on it for 5 hours in this day my eyes couldn't see after that

when you can't see well like me, you can't test your applications and you can't read something

Github

The recommendation is that you at least do an assert to verify that the return code is not negative after each call. That way when running the application in debug mode the debugger will immediately on the call that caused the error, thus making it easy to find problems.

For example, take a look at how the std::string is registered in the add-on:


r = engine->RegisterObjectType("string", sizeof(string), asOBJ_VALUE | asOBJ_APP_CLASS_CDAK); assert( r >= 0 );
r = engine->RegisterObjectBehaviour("string", asBEHAVE_CONSTRUCT,  "void f()",                    asFUNCTION(ConstructString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
r = engine->RegisterObjectBehaviour("string", asBEHAVE_CONSTRUCT,  "void f(const string &in)",    asFUNCTION(CopyConstructString), asCALL_CDECL_OBJLAST); assert( r >= 0 );
r = engine->RegisterObjectBehaviour("string", asBEHAVE_DESTRUCT,   "void f()",                    asFUNCTION(DestructString),  asCALL_CDECL_OBJLAST); assert( r >= 0 );
r = engine->RegisterObjectMethod("string", "string &opAssign(const string &in)", asMETHODPR(string, operator =, (const string&), string&), asCALL_THISCALL); assert( r >= 0 );
r = engine->RegisterObjectMethod("string", "string &opAddAssign(const string &in)", asFUNCTION(AddAssignStringToString), asCALL_CDECL_OBJLAST); assert( r >= 0 );

I see you have registered the message callback, but alone it will not be able to tell you which call caused the error. I've tried to make the engine provide as much information as possible about the cause, but without checking the return code for each call it can be very difficult to locate the error.

Once you find the call that gives the error, I'm pretty sure you'll soon figure out how to fix the problem. If not, please post more detailed information about the problem so we can provide more specific help.

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 downloaded your code and see that you already have asserts to check the return value. I guess you're not compiling the code in debug mode which is why the assert doesn't break on the call that returns error.

When compiling in release mode, the compiler removes the assert calls. Try switching to debug mode and run you application. I'm sure it will show you where the error is.

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 is fixed: now i have a question about the scripting language what is used instead of void* (C++) on angelscript? i think these problems is for that i'm using ? instead of void* thanks for your help

when you can't see well like me, you can't test your applications and you can't read something

Github

This topic is closed to new replies.

Advertisement