Server Setup and Architecture

Jeff Morrow

Installation:

The server side code can reside on any computer that has .NET 2.0 and SQL Server 2005 on it. At the moment, no other software is actually necessary. In order to compile and run the server, open the SkyNetMain2.sln solution in Visual Studios, and set the startup project to be server/ServerMain. Once your code has been compiled, it is necessary to run a post-build script which resides in the base directory of your SkyNet folder called postbuilddiscoverable. After that the server should be ready to start. You could find the executable itself in your SkyNet directory /server/ServerMain/bin/Debug/ServerMain.exe.

Architecture:

The overall server architecture looks similar to the diagram above. The general control flow follows the diagram below.

To describe in words what the pictures are talking about, the Network exists and is documented elsewhere. The network proper interfaces with the class known as Generic Agent. Generic Agent is an abstract agent class that we created with the goal of simplifying out a lot of the more mundane details about how to talk with the model and the world administrator in the way that the view expects it to be talked to. Below the Generic Agent is the SimulationAgent. This is the concrete implementation of GenericAgent that does things specific to the DiscoverableSimulation. This notion of Agents requires us to trust the users somewhat in that they won’t upload completely malicious code, but also attempts to keep them in a managed and partially trusted environment to limit the damage that they would be allowed to do to a system.

The agent talks to the world through an ISimulation interface. However, the ISimulation interface only has the basics like logonAgent, logoffAgent, etc etc.

For our implemented DiscoverableSimulation, the SimInterface field returns an object called Discoverable. Discoverable is the simulation specific way for agents to request behaviors and interactions with the world. As a side note – if you were looking to distribute the behavior interactions using a technology like COM+ over a cluster, Discoverable would be my first place to try having spread throughout a cluster. It handles the bulk of the managing of the behaviors and the rules layer. Given a link to the database, it can exist statelessly and return the info needed when the request is complete.

Inside Discoverable, the interaction between the Behaviors and the Rules occurs as documented in the Behaviors and Rules documentation, and they themselves interface with the SQL database using a technology called Gentle.NET. Gentle allows the server model to communicate and store in a database using objects rather than the standard request strings and values stored in a relational database.

FAQs:

Where can a developer build a new entity, behavior, or rule?

In the process of further development, entities can be built wherever you like. They are simply an xml document built to a specification and loaded in at runtime. The rules, behaviors, and agents can also be built separately with the caveat that they all would require you to import the Shared and ServerShared dlls. Those have been put in a separate assembly to attempt to manage that issue well. Additionally, when building a different agent, you are going to need to set up some form of postbuild script similar to postbuilddiscoverable to take the files inside of it and zip them up. Also, if you want to avoid a lot of the hassle of defining a separate dll, server/Simulation/(Behaviors or Rules) is where all of the default behaviors and rules are stored. If youyou’re your new rule/behavior to that folder it will be included in the package automatically. Postbuilddiscoverable also does some things like moving the necessary library files around within the directory, but by and large, takes care of it automatically for you.

Where can I find the media packages? How can I add a new one?

Media packages can be found and stored in their current location of /client/media. To add a new one, you need to find one of the 3d mesh types that Irrlicht supports, and put it into a zip file along with an xml schema manifest.

Are there hooks for user authentication?

Yes, they do exist in the server model. The WorldAdmin class or the simulation class itself would be good places to look for where to implement some form of user authentication. At this time, there are no protections against anyone doing anything they want within the world, but user authentication is a good way to start guaranteeing more security in the system.