Engine Scripting


Data Structures

class  nrEngine::IScript
 Script interface for any kind of script languages. More...
class  nrEngine::EmptyScript
 Empty script object that just do nothing(idle). More...
class  nrEngine::Script
 Simple script object based on engine's simple script language. More...
class  nrEngine::ScriptConnector
 Script connectors are listening on script engine events and react on them. More...
class  nrEngine::ScriptEngine
 Script engine is a glue code between the scripts and the engine. More...
class  nrEngine::ScriptLoader
 Script loader is used to create/load engine's script objects. More...

Defines

#define ScriptFunctionDef(name)   public: static nrEngine::ScriptResult name (const std::vector<std::string>&, const std::vector<nrEngine::ScriptParam>&)
 Declare a scripting function as static memeber of class (c++ only).
#define ScriptFunctionDec(name, class)   nrEngine::ScriptResult class::name (const std::vector<std::string>& args, const std::vector<nrEngine::ScriptParam>& param)
 Declare a scripting function out of the class class (c++ only).

Typedefs

typedef VarArg nrEngine::ScriptResult
 Each script function can return variable argument as a result.
typedef boost::any nrEngine::ScriptParam
 The real functions accept this default parameter.
typedef boost::function< ScriptResult(const std::vector< std::string > &,
const std::vector< ScriptParam > &)> 
nrEngine::ScriptFunctor
 We define each function that can be called from the scripts as this type.

Detailed Description

Scripting is our form of data driven design of our engine. Scripts are also resources that are loaded through specified loader. Scripts are used to program the engine from the outside of the source code. You are able to program the engine in the runtime by executing the scripts through a console provided by the engine. To understand what the scripts are good for use appropriate literature from the internet.

Our engine is designed to be very expandable and generic, so we are not use specific kind of script language. nrEngine does only provide an interface for a script classes that are implemented by plugins. The main idea of such an interface is to create a binding between the script language and the engine.

The plugins classes have to know how to bind the specific script language with the script interface of the engine. The console will acquire a script object to be used for the console scripting. This script object is provided by the plugins so it uses that language which is implemented in the plugin.

If there no plugins providing a scripting language so the default one is used. The default scripting language does not support anything except of some function calls. This very simple languge can be used to load another script language or to setup some properties of the engine.

Because there is thousands of scripting languages outside and they can be bounded on different ways we do not provide any bounding routine. If you using any scripting language in your application, than you have to bind your code with the script code by your self. Mostly this is done through metaprogramming or through preproccessing routines on the scripting language. Therefor providing such an interface through plugins for the engine seems not to be managable. Therefor all default functions used in our engine are registered by the script engine. By adding or deleting any script function there will be an event. Your glue-code has to catch this event to take care off registering or derigistering this function in your scripting language.

For example you want to use lua in your application. You use some 3rd party tools like tolua which does generate a c++ code form pkg files. This newly generated files can be used to provide your c++ classes in lua. Now to provide the engine's scripting functions, which are registered by the ScriptEngine you have to write a wrapper which will call ScriptEngine::call() method if appropriate function was called from lua.

Probalby in later version we can provide some binding to you (loadtime plugins), which does provide this functionality. But at now there is no other way to do this.


Generated on Wed Sep 12 23:19:43 2007 for nrEngine by  doxygen 1.5.1