Monday, July 04, 2005

Programming: Riskier (Part 4)

Finally I have a working program. After many prototypes, tests and experiments, I have finally built a shell of a server in C#.

Currently, it is listening to one client generate message (MoveUnit) via .NET remoting. The world object is being updated correctly. Now, my next step is to have the fact update propagated to all interested parties. That should be interesting. The plan is to simply register each player object with the server, such that when a unit or region fact update is allowed to be known to a client, it is sent a message – this will be a simple .NET delegate (event). Ultimately, I intend to build a message packet which will accumulate updates, but that optimisation will come later, if required.

Next, I intent to start exploring the idea of using Reflection to automate the FactUpdate event. I thought it would be really cool to simply tag a property with an attribute that would indicate to the server that an update to the various clients is required – great plan, but yet to be confirmed. The fall back position will be to manually code the event call for each property for each entity. Not hard, but certainly not as elegant. It will no doubt be more efficient though, so all would not be lost.

Of course, a functioning server will demand a new and improved client. My intent is to build a primitive command based ‘terminal’ which will simply be a basic object viewer, in the spirit of mail-based BBS games of 10 years ago (no doubt these games still exist, and are well participated in!).

An interesting point from all this is that I have found it has been much harder to build this program than I had expected. Don’t get me wrong, I never though this would be easy, but I really have struggled to make the progress I had wanted. I have however learned several important skills, so all is not lost. I have in the process learnt many things about C#, the .NET Framework, and Object-Oriented design. At least my secondary goal was obtained!

As a vehicle for learning new technologies, it has been worthwhile. I can only hope that I am now in a good position to commence the ‘guts’ of the program. Writing the actual ‘business’ logic is where the process should become interesting and start yielding some visible results.

Firstly though, I need to beef up the client!

No comments:

Post a Comment