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

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

Edit project

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

add_resources.png
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

add_reference.png
Open the Add Reference dialogue.

add_brainiac_base.png
And select the Brainiac Base project as a new reference.

Edit reference

ref_properties.png
Open the properties of the reference.

ref_notlocal.png
Disable the option that the reference will be copied.

Adjust class

adjust_class.png
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

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

Adjust node

new_node_code.png
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.

new_node_code_res.png
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

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

final_code_res.png
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.
workspace_new.png
Click the "New" button to create a new workspace.

workspace_create.png
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.

new_node_designer.png
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 1:54 PM by dkollmann, version 6

Comments

No comments yet.