Secret & Safe: A Look At Codes and Spies For Fantasy Games

The history of espionage, even in the Classical or Medieval or Renaissance periods that so frequently inspire elements of fantasy settings, is enormous and deep. It’s also probably filled with holes in information, because so many resources were probably destroyed or lost due to their covert nature.

So, if you plan to use spies and coded messages in your game, how can you turn those story elements into challenges or hooks for player characters?

Below are a few brief thoughts on the form that spies might take, along with notes on how they might be treated, and a few example methods for passing secret information that could be slipped into any game.

Traitor, Agent, Smuggler, Spy

An agent is someone who loyally serves their true and proper allegiance, even when it means deceiving others. A spy is someone who treacherously turns on their word and trusting acquaintances, even when it is dishonorable to do so.

It’s all about which side you’re standing on, though usually the discussion is really only important when the side that is more likely to call someone a spy is deciding what to do with them. Historically? Things did not go very well for anyone who was captured and found to be a spy. Usually it was a matter of death, and the only question was just how painful your exit from the world was going to be. Those of the upper tiers of society – or those who were particularly important for other reasons – might find themselves imprisoned, exiled, ransomed, or turned against their original handlers (though, in times of war, they were often treated like your more common spy).

One way of thinking about the types of spies, and which can help you figure out what motivates a spy or how characters might interact with them, is using Sun Tzu’s five classes:

Local Spies – People who live in the region you are looking for information on – or who use those people as a resource – and can be persuaded to gather or pass that basic information on to you. This isn’t usually a risky proposition for anyone involved unless there is an imminent attack or ongoing war, in which case not only will it sometimes be more difficult to gather important details but those in power will become very interested in where their enemy got such information. Smugglers, merchants, couriers, and others could all fit this description.

Inward Spies – Enemy officials or citizens who have influence and a reason to turn on their home or cause. These are highly placed members of court that have suffered a humiliation or demotion, greedy paramours that have access to leaders, criminals who’ve been harshly punished, and so on. They’re usually kept at arm’s length and aren’t so much turned to your cause as seeking to feel important or serve their own needs by passing along information.

Converted Spies – These are double-agents, people who seem to be serving the cause of an enemy but are actually doing whatever their handler can convince them to take on for the opposition. These spies are highly prized but also some of the least trustworthy, not only because they are traitors once already but because they are aware of their new employer’s plans or needs to some extent. Historically, from the time of Sun Tzu to the time of George Washington and into the modern day, those who employ these spies will usually seek to keep them well-compensated under normal circumstances and then grab extra leverage – such as kidnapping family members – when they take on extremely sensitive assignments.

Doomed Spies – This is something of a situational category, because it represents spies who are intentionally exposed or given false information to pass along, in order to mislead the enemy. So if a converted spy is suspected of becoming a triple agent – also known as returning to their original allegiance – they might be given information that will hurt their cause (which would usually also result in their death), or maybe they will be given false information and then be intentionally outed by another spy – or given an assignment that’s sure to lead to their capture – with the expectation that the enemy will end up with bad intelligence it’s more likely to believe because it was gathered “the hard way.”

Surviving Spies – These are the people who are sent to intentionally infiltrate the enemy lands, camps, and other secure places in order to gather sensitive information… and make it back. They’re what most people think of when they conjure up an image of a spy, and were described by scholar Tu Mu as:

“[A] man of keen intellect, though in outward appearance a fool; of shabby exterior, but with a will of iron. He must be active, robust, endowed with physical strength and courage; thoroughly accustomed to all sorts of dirty work, able to endure hunger and cold, and to put up with shame and ignominy.”

“Surviving spies” were also the ones that ran the widest gamut of activities; destroying infrastructures, sabotaging enemy works, ranging behind enemy lines in disguise, and more. Any of which could get them killed.

Throughout history there have been spy networks, made up of some or all of these, and understanding the motivations of or relationships with the different types of spies can tell you more about why that traitor is turning on the king or how the enemy knew where exactly the heroes were going to be (which helps when the heroes start asking that very question).

More Cloak Than Dagger

But what about keeping information secret? When an intercepted message could be the loss of a spy, the end of an advantage, or the opportunity for an enemy to leap several steps ahead of you… how do you make sure that doesn’t happen?

Well, in real life these methods varied greatly and some were far more secure than others, especially when dedicated court cryptanalysts started to become common in the early 1500s. That said, not only should each of these potential forms of hiding information be something that can add flavor to any game involving espionage, they can also provide goals for characters and puzzles for players as the case may be.

One-Time Pads – Sometimes called “code books” or the like, these are a matching set of small books with a different code on each page; one book provides the method of encoding the message, the other provides the key to unlocking messages generated by that method. Each page is destroyed after it is used. This is going to be a generally very secure method of passing information, but also has a few weaknesses because they have a limited number of uses before someone has to supply a new book and it’s possible for the two books to get out of sync.

The Ceasar Shift Cipher – An incredibly basic type of cipher, it involves shifting the letters of the alphabet by a certain amount and then writing your message using this new arrangement. For example:

Which would turn "Attack!" into "Dwwdn!"

Of course the problem there is that it only has 25 possible keys. If you were willing to rearrange the entire alphabet it would give you an astronomically higher number of potential keys, though.

Scytale, or Rod Transposition – Dating back to 500BC, this is a relatively simple trick for passing information because it involves both hiding the message and requires a key. A leather thong or belt is wound around a rod or other cylindrical object with particular dimensions & characteristics (often the scytale had a number of flat sides), the message is inscribed on the leather in a normal fashion, and then the leather item is worn or hidden. If someone who does not have a rod with the same dimensions, which would allow them to wind and read it properly, captures the message they are left with a strip that has random letters written on it.

Steganography – This is actually a huge category, covering hiding messages rather than encoding them, but I will mention two particular approaches that were used in history.

One is the hiding of messages in drawings or letters, where the creator of the works and the recipient both know that certain imagery or ways of writing certain letters mean different things. A code where various plants and animals, or the use of colors in certain parts of a painting, could mean specific things is easy to imagine… but consider the possibility of an arrangement where whether the cross-bar in a “t” touches the letters beside it or the tilt of the peak on a capital “A” are themselves part of a code.

Two is the hiding of messages in something as simple as the form of a gift. The most famous example is a man who was often asked to provide introductions to powerful people, and would provide the person asking with a card which indicated he vouched for them. It just so happened that the shape of the corners, the color of the paper, the arrangement of the border, the way he wrote their name, etc. all stood for a certain bit of information about them he was secretly causing them to pass along to his contacts. They would take the card, visit the contact, the card would be taken to the contact by servants, and suddenly an important person would know everything about the person who was bearing it (including whether they should be put under immediate surveillance). This principle can take many different forms in a D&D game, down to the coins the adventurers spend telling local merchants how exactly the coin was earned.

Rail Fence Cipher – This is one that makes for an interesting puzzle if kept simple, and for a really difficult nut to crack if it is combined with a Ceasar Shift or more complicated ciphers. The key is the number of lines the message is broken up into, and then the letters are written in a zig-zag pattern across that many lines, before being collapsed back into one line by reading along the rows.

It’s best described by example:

"Defend the castle from attack" with a key of 4
d . . . . . t . . . . . t . . . . . m . . . . . k 
. e . . . d . h . . . s . l . . . o . a . . . c . 
. . f . n . . . e . a . . . e . r . . . t . a . . 
. . . e . . . . . c . . . . . f . . . . . t . . . 

Which becomes: dttmkedhsloacfneaertaecft

Of Course, There Are More

I could go on with these all day long, especially if I wanted to try and get the formatting down well enough to give examples of Pigpen Cipher or Vigenère Table, but at this point you may be wondering what exactly this does for your games if you are not planning on presenting players with puzzles or don’t care about the history of espionage.

Consider this: Critical information, cipher keys, scytale rods, one-time pads, and the identities of spies are all things that people would kill for when the stakes are high enough. These aren’t just tools that a player or DM can pull out to add flavor or show off specialized knowledge, these are tools for building goals for the characters or tools for their enemies (which can be disrupted or subverted by the ambitious).

Or they can just make for some interesting in-game items that are worth a pretty penny.

There’s also the fact that just having this sort of knowledge, let alone a set of one-time pads or a captured missive, can be valuable; in 1506 a man named Giovanni Soro became such a famous cryptanalyst that lords from all over Italy – even the Vatican – sent him codes to break or had him test the security of their own, while centuries later British Lieutenant General Thomas Gage  – head of British forces in North America – found himself facing down a potential rebellion and no one on his staff had access to a single secure cipher for confidential correspondences.

In the end it all comes down to your game, but spies are everywhere and secrets have a way of spreading around…


Comments are closed.

Create a website or blog at

Up ↑

%d bloggers like this: