Ascii Art

Descriptions can fail us. They can fall flat in tone, they can leave us wanting depth and sometimes even the best cannot convey that feeling we are striving for. To get that quirky, scary, mysterious, all over otherwise impactful atmosphere in a text based game at some point you may want to consider ascii art.

What is it?

Ascii art is quite simply art made using the printable characters in the ASCII character set to create a picture. Its got a unique style and can be a good choice for delivering basic visuals in a game or interface.

Ascii art can be relatively simple like these flowers:

To drawings that are a bit more complex like this aardvark

By the way if you want to find more art like the examples above head over to The Ascii Art Archive they have a bunch of cool art to reference.

Ascii and Python

Ok cool we made the decision to include some art in a new python game, we are going to be in a library we want to print out a bunch of books like below

looks cool right? so lets just plug it into a print function under a new method

aaaand error

Its directing us back to line 8 but if you look at the ascii art itself in the print statement the problem should become apparent. Lots of art includes quotation marks not to mention other symbols that can be difficult to display or otherwise mess with our program. We can of course just change the art so that it doesn’t use quotes but its really common and quite annoying to escape all of those characters.

print(r””” “””)

This function is our new friend. It prints the raw input until it hits triple quotes. If we throw this around our books it will accomidate everything but triple quotes as those will close the statement. As it stands it almost works but we will have to make a tiny edit to the C# book

We turned the triple quotes “”” on the spine of C# into double single double “‘”. As long as we don’t have triple quotes of the same type the input will keep printing so we have a very visually similar edit.

The End Result

Look at that our very own virtual computer science library. That’s a cooler selection menu than “Enter Y/N” if I do say so myself.

Project Announcement!

If you like ascii art and mysterious mansions I can’t wait to share the game I have been working on with my fellow class mates. Introducing:

An interactive fiction detective story where you, an Ace detective with amnesia set out to discover who you are, how you got here, and if you can escape alive.