This tutorial will explain to you how to create your own plugin.

Load the solution

To make things easier we add the project to the same solution as the designer, so open it.

Create a new project

Add a new project to the solution of the type Class Library.

Edit project

Select the tab "Build" and set the output path for all configurations to "..\out\plugins\".

Select the tab "Resources" and click the appearing link. This step is optional when you want to use resources for strings.

Add Brainiac Designer Base reference

Open the Add Reference dialogue.

And select the Brainiac Base project as a new reference.

Edit reference

Open the properties of the reference.

Disable the option that the reference will be copied.

Adjust class

Rename the automatically created class so it has the same name as your project.
The name of the DLL file, namespace and class must be the same: MyPlugin.dll, namespace MyPlugin { class *MyPlugin* { } }

Create your own node

Create a new filter Nodes and add a new class called MyTestNode.

Adjust node

Adjust the node's class that it looks like this. You can inherit from any other available node too.
It is important that the constructor of the node requires no arguments.
Of course the class and the constructor must be public.
You also have to implement CloneProperties in order to make the node work correctly in the editor.

If you decided to use a resource file, this is what your code will look like. You add strings to the resources by double-clicking Properties/Resources.resx and adding them to the table.

Register the node

For our example, we create a new node group "MyPlugin Group", assign it the icon of the red flag and add our test node.

If you decided to use resources, your code has to look like this. It is important that you register your resource manager.

Test your plugin

Build your project and press F5 to start the Brainiac Designer. You will now have to create a new workspace which includes your plugin.
Click the "New" button to create a new workspace.

Enter a proper name for your workspace, select your plugin and enter a location where you want the behaviours to be stored. Then press the "Done" button.
Open the workspace you just have created by clicking the "Open Workspace" button.

As you can see, your plugin is loaded and your node appears in the menu. It can also immediately be placed in a behaviour tree.

If you have further questions feel free to post in the forum or look at the Blank Plugin example included which resembles this tutorial.

Last edited Mar 4, 2009 at 2:54 PM by dkollmann, version 6


No comments yet.