Tuesday 12 January 2010

Solution Architecture

Well, here I am again. I have been diagnosed with swine flu (thought it was bad flu), so in between the need to go and lay down, I have some time on my hands. Constant doses of paracetamol are keeping me going. Don't worry, you can't catch it through the internet, carry on reading ...

Since my last post I have stopped development on the C# XNA Globe client project because I found the Irrlicht 3D engine to be more powerful, faster and equally productive to work with. The client is now a native unmanaged C++ application, capable of running under OpenGL (default), DirectX or a software renderer. With minor development, this solution also allows Linux and Mac versions to be compiled from the same code base.

Although the client application is now C++, this is the only C++ application in the solution, the remaining 13 projects in the solution, which consist of various servers, data layer and windows services and console applications are all managed C# libraries or applications.

The servers all consist of 3 projects each, a class library containing all the functionality, a windows service host application, and a console application host application, the 2 different host applications are a by product of the hardships of debugging deployed windows services.

Below is a view from solution explorer showing the Globe project as it currently stands and an explanation of what each of the projects is responsible for doing.


TheGlobe.AssetServer
This is a C# class library containing all the functionality that the asset server needs, it contains all the threading and TCP code. The asset server is responsible for sending data such as textures and other media to the client.

This namespace also contains Console and Service host application projects. C# console applications are far easier than windows services to debug, but windows services are better in a production environment, so I am mixing the two.

TheGlobe.Client
The famous Globe client! (well here its famous) It is a native unmanaged C++ application using the Irrlicht 3D engine. The code in this project compiles and executes completely independently of any other projects in the solution, but obviously needs those servers to be running remotely in order to operate.

The new C++ version of the client project is now more advanced than the C# XNA version, so that has been removed and dropped into an obsolete folder.

TheGlobe.Data
This is a combined business and data layer project for all the servers, it is a C# class library containing Linq2Sql classes generated from the Globe database. All reads from the data store are carried out using fast compiled queries and contains its own set of strongly typed data objects for consumption by the servers.

TheGlobe.LoginServer
This is another server, following the same architecture as the Asset Server. The Login Server is responsible for the initial client authentication, and on successful login will provide a login token to the client for future interaction with other Globe servers.

TheGlobe.SimulatorServer
The Simulator is responsible for enforcing and tracking user positions, server side collision detection, chat and generally everything except media such as sound, animations, images etc.

The remaining projects in the solution are just setup wizards for deploying the windows service versions of the servers.

I hope that gives you a better understanding of the Globe Project!

I have now got the asset server and simulator to a stage where it can serve a skybox, so my next development stop will be back on the Client to create C++ connection managers, similar to the login one, to communicate with the servers.

When I have Skybox, Terrain and Water - you get a screen shot :)

2 comments:

  1. Hey again!
    Sorry to hear you got "The flu", and I hope you get well soon! )

    Regarding the console/winService apps. Why did you need two separate projects for each?

    When I was writing my windows service, I just made sure I had a public static Main(string[]) method in Program.cs, and changed the project properties to make it run as a console app. After this I could simply run and debug it. Once I was finished, I changed the project properties back to Win Service, and I could deploy it. :)

    I do admit that my service was a lot simpler, though, but it was a nice trick, and made my life a lot easier at the time :)

    ReplyDelete
  2. Hey Artiom,

    Nice comment! That sounds like a good idea. I will definitely bear that in mind for future.

    The Console and Service apps in Globe literally only contain code to instantiate a class in the class library projects anyway, so they never change.

    I could see the advantage of switching to your technique if I was updating two codebases.

    Next time I approach this issue, I will try your technique, but as there is no advantage to doing it in Globe at present, I am going to stick with the application architecture I am currently using, to save time.

    ReplyDelete