Well, in case you hadn’t noticed, it took me an unbearably long time to post part 5 of my .NET 3.0 series. Believe it or not, there’s actually a good reason for this. Christoper Bennage and I were selected as Code Master Challenge semi-finalists! We have been hard at work preparing for our live meeting with the judges. Unfortunately, our presentation didn’t go as well as we had hoped, due primarily to technical problems with live mail, live meeting and vista. In any case, the online multiplayer game we have been creating is turning out awesome! We are very pleased with the product and the platform that we have chosen to build it on - .NET 3.0. I believe that our game is one of the broadest and most impressive demonstrations of what .NET 3.0 can do. I haven’t really seen anything quite like it. There are three parts to the product: the game client, game server and the administrative tool. I’d like to share a little bit about how we have used the different pillars of .NET 3.0 with respect to the different parts of our application.
Obviously the game client is done with WPF. We are taking full advantage of its 3D capabilities. We are doing a decent amount of animation of 3D content as well. The entire client is skinnable, allowing us to use WPF’s control templating and styles to completely change the look of the game. The admin tool’s UI is also built with WPF. We did this in order to support some of the 3D stuff we needed to show in the tool, but it was also much faster and more stylish to develop this in WPF than WinForms, not to mention the greater maintainability of the code that resulted. Here’s a shot of the admin tool:
Notice the custom context menu, combo box and text box. That’s all done with control templating. Sweet! We also have a custom control that displays a rotating 3d model, in this case: a space craft.
We are doing some pretty cool things with workflow as well. All of our AI is run by workflow. We have created a set of custom activities that can be used to build AI personality behavioral patterns. When an NPC finds them self in a particular situation the appropriate workflow for that character is executed to determine how the NPC will respond. We define set types of behaviors and create the activities in code, but full authorship of the behaviors themselves is done through a custom re-hosting of the WF designer in the admin tool. This means that an admin can create completely original NPC’s that we haven’t thought of by simply dragging and dropping personality components and wiring those behaviors up to an NPC. Here’s a shot of the behavior designer showing how a particular NPC will react during combat:
It gets better though! Not only are we using WF to create AI behaviors, but we are using it to let the admin author unique story lines! We have developed a set of custom activities that represent story events and triggers. These can be combined to create quests within the game. The admin can literally work any story they want into the game world.
Since it is an online multiplayer game, we have to handle communications somehow. WCF fits the bill. With WCF we are able to send messages about the players actions to the server and the server can push info out to the players. Thanks to WCF duplex messaging over tcp, this is very simple and we were able to keep all of the game logic on the server. Also, it was a synch to enable chatting between players and to top it off we used WCF to publish an RSS feed of game events (specific to the player) that enables one to see what is happening online when they are not playing. (We have a special vista side bar gadget if you want to display this feed in a stylish manner.)
Other cool things:
In .NET 3.0 there is a speech recognition API that can be used to control vista and its applications. We used this API to build a custom grammar for the game. So, if you don’t want to use the mouse, you can control the game entirely with voice commands!
The client is less than 1mb in size at this time. How did we accomplish this? Well, remember the admin tool? You can use this to add all of the content to the game: skins, ship models, character portraits, npc behaviors, quests, etc. All of this is being stored in the SQL as XAML! (Yes, 3D models too) . When the game needs to display something visual, it simply asks the server for the content. We are actually using WCF to send Xaml 3D models over the internet as needed by the game. (Yes we cache the data on the client.)
All together, we are very pleased with what we have been able to do and look forward to sharing more of our progress.
11-10-2006 4:42 PM