This scripting language was developed with the aim of developing a character's action using actor model. You can implement the execution engine easily into your computer game program.
actor Mother
{
int mFlag;
action initialize
{
mFlag = 0;
}
action main
{
print("Hi");
request(1, Child->talk);
}
}
actor Child
{
action update
{
int i;
}
action talk
{
print("Hi");
}
}
Use namespace blocks to group actors, and using to import namespace paths or actor symbols. Action references use ->, while :: is reserved for namespace qualification.
namespace Game::AI
{
actor Enemy
{
action think
{
}
}
}
using Game::AI;
actor Controller
{
action main
{
request(1, Enemy->think);
}
}
- cd to <download_path>\compiler
- make
- Install Cygwin from: http://www.cygwin.com/
- cd to <download_path>\compiler
- make
- Set the path to bison in the environment variable GNU_BISON_BIN, and the path to flex in GNU_FLEX_BIN.
- Install Microsoft Visual C++ 2022 Community (should work with other versions).
- Run "Vistual Studio 2022 Command Prompt" from the "Visual Studio 2022" start menu.
- Open mana.sln
mana sample/sample.mnWhen you specify the source file at runtime, it will compile and execute it.
mana source_fileIf you specify the -o option, it will output the compiled binary file.
mana source_file -o binary_fileIf you specify the --execute option, it will execute the binary file.
mana --execute binary_file
mana -e binary_file- Copy the
runnerdirectory to your preferred location in your project. - Add
#include "runner/Mana.h"to your code. - Create the VM class and load the program.
- Tick the VM.
auto vm = std::make_shared<mana::VM>();
vm->LoadPlugins(".");
vm->LoadProgram(path);
// Tick
while (vm->Run())
;Register C-style callbacks or bind methods on existing C++ objects to the same native entry points in Mana scripts.
// Plain function binding
vm->RegisterFunction("nativeFunction", &NativeFunction);
// Bind a member function that matches mana::VM::ExternalFunctionType
auto instance = std::make_shared<MyPlugin>();
vm->RegisterMemberFunction("pluginCallback", instance, &MyPlugin::OnCall);MIT License
- Shun Moriya (X.com)