Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (580)
games submitted by our members
Games in WIP (500)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Pluggable Architecture  (Read 3416 times)
0 Members and 1 Guest are viewing this topic.
Offline Preacher

Junior Member




Java games rock!


« Posted 2004-01-12 12:20:58 »

Hi i'm developing a 3D Chess game aimed at a young age group
for a college project and i'm interested in making a pluggable
architecture such as in eclispe.

This is my first serious attempt at developing a complete
software product so i have only a few shaky ideas about how
to implement a pluggable architecture.

My only idea so far is to have all plugs register to a central module to receive events, same as Java event model, and each plug implement a plugEventListener etc to handle custom events such as MoveEvent, PropertyChangeEvent etc.  Grin

I woudl really appreciate comments and ideas from people more experienced in these
issues as i would really like to implement a pluggable interface. Thanks
Offline Breakfast

Senior Member




for great justice!


« Reply #1 - Posted 2004-01-12 12:45:08 »

What exactly do you mean by a pluggable architecture?  What do you want it to do?
Offline Jeff

JGO Coder




Got any cats?


« Reply #2 - Posted 2004-01-13 01:12:59 »

Plugins in java are handled through dynamic calss loading.  Its best that each plug-in have its own class loader because that way you can avoid potential name-sapce clashes.

Generally what someone does is define a FooPlugin interface that defines the functions all plug-ins need to implement as well as a naming convention for plugins to make them easy to seperate from the support classes in the same calss path.

On start-up, you search each class loader's classpath for all classes that match the naming convention. Yo uthen instacen thsoe classes and check to see that they implement for FooPlugin inetrface. If thats true you add them to a  plug-in list for use by your app.

Thats it in a nutshell. There are lots of details you need to cover but thats the over-all process.

NOW having said that, we have ALREADy released a generic plug-in system into Open Source you can use if you like.  Its the in net.java.games.jutils package thats part of the JInput project.


Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Preacher

Junior Member




Java games rock!


« Reply #3 - Posted 2004-01-13 09:02:56 »

Alright sounds good, i'll do a bit of research and give it a try Wink

Breakfast im want to develop a chess game that myself or other developers can easily add extra components such as a board editor, or a game analyzer etc.

The game will be aimed at a young demographic so i want the user to be able to add in these plug-ins very easily, say just drop a .jar file into a specified folder and the game, at start up automatically detects them, verifiies them and adds them.

Thats it really so if you have anything to add it would be a great help Wink
Offline Orangy Tang

JGO Kernel


Medals: 51
Projects: 11


Monkey for a head


« Reply #4 - Posted 2004-01-13 10:19:25 »

I do something pretty similar with S-Type, all the actors (player, bullets, enemies etc.) are dynamically loaded by the editor and placed, ready to be loaded in proper when you start an actual game.

However I havn't had to use different classloaders, mainly because I assume different sets of actors live in their own package anyway. I simply set the plugins dir to be included in the classpath, and any new actor classes can just be dropped in.

Unlike Jeff's method, I don't have a naming convention (at least, not one thats required) and instead just have a text file that lists all the actor classes to use. I find this more handy because then you can just edit the file to choose which ones to load or not. This way is simpler to implement, but might not be as suitable depending on what you're looking for.

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline Breakfast

Senior Member




for great justice!


« Reply #5 - Posted 2004-01-13 12:25:12 »

You could up the user-friendliness of this by perhaps adding a graphical front-end to the option file editing.

Maybe you would also want to create a standard Pluggable type interface that all your plug-ins will need to implement, perhaps containing some metadata and the like that you can use to create menus so people can switch on or off different plugins as necessary.

It seems to me that you will be helping yourself in this if you keep your design as clean and OO as possible, too.
Offline swpalmer

JGO Coder




Where's the Kaboom?


« Reply #6 - Posted 2004-01-13 13:49:32 »

Quote
NOW having said that, we have ALREADy released a generic plug-in system into Open Source you can use if you like.  Its the in net.java.games.jutils package thats part of the JInput project.


More accurately it is in the JUtils project which is used by JInput.
Find it in Games-Core

Offline blahblahblahh

JGO Coder


Medals: 1


http://t-machine.org


« Reply #7 - Posted 2004-01-13 14:08:35 »

Have a look at jedit.org - jedit has a plugins architecture for adding all sorts of functionality to the editor. Depending upon how much customizablity you want, this might be a good model to follow. Note that it makes extensive use of BSH (a java-syntax scripting language which enables you to write simplified java code, and program more quickly).

Ditto Netbeans etc, which has it's own plugins arch.

malloc will be first against the wall when the revolution comes...
Offline blahblahblahh

JGO Coder


Medals: 1


http://t-machine.org


« Reply #8 - Posted 2004-01-13 14:19:52 »

Quote

NOW having said that, we have ALREADy released a generic plug-in system into Open Source you can use if you like.  Its the in net.java.games.jutils package thats part of the JInput project.


Just had a look - brilliant! I've seen much fuller-featured plugin systems, and this one is currently so lean it's quite rubbish (mainly the lack of metadata, stuff like Breakfast suggested), but it's great to see a serious start on it in j.d.net

...I've requested develop access, since I've made simple plugin systems more times than I care to count, and can *probably* quickly add some useful stuff. There's quite a lot that you can add to a plugin system before you get to the point where you need to sit down and carefully plan the rest of it (e.g. basic "plugin name + description" meta-data is universally desirable)...unless someone else is already doing this.

malloc will be first against the wall when the revolution comes...
Offline Preacher

Junior Member




Java games rock!


« Reply #9 - Posted 2004-01-13 14:58:45 »

Im not getting a bad response Smiley

I'd really like to keep the plauggable architecture simple its for a college project (3DChess game) and is not a primary part of the game, so i would like to keep the development time to an absolute minimum.

What is the possiblities of implementing a system like java's event listeners?  where each pluggin would implement a plug interface and register with the core module to receive events??

Can you create custom events in java that one of your objects can broadcast to all registered listeners???

I'm going to sit down and work through what you all have suggested tonight and get back tomorrow, and thanks very much to everyone who suggested ideas
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Orangy Tang

JGO Kernel


Medals: 51
Projects: 11


Monkey for a head


« Reply #10 - Posted 2004-01-13 16:53:29 »

Quote
What is the possiblities of implementing a system like java's event listeners?  where each pluggin would implement a plug interface and register with the core module to receive events??

Theres nothing particularly magic about regular event listeners, the event itself is just another object, as is the listener (usually implementing some sort of listener interface). You simply need to create classes or interfaces for the plugin writers to use.

Depending on what events you want them to listen to, you might want to have them register themselves or done automatically for them. For chess I assume you'd like to listen for moves, so every plugin could automatically be registered at creation time. Or maybe provide a .register method where it can attach to whatever subsystems it feels like it needs to listen to.

Quote
Can you create custom events in java that one of your objects can broadcast to all registered listeners?

Sure you can, its just another object you make yourself Smiley You just need to define a listener interface to go with it that accepts the event object as a parameter.

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline Preacher

Junior Member




Java games rock!


« Reply #11 - Posted 2004-01-15 07:59:12 »

Excellent Thnaks v.much one and all Wink
Offline Jeff

JGO Coder




Got any cats?


« Reply #12 - Posted 2004-01-15 19:13:04 »

Quote
...I've requested develop access, since I've made simple plugin systems more times than I care to count, and can *probably* quickly add some useful stuff. There's quite a lot that you can add to a plugin system before you get to the point where you need to sit down and carefully plan the rest of it (e.g. basic "plugin name + description" meta-data is universally desirable)...unless someone else is already doing this.


Nope we have noone but me working on Jutils so far and I havent done more beyond what I needed.

Would love to have you pounding on it.  Have you filed a core developer agreement yet?

The only coding requirement is that, in modifying Jutils stuff, you not break other core projects that rely on it. Currently thats just JInput.  If you are going to make changes that might break JInput, post them first (idea, not code) to the JInput forum so the JInput folks can have input.

Thanks

JK

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline swpalmer

JGO Coder




Where's the Kaboom?


« Reply #13 - Posted 2004-01-16 00:51:06 »

I was just trying to grab the latest version of junit from CVS but apparently I can't anymore.

update -d -P -A
User swpalmer doesn't have <Update> access to project cvs

Command Finished.

Weird.

Offline walkerr

Junior Newbie




If it's not worth doing, it's not worth doing well


« Reply #14 - Posted 2004-01-16 08:11:54 »

Check out OSGi - it's not specifically for gaming, but it is specifically intended to provide a dynamic puggable environment:

OSGI web site:
http://www.osgi.org/

Oscar (open source implementation):
http://oscar-osgi.sourceforge.net/

Knoppfler fish (also open source):
http://www.knopflerfish.org




Offline Jeff

JGO Coder




Got any cats?


« Reply #15 - Posted 2004-01-16 20:58:08 »

Quote
I was just trying to grab the latest version of junit from CVS but apparently I can't anymore.

.


i added you with observer status.  Are you still having probs?

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline Jeff

JGO Coder




Got any cats?


« Reply #16 - Posted 2004-01-16 21:00:24 »

Quote
Check out OSGi - it's not specifically for gaming, but it is specifically intended to provide a dynamic puggable environment:


OSGi is a bit different. Its not a plug-in system but an execution environment for little remotely installed applications.  Its srot of like a push rather then pull Applet executor with no video model.

I actuallyworked on  the OSGi "connectd home" demo for Sun 2 or 3 JavaOne's ago.



Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (48 views)
2014-04-15 18:08:23

BurntPizza (44 views)
2014-04-15 03:46:01

UprightPath (60 views)
2014-04-14 17:39:50

UprightPath (42 views)
2014-04-14 17:35:47

Porlus (58 views)
2014-04-14 15:48:38

tom_mai78101 (82 views)
2014-04-10 04:04:31

BurntPizza (140 views)
2014-04-08 23:06:04

tom_mai78101 (240 views)
2014-04-05 13:34:39

trollwarrior1 (200 views)
2014-04-04 12:06:45

CJLetsGame (207 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!