Magic As Programming

Magic exists in almost every fantasy world out there. In some worlds magic is scarce and feared, while in others it is ubiquitous and commonplace. However the archetype of a wizard in most fantasy settings is modeled after medieval alchemists and mystics who had no supernatural powers. Magicians who existed in our universe did not use magic but science, trickery and ignorance of others to raise to notoriety. Thus it’s no wonder that most of them were reclusive and secretive, and that they hoarded, and guarded their arcane lore from everyone save for trusted apprentices. That’s because they had no power, and their position and status depended on cultivating the mystery around their practices.

wizrd-1.jpg

In an universe where magic is real there would be no reason to assume the same secretive mode. After all wizard are scholars and they stand to benefit from free exchange of knowledge much more than craftsman guilds who jealously guarded their trade secrets. I think the best parallel to magic we have today is software. Yeah, don’t laugh. Just like magical spells software has no physical form. It is a thought – an abstract idea bound by human will to accomplish certain task. Thus, I imagine that one could draw parallels between a wizard and a software developer with the respect to how they work.

For example, I imagine that there would exist magical algorithms. For example, there might be a thousand different ways to form a fireball but only some of them are efficient with respect to casting time, energy consumption and the relative power of the spell. Someone probably figured that out long time ago and most wizards just re-use that algorithm. Naturally every rookie designs his own fireball spell early on, but it is usually as efficient as bubble sort. I’m sure there would be many wizards swearing by their own version of particular spell just like there are developers who insist on reinventing the wheel for every single project.

Fortunately we do have a body of knowledge to draw upon, and we are able to build upon the shoulders of giants. You need to sort stuff? You use quick sort or merge sort as needed. You need a fireball? You use thermal Sir Jeffrey’s Conflagration and Roderigo’s Fast Projectile. Or something like that – you can probably see where I’m going with this. I can’t imagine something as complex as magic to work any differently. Especially in a world where it is not that rare, there must be an academic movement dedicated to open exchange of knowledge.

Usually you see Wizard casting spells using recited formulas and gestures. In most cases saying “hocus pocus” however is not enough since wizards need to learn how to channel the energy for the spell and etc. I imagine that these words and gestures are usually mnemonics that wizards train to be able to cast spells on the fly. They don’t have hardware on which they could compile their spell and then run it, so they use these mental shortcuts. The actual magic would probably be done by keeping series of abstract symbols of power (complex multi-dimensional structures impossible to write down on paper) in mind and channeling energy through them. Wizards would memorize these symbols in groups, each bound to certain syllables or gestures. Then performing that gesture would trigger memory of the true symbols and thus execute the spells. Obviously this concept is probably not compatible with all settings but it sort of makes sense to me.

A side effect of such a setup would be existence of many different mnemonic systems – or spell casting languages of sorts. Some of them would be more abstract combining longer chains but creating short and easy to cast spells. Others very low level, allowing the wizard control over many variables when casting at the cost of a longer, more cumbersome recitation. There would be arguments on which system is best, and fads among wizards to use one over the others. You know – just like we have now with programming languages.

Naturally there would be proprietary magic too. This goes without saying. There would be wizards working in secret on proprietary spells that would give them competitive advantage over the others. They would still use the same algorithms, and their “code” could still leak out just like with software. Also, they probably wouldn’t be able to sell “spells” because they could be easily reverse-engineered. Instead I’d imagine that proprietary market would invest into producing magical commodities. They would be making magical items bestowing supernatural powers upon the owner, scrolls that would allow anyone cast complex spells set number of times before crumbling or bound spell items with set or renewable number of charges.

red_wizard.jpg

Special group of magical items would probably be wizard arcana – stuff like magical staffs and wands. I’d imagine that rather than hold specific bound spell, or confer a magical buff upon the users these tools would carry a spell-writers toolkit. I think of them as the IDE’s of magic users – they would make casting spells faster and more convenient to the point where some wizards would be helpless without them. They’d probably have common incantations bound to them, and perhaps they would allow you to slot custom spells onto them as you go. So casting a fireball would be as easy as triggering the 4′th and 6′th slot on your staff. Each wizard would be carrying their customized toolkit of their favorite magical “libraries”, macros and algorithms they could weave into their magic.

Or something among those lines. I’d see these items as useful productivity tools most wizards would want to have, but not necessarily need. They could still cast spells without their staff, or wand but they would be slower at it.

Finally, it would not be out of question to see an “open source magic” movement to develop. Note that most branches of science strive for open exchange of ideas. But whenever there is a significant amount of money to be made on new discoveries or implementations proprietary interest may attempt to hinder this process. It is much more profitable to maintain a trade secret for many years and build a market monopoly than to release your discoveries and then compete with everyone else who decides to use it. It is likely that magic would follow the same pattern. Major guilds and/or Wizard societies would maintain secrecy and teach their signature spells only to trusted members. They would sell the popular spells bound to items, or as one-use scrolls or as a service (ie. if you need it, they will send a Wizard to cast it for you).

Just like in our world the response to dominance of proprietary magic on the market would be creation of a movement dedicated to open exchange of ideas and re-implementation of popular applications. There would be wizards re-implementing the popular proprietary spells from scratch creating free and open alternatives. So if you don’t want to pay for that bound Haste spell, you can potentially learn “Quicken” spell that has a similar effect but perhaps it may lack some of the fine tuned optimization of it’s proprietary counterpart.

Why no one ever portrays magic this way? Probably because few fantasy writers have computer science background and thus they may not see these parallels. Also, the traditional, established fantasy canon is familiar to the readers and easy to understand and relate to. This alternative look at magic may be interesting concept to us (you know, computer geeks) but that’s only because we understand software. Normal people don’t – to them, software is like magic. Explaining magic through another abstract system that is “just like magic” is probably not the best idea.

Still, if you often play with bunch of programmers or engineers (both are common career choices among RPG enthusiast btw) in a magic-intensive setting it could be a fun to draw this parallel in one way or another. It actually could be an interesting idea for a campaign background for a company composed solely of spell casters.

Update 10/30/2008 12:29:43 AM

Someone suggested that I ought to pick up Ars Magica. It offers an interesting combinatorial verb-noun mechanic for constructing your own spells. It’s not as complex as what I described above but it’s still pretty cool.

This entry was posted in rpg and tabletop. Bookmark the permalink.



8 Responses to Magic As Programming

  1. Alphast NETHERLANDS Mozilla Firefox Ubuntu Linux Terminalist says:

    This is the most hilarious cross over post EVAR…! And again, I agree with you nearly 100%. This said, as you mentioned it yourself in the beginning, some set up will have difficulties to implement this. I am thinking mainly about all settings were magicians are more channelers than actual spell casters. Unfortunately, my favorite RPG (L5R Rokugan) belongs to this category. With the rare exceptions of some exotic types of magic (Burning Sand), magic in Rokugan is exclusively done through prayers to the “kami”, Japanese style elemental spirits, who are the ones actually doing the spell for you.

    Reply  |  Quote
  2. astine UNITED STATES Google Chrome Windows says:

    Been watching SICPlectures?

    Reply  |  Quote
  3. Luke Maciak UNITED STATES Mozilla Firefox Ubuntu Linux Terminalist says:

    @Alphast: I never played L5R but I think we discussed it before on this blog. But you’re right – it seems to be a very different type of magic. I guess any magic which is based on “asking favors” from supernatural beings or binding those beings to do your work would not be easily comparable to software.

    @astine: Nope, but now that you mentioned them I’m gonna go and watch. :)

    Reply  |  Quote
  4. Alphast NETHERLANDS Mozilla Firefox Ubuntu Linux Terminalist says:

    True. This said, you could probably compare it to working with consultants… ;-)

    Reply  |  Quote
  5. Oliver UNITED STATES Google Chrome Windows says:

    This idea has been thought of before, I for one have thought of them as well. Read Rick Cook’s books…. (Wizardry Compiled and other books in that series…)

    Reply  |  Quote
  6. Fernando BRAZIL Mozilla Firefox Windows says:

    This is so cool. Recently I was thinking about a way to portray spell casting “realistically” and I also thought of programming as a way to do that . What is interesting is how many stuff I thought was the same as what you wrote here.

    Stuff like re-usable “engines” that facilitate spell casting, chanting and magic words as a mnemonics system, mages creating spell casting languages, staves and other items being used to assist the spell casting routines.

    Reply  |  Quote
  7. Rickshaw_Watcher UNITED STATES Internet Explorer Windows says:

    The Maciak Theory
    The idea that any effect can be achieved magically (including a fireball or teleportation) by using the same universal language of symbols and sylablles for all spells.

    I am so going to use this.

    Reply  |  Quote

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>