Creating a simple RPG with C#, SQL Server and LinQ - Part I
What this is: This tutorial / blog series of articles is meant for the beginner .NET developer to introduce the reader to a few game concepts along with putting together a real small Role-Playing Game using C# and communicating to a database backend just for fun.
What this isn’t: While this is meant for an introductory audience, it’s not meant for the beginner programmer. You should already have some kind of background in programming concepts (regardless of the language). You don’t need to be an “expert” but understanding what a loop is, or how to comfortably put together a few statements and functions is about all that’s needed.
The “good” thing about producing this series in C# is that the higher level language created by Microsoft is readable enough to browse through and understand even if you don’t necessarily want to learn C# itself.
General Overview
What we want to produce is a small, but functional RolePlaying Game using the .NET framework and the C# language. By working through the development of this game, you will learn a few things about game development and (of course) the .NET framework / C# language. As an interesting “twist”, the series will also go through the process of using Linq to query a SQL Server database for game data. At its very heart, an RPG largely consists of matching up user actions / results with corresponding data in tables and so is a good “fit” for integrating your game with a database solution.
Game Overview
The Kingdom of Aspire is under siege by the forces of darkness. King Wazoo has put the call out for a brave adventurer to defeat the nasty creatures and retrieve the Orb of Celestial Harmony which was stolen from the castle. Brave knight, your adventure awaits!
The game will be a 2D RPG with a few tiles for distinguishing landscape and city roads from monsters, treasure and other NPC’s. The game will be mostly keyboard based due to the number of actions typically involved in an RPG. The overall gameplay will be turn-based.
Technical Design Overview
We can leverage some of the flexibility of the .NET framework to produce an RPG game solution that we’re comfortable with. The .NET language / approach allows you to typically create software in a few ways.
- Fat Client: This is the common approach to desktop applications. Your application runs on the desktop of the machine “in isolation” of the intranet / internet on the .NET runtime.
- Thin Client: This is the common approach of a web application. Your application codebase is hosted on a webserver fronted by IIS and the .NET runtime. There are virtually no components that need to be locally installed, but you have a total reliance on the intranet / internet in order to run
- Smart Client: This is a mash of the two design approaches. You typically have a desktop application running on the .NET runtime which has the capability of hooking itself across the internet / intranet to other .NET pieces. This approach gives you the benefits of each method; a locally running application solution which can also communicate across the intranet / internet.
For the purposes of this series, we will be crafting a smart client solution using C#. The IDE used for this series will be Visual Studio 2005, but I will attempt to test out the same solution files in the newer Visual Studio 2008.
That’s pretty much about it. While waiting for the next entry, you can verify that you have the following software:
- Visual Studio 2005 C# Express from Microsoft
- SQL Server 2005 Express from Microsoft
Stay tuned!











This is default description text on Padangan Themes, of course you can change this text via you profile administration.