Zen Plugins

Ok, so far I haven’t really posted anything of a technical nature, so I guess I better jump on that grenade.  For now, I’m going to start with something relatively simple — a stubbed in plugin for ZenEngine.  Over the next several posts,I’m going to illustrate how to create the skeleton code for a terrain plugin using the ZenCore and ZenEngine framework.

I will warn you beforehand — this is not novice stuff, and I’m probably going to assume that you both know a little about C++ and the inner workings of Zen.  That being said, if you don’t know much about the Zen framework but manage to hold on throughout my ramblings, you might walk away a little bit wiser.

Generally speaking, source code for a Zen compatible plugin consists of the following files/file structure:

ZGenericPlugin – Plugin top level folder.

CMakeLists.template – CMake template file used to generate the CMakeLists.txt file used to generate Visual Studio/Eclipse/Make compatible builds

Configuration.hpp – Configuration header for specifying things like class and method import/export properties when dealing with dynamically linked libraries (DLLs).

plugin.xml – Plugin metadata describing the extension point and plugin type for this plugin.

ZGenericModule.hpp – Header declaring the getModule() method used to load this plugin.

src – Plugin source implementation folder.

ZGenericPlugin.hpp – Header containing a concrete class declaration of the Zen::Core::Plugins::I_Plugin interface for ZGenericPlugin

ZGenericPlugin.cpp – Source file containing a concrete class implementation of the Zen::Core::Plugins::I_Plugin interface for ZGenericPlugin

ZGenericModule.cpp – Source file containing a concrete class declaration and implementation of the Zen::Core::Plugins::I_Module interface for ZGenericPlugin as well as an implementation of the getModule() method declared in ZGenericModule.hpp

ZGenericServiceFactory.hpp – Header file containing a concrete class declaration of the service factory interface specific to the extension point to which ZGenericService is bound.

ZGenericServiceFactory.cpp – Source file containing a concrete class implementation of the service factory interface specific to the extension point to which ZGenericService is bound.

ZGenericService.hpp – Header file containing a concrete class declaration of the service interface specific to the extension point to which ZGenericService is bound.

ZGenericService.cpp – Source file containing a concrete class implementation of the service interface specific to the extension point to which ZGenericService is bound.

Other Files – Any additional class headers and source necessary to support the functionality of ZGenericService and implementation of additional interfaces specific to the extension point to which ZGenericService is bound.

Now, you may have noticed that I mentioned extension points multiple times in that little outline. The extension point dictates what kind of plugin this is – since we’re going to be developing a terrain plugin, we will be binding this plugin to the Zen::Engine::World::Terrain extension point.  This extension point exposes the following interfaces that should have concrete implementations in said terrain plugin:

I_TerrainServiceFactory – Interface for factory patterns used to instantiate I_TerrainService instances.

I_TerrainService – Root interface for the terrain API exposed by a plugin bound to the Zen::Engine::World::Terrain extension point.

I_Terrain – Interface for a terrain instance created via the API exposed by I_TerrainService.

In the next post, we will lay out our initial plugin directory structure and stub out concrete implementations of these interfaces.  I’ll try to keep the next post a little less dry than this one :) .



1 Comment so far

  1.   Tony Richards on August 10th, 2010

    Awesome! Not sure how I missed this post, but this is definitely a series of articles worth following.

Leave a Reply