White Orb class packages

A suggestion for how to package orb classes, and how the packages should depend on each other


Overall structure
White Orb as an API for third-party developers
A closer look at com.whiteorb subpackages
core
net
server
client
test
A note on PropertyViewers


Overall structure

I suggest using com.whiteorb as the top-level package name. This will contain five sub-packages:

whiteorb.gif (3912 bytes)

The dotted arrows represent class dependencies, i.e. where one package contains classes that refer to classes in another package. One of my goals was to avoid cycles and two-way dependencies.  Here is a description of each package:

White Orb as an API for third-party developers 

How does Harry the Hacker create a new universe for White Orb? What is a universe anyway, and what is the difference between a universe and a world (I know I've talked about this in other documents). A universe is a collection of class definitions that extend stuff from com.whiteorb.core, representing the available items, skills, and events of a particular universe. A world is simply an "instance" of a universe, and is created and managed online. Strictly speaking it is an object (not a class) that is an instance of World, or an instance of a subclass of World.  . 

Now Harry the Hacker wants to create a science fiction universe - what does he do?

I'm not sure this is exactly the way it will work, but I'm hoping it won't be any more complex than this for 3rd party developers.  The important thing is that 3rd party developers only need to understand the public classes in core and client.   What about net you might ask? Well to use the net classes directly you need to worry about optimizations and caching - so I am assuming the developer can use more high-level classes in client instead, and not have to worry about how communication with the server is done.

A closer look at the com.whiteorb subpackages

Core

Core will contain a set of classes and a set of subpackages, but no classes anywhere under core are allowed to be dependent on any orb packages outside of core.  Note that this means core classes may be dependent on other non-orb classes, for example JGL or other useful third-party APIs. 

Although core will contain subpackages, the dependencies between these subpackages does not need to be strictly defined. There will probably be alot of dependencies between core subpackages. Here is a sample set of subpackages:

com.whiteorb.core itself will contain the top level classes of the White Orb core hierarchy - basically the container hierarchy classes such as Item, Node, ContainerNode, Physical, Creature, etc.  Also game engine stuff like Clock and ItemProperties.

Net

As it looks right now, I think net will contain only interfaces.  It will contain the remote interfaces that both the client and server need to implement.  It "depends" on core only because core classes will be referred to in the method declarations - so this package does not actually "use" core classes.  The main purpose of this classes is to keep the client and server implementations completely independent from each other.

Examples of interfaces you might find in com.whiteorb.net are IClient, IServer, IGate (corresponds to what we call Agent today - I want to rename it to something less misleading), IPlayerGate, IPlayerClient, IAdminGate, IAdminClient, etc.  Only interfaces, to be implemented on the server or client sides. 

Why did I put "I" in front of each one?  That is Voyager's notation convention, and I like it. I'm not sure we should use it all over White Orb, but for the net classes I find it useful to emphasize that these are remote interfaces - when you deal with these, you are dealing with (god help us all) network communication!  Hopefully we will not have to deal with these interfaces so much, since we will try to encapsulate them within higher level classes (that do optimizations) both within the client and server packages. 

com.whiteorb.net will probably not contain subpackages.

Server

This package will probably have only one public class: OrbServer, which is the entry point to run the server. No external classes should depend on this package, so we really don't need any public classes.  This is the layer that allows external clients to access an orb world.  It contains (in addition to the server itself, that merely takes care of logging in new clients) a set of Gate classes that act as gates into the orb world for clients.  Gates take care of security matters (i.e. not letting clients cheat) and optimizations. 

Client

This is the client implementation, and will be done using 100% swing (as much as possible).  Client is dependent on both core and net. Although the client never communicates directly with the white orb world (this is done through net only), it uses core classes to refer to properties, to create instances of actions, etc.  The client will also contain a set of subpackages:

client.gif (4327 bytes)

(note that net refers to com.whiteorb.net, shown in this diagram just to illustrate the dependencies)

The com.whiteorb.client package itself will probably only contain the bootstrapping classes and some fundamental class that are shared by all the subpackages (and don't belong in com.whiteorb.client.beans). 

Test

This contains the classes used to test the system, i.e. it is essentially our test universe. It lets us test the perspective of the third-party universe creator. It will also contain any other dumb or temporary classes that aren't meant to be distributed in the final version, except possibly as a demo or code example.

A note on PropertyViewers

One important change with this new package structure is that the core packages do not include anything that has to do with PropertyViewers, the client, or GUI in any way.   Instead, PropertyViewers are a client-only matter. So how do you tell the client which PropertyViewer it should use for which Item class?

I suggest we provide a way of specifying the Item class -> PropertyViewer mapping using some kind of ini-file on the client side or something. When the client tries to find a PropertyViewer for an Item it will do the following:

  1. Check the Item's class
  2. See if that class has a corresponding PropertyViewer in the mapping table.
  3. If not, look for a PropertyViewer subclass with the name XXXViewer where XXX is the full class name of the item (example: SwordViewer).  . 
  4. If still not found, check orb.client.viewers.*
  5. If still not found, do steps 2-4 with the Item's superclass instead. 

If no PropertyViewer has been defined, then it will eventually hit the default PropertyViewers defined in orb.client.viewers.* - so it will always find some PropertyViewer.  This means no third-party developer has to create PropertyViewers.

We will create a GenericPropertyViewer that does introspection of the item and displays the property values - this will be the default for those cases where no PropertyViewer has been defined.


Henrik Kniberg

Last updated: