New Tutorial Series – Rogue C#

This post is part of a series on creating a roguelike game in C#. For the latest chapters and more information, please visit the Official Project Page on The current code for this project is also available on Github.


A few years ago, when I was teaching a college course in database programming, I remember one of the students looking at a sample program and wondering out loud “How does anyone actually put something like this together?”. I knew what he was asking – it’s a long way from playing around with some code snippets to actually organizing and building an application from the ground up. It can be as much work as writing a novel or building a work shed or any other major project.

I don’t say any of this to discourage anyone from programming. I’ve been doing it off and on since I was a teenager. Even as a student, I was coming up with ideas of my own for projects and hammering away at them for hours after school. It was often frustrating but I kept doing it because the high that comes when something finally works like you want it to feels like nothing else.

By the time I was teaching, I’d decided that the best way to learn programming was mainly through practice. Systematic study of a language is great to get a handle on the syntax but it’s a waste of time without the continued practice that will commit the ideas to memory. The class I taught ended up being about 90% workshop as I threw one challenge after another at the students and made them research solutions on their own. Software development is not just about knowing the language elements; it’s about breaking problems down into pieces and learning to use the programming tools to create a solution. That only comes with experience, research and lots of practice.

So, for this demo, I’m accepting a single, epic challenge – the rebuilding of a classic role-playing game called … Rogue.

“Oh, yeah, Rogue! … Wait, what???”

Rogue is a role-playing game (RPG) that was first released in 1980 for Unix-based systems and then ported to other operating systems, including the up-and-coming MS-DOS. It’s a 2-D game where your character wanders around dungeons fighting monsters, picking up gold and other items and trying to find the Amulet of Yendor so you can escape the dungeon and win the game.

Rogue is turn-based so every time you move, so do the monsters. If your character dies then you start the game over, the graphics are entirely made up of text characters and it doesn’t look much like the sophisticated games of today.

Rogue is also a classic game that inspired an entire genre of other roguelike games and even a set of standards by which to measure these games. Designing a Rogue clone is a complex programming challenge involving graphics design, game logic, the management of many elements and the consistent display of those elements on screen.

As a game, Rogue is incredibly addictive. Dennis Ritchie, the creator of the C programming language, joked that it was “the biggest waste of CPU cycles in history”. Jerry Pournelle, scientist and sci-fi author, called it his “game of the month”. In 2009, it was #6 on PC World’s list of the ten greatest PC games ever. I personally deleted all my copies of it at one point just to stay away from it.

Since this is an RPG with character stats and “dice” rolls, you’ll see how to program those calculations and apply them within the game. Every turn involves multiple decisions to update the game board and character stats. You’ll also learn how to load and save game data.

Despite the retro appearance of the game, every skill mentioned above is still essential to modern gaming and software development. The lack of modern graphics will let you focus on learning and applying the actual C# language and concepts to design your own application. During this series, you’ll also learn something about software requirements, testing and troubleshooting – important skills in a software development career.

Rogue was originally developed in C as, essentially, a console application. As of Windows 10, the original game is no longer playable on Windows unless you use a virtual machine but you can get a version from Steam that runs through DOSBox. For this course, I’m re-creating the game using a Windows Forms application while trying to keep as much of the original look and feel as possible.

Of course, cloning a game doesn’t mean that I can’t throw in a few new features. Every Rogue clone that’s been designed over the years has added its own style and there are a couple of things that I’d like to change. The original Rogue didn’t have any options for the user to customize and I’d like to add a couple. Hopefully, by the end of this course, you’ll be able to program in your own features.

Who is this series for?

I’ve tried to make these articles as friendly for newcomers as possible but it’s not a language reference. There are already plenty of online tutorials and references that do a fine job of teaching C# basics. W3Schools has great references for C# and many other languages that will present the language in bite-size chunks and let you practice it right on their site. I’ll frequently reference their site and others if there’s something you need to be familiar with when going through one of the chapters in this course.

The idea behind this series is to learn how to actually use the language to build a fully-featured application using the best practices and techniques available to you. When I do talk about the basics, it will be in the context of building the application. Along the way, you will see many concepts and language features demonstrated and will hopefully get a better grasp on how to use the different parts of the language. Hopefully, over the course of this series, you’ll see the overall strategy and organization involved in planning and building a piece of software.

When I reference another programming resource, I strongly suggest you check it out and bookmark the site. Even as an experienced programmer, I frequently turn to Google for answers on how to use specific functions. With a language as large as C#, being able to research and find information is actually more important than memorizing the language.

If you get a couple chapters in and find you need something more basic first, check out the following and then come back and try again:

C# Fundamentals for Absolute Beginners

Wise Owl series on YouTube

What you need for this series

I’m developing this demo right here on where you’ll be able to follow it for free as I release new chapters. I originally envisioned it as a project where readers could code along with me and develop their own roguelike from the ground up. That proved to be impractical because of the amount of code involved and the ongoing development of the game. A single change or new feature can affect enough points in the project that expecting you as the reader to recreate all the changes would be unrealistic.

To get the most out of Rogue C#, you should first download the current source code from Github where I’ve made it available for your reference. You can also view it directly on the site if you would rather not download it.

If you’re not familiar with Github, it really is one of the first things you should learn as an aspiring software developer. In simplest terms, Git is a gigantic repository for source code and software projects. Developers of all kinds can upload their source code, track changes and allow other developers to share in the development effort. The Github website is the online graphical interface for the Git service. Check out the video below for more of an explanation.

To use the code, you should have already installed Visual Studio 2022 Community Edition or higher. The Community edition is a free installation from Microsoft and I’m using it myself so it has everything you’ll need to follow along.

Installing Visual Studio

After that, all you need is the time and commitment to read through the chapters and try things out for yourself. The first part of the course deals with the construction of the game map and, as far as possible, I provide step-by-step instructions on how to apply the settings and enter the code. There is a lot of code, however, and the later chapters tend to focus on explaining the algorithms and decision processes behind the development.

I still recommend that you create your own version of the game and follow along as much as possible. It’s also good to have an extra “sandbox” project where you can try things out without disrupting the main demo project. Every new function or code element you see is another tool that you can learn to use. You should pay close attention to the code samples and the explanations behind them and think of ways that you can try them on your own.

What this series is not

This series will help you learn the C# programming language using a single, large game project. Unlike a formal course, it will demonstrate language features as they can be applied in the project and not in a specific order.

  • This is a demonstration, not a systematic tutorial. I will present the basic parts of programming that every beginner should learn, either through the main project or as side explanations. I cannot promise that I will address every subject in C# that you might expect or to give them equal time.
  • Unless otherwise stated, the programming solutions I show are specific to this project and are not necessarily the best in all situations. This is especially true as I am replicating the look and feel of a 40-year old PC console game in a modern Windows Forms application. Any given challenge can be solved in a variety of ways with a language as rich and varied as C# and I emphasize my own solutions that will best accomplish the goals of the program.
  • Because I am developing the game and writing the chapters of this demo at the same time, It’s entirely possible that I will discover that something I did earlier in the series doesn’t work. Depending on the problem and its usefulness as a lesson, I will either go back and change the earlier chapter(s) or I will write it up as a change. If you find something in here that doesn’t work, please let me know.
  • The game developed in this project is inspired by the original Rogue DOS game but I don’t guarantee it will fit any specific “roguelike” or “roguelite” standard.

My goal in this series is to demonstrate the C# language and programming in a way that will enable you to carry on with your own projects afterward … and have fun doing it!

With that in mind, let’s get started.

Sign up for our newsletter to receive updates about new projects, including the upcoming book "Self-Guided SQL"!

We respect your privacy and will never share your information with third-parties. See our privacy policy for more information.