Working with ASCII Graphics in C#

With most programs, the choice of how to display information for the user is critical for making the program useful and accessible. Display technologies and options have changed greatly since the 1980s when Rogue was originally released. This version of the game maintains the original look and feel as much as possible both as a tribute to the original and to keep the focus on the use of the C# language itself. For this reason, it’s important to understand more about the use of ASCII and how it has evolved over the past few decades.

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 little history …

In 1980, when Rogue was first designed, the world of computers was largely non-graphical. If you went into a computer lab, you would see rows of green (or amber) monochrome, monospaced text displays.  Even IBM’s CGA graphics, which would provide a stunning 16 colors for limited resolutions, wouldn’t be available until the following year.

So, if you wanted graphics for your game or program, you needed to work them out from whatever characters were available.  This character set was known as ASCII which is short for American Standard Code for Information Interchange and it had been around since the 1960s when it had been developed from telegraph code.

At that time, ASCII contained 128 characters for display on the screen along with some control characters and a bell or “beep” character.  That character played through the basic speakers available on some computers in the early 80s.  (There were no sound cards, either.)

Each ASCII character had a corresponding numeric code between 0 and 127 and each of these codes could be represented directly in binary which is still the language that computers understand to this day.  So, a capital “A” had an ASCII code of 65 which then became 01000001 in binary (lowercase letters started at 97 with “a” or 01100001 in binary).

All of these codes were eventually accepted as the first 128 characters in Unicode which is now the standard for representing text on modern computers.  In this way, Unicode remained backward-compatible with ASCII.

The 1980 version of Rogue used characters from the original set in order to represent the dungeon and its contents.

 BSD version of Rogue from 1980 (Courtesy of Wikimedia Commons)

Drawing boxes

When the IBM PC was introduced, it used a character set called Code Page 437 (CP437). This set included the 128 ASCII characters plus accented characters that would accommodate other languages such as Spanish, commonly used letters from the Greek alphabet such as Σ, mathematical symbols and an entire subset of box drawing symbols. There were now 256 characters – as many as one byte of data could represent; the ASCII code 255 (the delete or backspace control character) would be represented in binary as 11111111, the maximum binary value for eight bits or one byte.

The box drawing symbols were an important step in computer graphics at the time because they could be used with the monospace font common to these displays to draw continuous horizontal and vertical lines on the screen. These lines could create boxes and tables and the boxes could be filled in with characters that were basically shaded or solid boxes themselves.

These characters are still available to such applications as Word and Visual Studio so that you can still create text graphics like this:

ASCII graphics would become an art form all its own with much more sophisticated examples than the one above but, meanwhile, Rogue got a facelift when it was ported to the IBM PC with its extended character set and 16 color graphics.


Over the years, as the computer revolution continued, the standards were expanded to accommodate languages and writing systems from around the world. As of September 2022, the current Unicode standard contains over 149,000 characters including modern and historic languages. It also retains all the original characters, including those for box drawing.

Of course, today’s graphics allow for a lot more flexibility without having to construct things from text characters. They also take up a lot more space in memory and on disk and require more complex programming. There have been a lot of roguelike games over the years and many have used graphical tiles to represent walls, monsters and other game elements. For this tutorial, I’ve chosen to keep the original ASCII character set in order to capture the feeling of the original game and to keep the focus on the C# language itself rather than the sophistication of the graphics.

Exploring Further

Earlier in the chapter, I mentioned how ASCII characters all have numeric values that translate into binary. The binary numbering system is one of the first things that many programmers and computer science students learn. As a programmer, you won’t really spend any time translating information in and out of binary code but knowing how to read binary and understanding how the system works supports other operations such as bitwise operations which are sometimes used as a faster way to perform multiplication and division. Understanding the binary Base-2 system is also key to understanding the hexadecimal Base-16 numbering system which is used in memory addressing and color codes.

At some point, I’ll include a chapter on both of these systems as part of this series. For now, I the following links should give you a good introduction.

Lifewire – How to Read Binary

MathsIsFun – Hexadecimals

Next –

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.