Advertisement

How to solve my problem?

Started by March 11, 2014 01:57 AM
1 comment, last by Kurage 10 years, 8 months ago

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.

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.

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

Advertisement

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.

This topic is closed to new replies.

Advertisement