Plugin Framework for Java

PFfJ - Plugin Framework for Java

Project name: Plugin Framework for Java

Game type:  It’s a framework, not a game…


License:  Apache license v 2.0 (for now)

Recruiting: I currently need someone to help out with the transaction manager, which will need to be done with JTA.

Contact:  Mark Schrijver (Just mail or PM me through this here forum…)

Status:  Beta 1


The framework uses, as it’s name implies, plugins to make coding easier. Communication between the plugins is done via PluginMessages. The PluginMessage is sent from the Plugin to the PluginController, which then decides which Plugin the message ultimately goes to based on the supplied PluginID. The framework also supports distributed Plugins. This means that the framework can run on multiple servers and the controller will redirect the PluginMessage to the correct server based on the configuration file. Changing from local to distributed, or moving a Plugin from one server to another merely requires a configuration file change. No code change is needed in the Plugin or the Plugin Controller.


Plugin loader: Done.

Distributed functionality: Done.

Transaction manager: Not Done.

Plugin Registry: Not Done.

Plugin Clustering: Not Done.

Dynamic load balancing: Not Done.

This is the roadmap as it stands now. The framework is also already actively being used in the development of a game server. This game server acts as a testbad for the framework as much as a real test server so it’s slow going…

Used API’s:

As of yesterday, the transaction manager is finished. So now the framework is actually usable.

Not sure how usable it would be for a game client though. But for a game server it is proving to be quite handy. Especially to give the game server instant scalability.

But like I said, try it yourself. There are new release files in there as well as a wiki and a javadoc etc.

I took the liberty of hyperlinking your project URL; makes it easier to see and follow.

Personally I can't fully wrap my head around what this project brings to the average JME developer, but extensibility always sounds like a plus. Could you by any chance make up an example use case? Say, someone who is making a game with JME, and how this framework might play a part in that.

Thanx for the hyperlink, forgot about that option myself (DUHH…)

Ok, here’s a project that is currently using it:

While not JME, it does incorporate a lot of code examples for the plugin framework.

The plugin framework is used for the gameserver, which is where it would be most useful. Once We get the Java Game Framework up and running again, this framework will also be used for the server implemented there.the main advantage of a framework like this are scalability and function separation.

You can easily scale up your server once you game starts picking up more players. Scaling up is just a matter of adding more instances of the server and setting the config file accordingly. So each server has a dedicated task. One for player login, one for the character plugin, etc. Eventually, when I get round to adding plugin clustering, you could even have multiple servers for the same plugin which will then be load balanced and everything.

The other advantage, function separation comes into play with building and maintaining your server. The only connection between the plugins is the PluginMessages and the PluginMessageResults you define for your plugin. You can have multiple programmers working on different plugins at the same time. As long as you have a clear definition of the messages, they can work side by side on different functionality. This even even more true with maintaining / upgrading your server code. When you find something in one plugin, you can just redeploy that one plugin, without having to redeploy the entire server. Currently this still requires a reboot of the server, but in the future such a plugin deployment may become possible on the fly.

I will be adding examples / testcases to the PFfJ project itself over the next week or so. Not sure if these will contain any specific JME examples though, since the framework isn’t solely intended for JME but caters to a wider audience.

Because the framework has speed as one of the BIG design directives though, it lends itself very well for a game server. Which is why I chose to share it here as well. I’m not that good at the whole JME front-end thing, but this server-side stuff is something I am good at.

Oh, and if any of you have any suggestions or requests, I’ll be happy to se what I can do. Example plugins, framework features…

Ok, I put in the tests / examples.

There's to real tests, but three executable classes. one is for a standalone test and the other two work together for a distributed test.

Just a very simple test though, read a file and write it back in a different location. Does show the main features of the framework though.