Advertisement Jump to content
Sign in to follow this  
Kurage

How to solve my problem?

This topic is 1775 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

Hi, there.
I will write base system in C++ and main system in AngelScript.
The base system will provide the main system interfaces needing for game development(like a game engine).
I looked over the source codes under the samples directory however I didn't get what should I do.
My purposes are to interact with each other and not to take time for native function calls written in C++ if possible.
I think that the event exsample seems the nearest code what I want to do.
I will carry out them to do the following:

// A script has been loaded and built.
// My application uses only one module and context.
asIScriptModule *mod = engine->GetModule("MyModule");
// Find the callback functions.
asIScriptFunction *onWait = mod->GetFunctionByDecl("void onWait()");
asIScriptFunction *onRender = mod->GetFunctionByDecl("void onRender()");
// etc...

asIScriptContext *ctx = engine->GetContext();
while(bGameExit == false)
{
    // Event driven
    switch(state)
    {
    case STATE_ON_WAIT:
        ctx->Prepare(onWait);
        ctx->Execute();
        break;
    case STATE_ON_RENDER:
        ctx->Prepare(onRender);
        ctx->Execute();
        break;
    // etc...
    }
}

I may think there are some better methods because my code calls the script functions frequently.
Do you think what are better ways to do them or how to do in your project?
Give me your opinionsmile.png

BTW, is there a game engine that is driven by AngelScript?
If it exists, I'll look into it.
 

Share this post


Link to post
Share on other sites
Advertisement

How you use AngelScript will vary greatly based on what you wish to accomplish. If you wish to control everything from the script then the way you imagined it should work just fine.

 

There are several games and engines that use AngelScript. You can see the ones I know about on the user's list. I believe the Echelon engine and the Urho3D engine are open source.

 

There is also my own prototype engine that I use to test out my own ideas. Don't expect production quality code if you decide to take a look at it, but it should allow you to get an idea of how I integrate AngelScript.

Share this post


Link to post
Share on other sites

Thank you for giving me your opinion.

The games and engine that use AngelScript, and also your under construction project stimulate me and show me how to integrate with.

I will try to use the way that I imagined.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!