Rogue C# Series

Coding the “Fog of War”

The fog of war is a feature common to many games that use any kind of map. It’s much more interesting when your player has to gradually discover territory than when it’s presented all at once. You never really know what your opponents are cooking up in those areas...

Rogue C# – Leveling Up

At this point, our roguelike game is taking shape. We have a Game class to generate game maps, a Player class to handle the player information and a Game class to oversee them both. This game needs to progress through many levels, though, and there has to be an...

Searching a C# Array with LINQ

In the last chapter, we added some extra detail to our roguelike game map by specifying separate class properties for the map elements, the items on the map and the characters walking the map. This will actually make searching the map easier. In the classic Rogue game, there are...

Rogue C# – Wandering the Map

In the last post, I showed you how to work with key events in C# and got the program responding to the four directional keys, even if it was only to say they were pressed. Now, it’s time to add the player to our roguelike map and send him...

Responding to Key Events in C#

One of the recognizable features of the original Rogue game was the long list of key commands that the player used for all actions, from the arrow keys for movement to “i” for inventory, “r” for reading a scroll and “q” for quaffing a potion. On a console-based game...

Rogue C# – Gold Rush

If you work as a programmer, you’ll often find yourself adding features to existing software that someone else created. This means getting familiar with the code and making selective changes in a way that won’t disrupt anything else. As this project grows, you’ll see more and more of this...

Rogue C# – Building the Class Structure

Now that we can consistently generate a roguelike game map, it’s time to make that map part of a larger game and we need a couple more classes. First, a Game class will manage the process of the game itself, which is pretty extensive and then a Player class...

Rogue C# – Verifying the Game Map

If you’ve read the previous chapters in this series, the process of creating a roguelike map has probably seemed like a long one but, along the way, you’ve seen demonstrations of many features in C# code. In this chapter, we’ll finish the map generation and look at using the...

Connecting Rooms on the Game Map

Completing the hallways on a roguelike map is one of the most challenging parts of the game and it goes back to what I said in an earlier chapter about teaching the computer to do what you take for granted. The program cannot see and interpret the map at...

Concatenation and the StringBuilder Class

Now that we have the beginnings of a game map, it’s time to see the output. In fact, the next step of generating the hallways would have been impossible without being able to debug them as they were being completed. In this chapter, we’ll look at how to output...