The QLaw Server Experiment

by Enrique Perez

QLaw is an experimental server to investigate the Law model originally explored with the Pangea server design. Since Laws are, in concept, identical to the 'toolboxes' used in the STAGE design, QLaw serves the important purpose of prototyping this architecture.

The current law model is a program structure that stores attributes, commands, entities and other classes seperately in an object broker. Laws add an instance of each class to the broker.

The server object broker has objects added to it by all laws except for client law. The client object broker has objects added to it by all laws except for server law. Right now QLaw has nine laws, STAGE has about thirty toolboxes and in effect all but two laws are shared by the client and server. After all the objects are added to the broker, they're each initialized with the broker so they can get a link to other objects in the broker if needed.

In this model, the client is viewed as a copy of the world around the player and is updated repeatedly by the server's world. The way the world is updated is by reading in Atlas XML. As the entities are read in, the entity hashtable is checked to see if an entity of the id from the Atlas stream already exists. If it doesn't, a new entity is created by getting an entity from the object broker according to the name or hash code in the stream and getting a new instance from that entity. Once the entity is available, whether a new instance or from the table, its attributes are overwritten. As the Atlas stream is read in, attribute objects are obtained from the object broker by name or hash code in the stream, which are in turn given the stream in order to set the attribute of this entity. This procedure is used by the client when reading in Atlas over a network or by the server when reading in Atlas from a file.

A world is altered by commands from an Atlas stream. As commands are read in command objects are obtained from the object broker by name or hash code in the stream, which are in turn given the stream in order to do something.

This model makes ideas like sub servers or storing a world as Atlas XML on a web page easier to implement. Classes can be dynamically added at runtime, the platform / language dependent code needed is in two functions in the hashtables with store the objects. It took about two weeks to incorporate the law model into the java version of qserver to make qlaw. Once the structure is in place, programmers can work on pieces of what will be an enormous program with more than a thousand classes without stepping on other developers toes. A more complete description of the law model is at: http://www.worldforge.org/dev/eng/servers/previous/quadas