Rogue C# – Verifying the Game Map
What 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.
Because technology should be the means, not the end.
Your mind will take the shape of what you frequently hold in thought, for the human spirit is colored by such impressions.
Marcus Aurelius
What 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.
Completing 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.
String 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.
We 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.
Roguelike 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.
Properties 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.
Constants 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.
Object 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.
As we start writing the code to generate the dungeon maps, we need a solid algorithm that will reliably create rooms and link them together.
Visual 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.