Newest Chapter
-
Rogue C# – Setting Player Inventory Limits

I’m getting closer to the point where I can add a SQLite database to hold the game data but I needed to get some bugs and issues out of the way first. I also needed to clarify the player’s inventory limits so I addressed that this week.
Welcome to my latest programming series – Rogue C#!
In these articles, we’ll work through the process of creating a role-playing game (RPG) in C# based on the classic game of Rogue. Throughout the chapters, I’ll show you the code and explain the ideas involved so you can follow along and customize your own roguelike game and gain experience solving problems in C#.
Beyond being simply a game project, this series covers a wide range of C# skills, including …
- Object-oriented programming
- Game loops and application flow control
- Collections, lists, and data management
- Dungeon and procedural map generation
- Turn-based game mechanics
- Refactoring and code organization
- Debugging and troubleshooting techniques
- Event-driven programming concepts
- File handling and persistent game data
- User interface design
On this page, you’ll find links to all the chapters along with supporting information, resources and updates on the progress of the project itself.
For the latest progress on the game, check out the official requirements page!
Download the Code
The latest code for the project can be found on Github.
https://github.com/ajcomeau/RogueGameDev

Table of Contents
View the latest chapters by selecting the Rogue C# Series category from the categories list or check out the entire series from the beginning here.
- Rogue C# – Setting Player Inventory LimitsI’m getting closer to the point where I can add a SQLite database to hold the game data but I needed to get some bugs and issues out of the way first. I also needed to clarify the player’s inventory limits so I addressed that this week.
- Rogue C# – Throwing and Casting WeaponsAfter taking a bit of a break from the game project, I decided to add the rest of the inventory and add throwing and casting attacks. In the process, I got another quick lesson in object-oriented programming.
- Rogue C# – A Few Odd RepairsThis week, I’m taking care of some general fixes and looking at ways to improve the codebase and keep things maintainable around the place. As a bonus, I discovered helper functions in C#.
- Rogue C# – The Other Rings of PowerRings are actually one of my least used items in my playing of the classic Rogue. They tend to be risky as they increase food consumption and a cursed ring just won’t come off. Still, they’re part of the game and a great challenge for this project so I decided to add them to the inventory list.
- Rogue C# – The Monsters EvolveHappily, the remaining traps to my roguelike game did not break anything new in the code; I was able to build on existing resources already in the classes. I also reorganized some code, clearing the deck for the addition of monster special attacks and upcoming inventory additions.
- Rogue C# – Rethinking Random SelectionAfter adding all those potions in one shot, they still had to be tested and every single one exposed something that needed to be improved in the code. The sheer number of fixes would be too long for this post but I did come up with a few interesting examples.
- Rogue C# – The Dungeon PharmacopeiaPotions are much like scrolls but every new effect potentially requires supporting changes elsewhere, including new properties and changes to game play. In this chapter, I sample all the potions and see how many ways I can break the code.
- Rogue C# – The Ever-Changing Program FlowAs a program grows, it’s important to maintain standards and practices within the code. Classes and methods need clear lines of responsibility and operation in order to keep the code maintainable and reduce errors.
- Rogue C# – Setting TrapsTraps add to the challenge of the game, even if they are annoying sometimes. In this chapter, I add them to the game and discover that the player and monsters have more in common than they know.
- Rogue C# – Don’t Confuse the Monsters!During the rescue of the Rogue C# project, I’ve seen some examples of things that weren’t quite thought out the first time around but the MoveMonster() function might have been a case of over-thinking … or of just really needing to walk away for a bit.
- Rogue C# – Coding Scrolls for Fun and ProfitNot all scrolls and potions are helpful in a roguelike but that’s part of the fun … more or less. In this update, I add a mix of scrolls including Remove Curse, a frustratingly rare item that you’ll want after putting on the wrong armor and Aggravate Monsters which wil make your life on the level a lot more exciting. As before, every new scroll leads to a re-examination of the code.
- Rogue C# – Designing Power-ups into the GameThe Scroll of Confuse Monster is a scroll that gives the player the power to confuse the next monster they attack for a certain number of turns and then the monster’s confusion lasts a certain number of turns so there are multiple steps to tackle here.
- Rogue C# – Chasing Bugs Off the MapIn this chapter, I do some important code review of the MapLevel class which manages map construction and functions within the game. I also track down a few more bugs and look at some testing strategies specific to this roguelike game. Finally, I show how bugs can be accidently introduced through otherwise well-meaning code maintenance.
- Rogue C# – Taking InventoryIt’s time to add more inventory items but first we need a way to define their abilities without getting lost in the code.
- Rogue C# – Getting a Handle on Key CommandsThe method for processing user commands was getting out of control so I decided on some creative use of the Dictionary class to automate things.
- Rogue C# – How Much Public Access is Too Much?In this chapter, I review the access modifiers available in C# and how they affect where properties and procedures can be accessed in the code.
- Rogue C# – The Process Must FlowIn the latest chapter, a flowchart of the Game startup process points me to a problem assigning inventory to the player.
- Rogue C# – Creating an App with ClassThe classes in the Rogue C# code were developed over time and I decided an important part of the project rescue was to look them over and see who was talking to whom.
- Rogue C# – Flowcharting the Map Creation ProcessWhile quality code should be well-commented and easy to follow, sometimes you need other types of documentation to actually see the shape of a process. In this chapter, I flowchart the map creation process and find ways to improve the code.
- Rogue C# – Going Back to the RequirementsIn this chapter, we’re going back to the official list of requirements for our Roguelike and expanding them to cover the game from start to finish.
- Rogue C# – Better Graphics through the TextRenderer ClassIn this update, I’m ditching the monochrome map and adding some color graphics on the map with text drawing via the TextRenderer class.
- Rogue C# – Dungeon Search and RescueIt’s been a few years since the last report from the Rogue C# project and the dungeon retains its mysteries. Time to dust off the project notes and find what awaits discovery.
- Rogue C# – Adding Scrolls and PotionsComing back around to the inventory side of the game, I decided to add some extra variety to the available items, starting with the scrolls and potions.
- Rogue C# – A Few Random UpdatesFor this update, I decided to knock out a couple of quick features – the Play Again feature and the spawning of new monsters mid-level. A couple of bugs got squashed along the way.
- Rogue C# – Building on the FoundationThe game has a solid foundation and now we start building on it. There are still a lot of features to finish and bugs to work out along the way, especially the individual inventory items that will help the player survive in the dungeons.
- Rogue C# – The Monsters Strike BackAfter cleaning up from the program refactoring, I decided to complete the programming on the player stats. Then things got real when the monsters started fighting back.
- Rogue C# – The Monster ShuffleEvolution is often a difficult process and our program is definitely evolving. In this chapter, we bring the monsters to life and deal with a major refactoring of code as the need to store data increases.
- Rogue C# – Building the Monster ClassNow that we have some requirements for the monsters, it’s time to build the class and add a few new guests to the dungeon. As always, building the class requires some serious attention to detail.
- Rogue C# – “Here there be monsters.”It’s a bit lonely in this dungeon game so it’s time to add some monsters and there’s a lot more to it than you’d think. In this chapter, I detail some of what’s involved in adding opponents to our roguelike.
- Rogue C# – Inventory RevisitedBefore we can introduce monsters and fights to the game, the player needs some items such as weapons in inventory. It’s time to test some of the theory the Inventory class is built on.
- Rogue C# – Speed it up!Fast Play mode lets the player zip around the map without having to press the direction keys for every space but each space still equals one turn. In this chapter, we code for that and a couple other odds and ends.
- Rogue C# – “A mango a day …”Food is one of the most important items that you look for on the map so it’s appropriate that food be the first inventory item that we implement in our roguelike game. In this chapter, I’ll demonstrate how the player’s level of hunger can be managed and write the function that will allow the player to consume food and keep going.
- Rogue C# – Displaying and Selecting InventoryIn addition to collecting inventory, the player needs to be able to view their inventory and manage its contents so they can have the specific items they need. We also need a way to display other screens and come back to the map when needed.
- Rogue C# – Building the InventoryThe inventory items have a complete cycle throughout this game, depending on the item, and each step has to be coded so that the inventory exists and is managed just like inventory items would be in real life. Every part of the program will be affected in some way.
- Rogue C# – The Inventory ClassNow we need inventory collection in the game, starting with food. We need a system in place for collecting and managing not only food but all the other collectibles such as armor, weapons and potions which often have different requirements.
- Rogue C# – Turns and CheatcodesRole-playing games are often turn-based; your character performs an action and then all the other characters and opponents get their turn. For this reason, managing the turns is essential to the game and that’s what we’re looking at in this chapter.
- Rogue C# – First Project ReviewIn this chapter, I want to review what we’ve done so far in this series to show how everything has contributed and where it’s going from here so you’ll have a better understanding of how an application grows.
- Rogue C# – Hidden DoorwaysHidden doorways and passages are one of the challenges in many games and Rogue is no exception. It makes the game a little more challenging and stretches out the game experience, too. In this chapter, we’ll see how to add hidden doorways to our own roguelike.
- Coding the “Fog of War”The “fog of war” is an important feature for adding challenge and mystery to a game as the player must gradually discover new territory and whatever surprises are there. It’s also a challenging feature to code.
- Rogue C# – Leveling UpRogue is a game in which the player moves through many levels to their ultimate goal. In this chapter, we add this feature to our own game.
- Rogue C# – Searching Arrays with LINQLINQ is a powerful feature that enables the program to search collections of data in much the same way that SQL searches databases. This chapter shows the basics and how they can be used in the program.
- Rogue C# – Wandering the MapNow that the program can respond to different keys, it’s time to let the player start wandering the map. This chapter shows one way of doing this while making sure the player stays within the right boundaries.
- Rogue C# – Responding to Key EventsOne of the recognizable features of the original Rogue game was the long list of key commands that the player used for all actions, including eating, searching and using objects. Now we’ll see how we can implement those in our own roguelike.
- Rogue C# – Gold RushAt this point, our game can generate a random map and there are classes to control the game itself and define a player. Now I want to spread some gold around the rooms for the player to collect. In the process, we’ll be making some improvements to how the program handles Random values.
- Rogue C# – Building the Class StructurePrograms often use multiple classes that work together to provide structure to the program. In this chapter, we’ll expand our roguelike with the new Game and Player classes.
- Rogue C# – Verifying the Game MapWhat do you do when no algorithm seems to work without problems? In this chapter, we’ll see how not every problem is solved in a straight line and how some can be solved in phases.
- Rogue C# – Connecting Rooms on the Game MapCompleting the hallways on a roguelike map is one of the most challenging parts of the game and it goes back to the importance of the right algorithm that will teach the computer to do what you take for granted.
- Rogue C# – Concatenation and the StringBuilderString manipulation is a common task in programming and C# has a couple of different methods for performing large numbers of edits to a selection of text. In this chapter, we’ll compare them and see how efficient the StringBuilder class actually is.
- Rogue C# – Enumerations and DictionariesWe need just a little bit of supporting code to actually plot the rooms on the map. In this chapter, you’ll see examples of enumerations and dictionaries in C#. You’ll also see a way to check a char value against many others at once.
- Rogue C# – Creating the Map RoomsRoguelike maps are made up of a network of rooms and the algorithm for creating the individual rooms is important. In this chapter, we’ll look at the use of loops and arrays in maintaining our network of dungeon rooms.
- Rogue C# – Class Properties and ConstructorsProperties and constructors are basic elements of C# classes and this chapter shows examples of how they’ll be used to describe and create maps in the program.
- Rogue C# – Using ConstantsConstants enable us to store values that will be used in the program and give them context within the code. Constants will be used heavily in our roguelike game and this chapter shows how they can be used to construct the map.
- Rogue C# – Working with Classes and ObjectsObject Oriented Programming (OOP) is an important concept to understand for programmers of any language. In this chapter, we look at the basics of OOP and add the MapLevel class to our project.
- Rogue C# – AlgorithmsAs we start writing the code to generate the dungeon maps, we need a solid algorithm that will reliably create rooms and link them together.
- Rogue C# – Form Controls and PropertiesVisual Studio provides a wealth of controls that you can use in Windows Forms apps including buttons, text boxes and combo boxes. In this chapter, we’ll add a few basic controls to the project to display the game output.
- Rogue C# – Creating the Game Project in Visual StudioEvery program has a starting point and ours will begin with the creation of the Windows Forms project which will be the basis of our game. In this chapter, we also look at the basics of C# and .NET.
- Rogue C# – Working with ASCII GraphicsThe original Rogue game relied heavily on ASCII graphics. This chapter is an overview of ASCII and Unicode and how it’s still used.
- Rogue C# – Writing Software Requirements for a Roguelike GameDetermining the requirements for a program is an important first step in writing any software. In this chapter, we look at the basic requirements for a roguelike and how closely this version will match the original.
- Rogue C# – Choosing a Programming LanguageThe question of what programming language to learn is a common one for beginners. Here are a couple things to consider when starting out.
- New Tutorial Series – Rogue C#An introduction to the Rogue C# series in which we’ll be designing a roguelike game closely based on the original Rogue and exploring how an application is designed from start to finish.
Get the offline edition in PDF or on your Kindle!
January 2026: The Rogue C# series is now available for download in PDF, EPUB and Kindle format! You can find this offline edition on LeanPub.com and Amazon.com.
This offline edition includes all the content from the original 2023 series in one file for convenient offline reading. The downloadable edition also contains a detailed Table of Contents and each chapter is linked back to the original articles for access to more resources and future updates.
