All GBS plugins are pretty much SWC files. There are a number of ways you can generate a SWC file but for the purposes of this tutorial I will just show you how to setup a library project in FlashBuilder which will make it really easy to build a SWC file for GBS. Read the "What Is A SWC?" article if you are not clear on what a swc is.
What Do I Need?
You need the following tools:
- FlashBuilder 4.5 (You could also use Eclipse, FDT, or FlashDevelop if you wanted to)
- GameBuilder Studio Application
You need to make sure you have the following libraries to build your plugin against:
You can download the GBS Plugin SDK libraries by logging into your GBS dashboard and going to the downloads section.
Setup A Library Project In FlashBuilder
Open up FlashBuilder and go to File -> New -> Flex Library Project
Give your project a name. The name you provide here will be the name of your final swc file. Make sure to un-check the Include Adobe AIR libraries unless your plugin requires this.
Set Output Folder & Create Lib Folder
Point your outpout folder to the custom GBS plugins folder on your system. This is in the documents folder of the user directory. On Macs it is usually "/Users/[Your Name]/Documents/GameBuilderStudio/plugins". On Windows it would be something like "C:Documents and Settings[Your Name]My DocumentsGameBuilderStudioplugins". This folder will only be present if you have run GameBuilder Studio at least once already if not just create the directories manually.
You can add the GBS Plugin SDK swc and GBS Engine Lib swc to your library project one by one by clicking "Add SWC" or you can create a libs folder under the directory where your library project exists on your hard drive and drop both swcs in the libs folder then click "Add SWC Folder" on this same screen. This will make FlashBuilder reference that lib folder for all swc libraries at compile time.
Lib Folder Location
Set Libs Link Type To External
Make sure that the GBS libs are External to your plugin so that FlashBuilder doesn't embed the plugin SDK into your final plugin SWC. This will help reduce plugin file size.
Create The PluginConfig.xml File
You need to create a PuginConfig.xml file that will describe things like your plugin unique id, descriptor class path, and plugin description.
Download the sample PluginConfig.xml and place it in your project's src folder. You will need to right click on the project name in FlashBuilder and click on the "properties" link to open up the project properties. Navigate to the "Flex Library Build Path" section and click the "Assets" tab. Make sure that the PluginConfig.xml is selected so that it is included in the final plugin swc file.
**IMPORTANT - If this PluginConfig.xml file is malformed or missing, your plugin will fail to load.
Make sure to change the version number to match the version you are developing for. The className needs to be an absolute path to your PluginDescriptor class. You can also have a description element with a CData block and a paragraph that describes what your component does.
SWC VS GBP Plugins
During the beta phase of GameBuilder Studio you will be able to just load raw SWC files into GBS as long as it has the necesary files and descriptors but in the future plugins will need to be signed by us and they will have a .GBP extension. This process should be pretty easy. More info on this to come.