Jump to content
  • Advertisement
Sign in to follow this  
brightening-eyes

function registration is very very slow

This topic is 1663 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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

Edited by Andreas Jonsson

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!