Programmer Spells: The Two-Ton Punch

I’ve spoken a bit about how spells would work in my world, but for a long time I’ve struggled to figure out the details of the nuts-and-bolts mechanics. I’ve drawn inspiration for my spells from computer coding, but I don’t know how to code or the syntax of any programming languages. So with that in mind, I decided to do some research on Python this weekend and see if I could use some of the basic elements of programming to write a rudimentary spell, as I imagined it.

The spell I decided to write out is a draw-redirect spell, one of the first spells I ever came up with. It was originally inspired by Soto’s magical abacus in Terry Pratchett’s Thief of Time, which allowed the monk to move around kinetic force stored in falling bodies (namely, the protagonist Lobsang Ludd). I liked the idea of a spell that could absorb force and redirect it, and after researching martial arts like Aikido and Judo, I thought it’d be a great technique for a martial artist-mage.

The character I had in mind was the Dyer, a mage who had little to no muscle mass, but could topple much stronger foes by absorbing the kinetic force of their blows and redirecting it into his strikes. Here’s what I came up with for a sketch of the spell:

The Dyer’s Basic Draw-Redirect Strike Technique

Part 1: Intercept and absorb kinetic force (Draw)

[IF] [CASTER BODY] [ENCOUNTERS] [KINETIC FORCE] [GREATER THAN] [1 PSI] [THEN] [ABSORB] [QUANTITY: 100%][OF][KINETIC FORCE][AND][STORE][Previously absorbed force][IN][SEA OF DIRAC]

Part 2: Store kinetic force (Draw)

[SEA OF DIRAC]
[DEFINE tolerances: 0 PSI to 120,000 PSI]
[DEFINE shape: bound to caster’s physical dimensions, 1-inch radius around skin surface]
[DEFINE internal structure: triangular tessellation]

Part 3: Release kinetic force on a trigger (Redirect)

[WHEN][1 OF FOLLOWING CONDITIONS=TRUE][Execute respective functions]:

[CONDITION 1: TRIGGER 1 or 2=TRUE]
[EXECUTE][REDIRECT][100% OF STORED KINETIC ENERGY][INTO][RIGHT ARM FORCE INERTIA]

[TRIGGER 1= Caster says the word “release”]
[TRIGGER 2= Caster’s right palm takes designated form MANTIS HAND and makes contact with non-caster living entity]

[CONDITION 2: Sea reaches maximum capacity]
[EXECUTE: dissipate amount of stored energy equal to most recently absorbed energy amount]

The desired outcome of this spell, as it’s structured here, would be to absorb the full force of a punch or strike and dump that force into a magical space I termed a “Sea of DIrac”, which is an actual scientific phenomenon, but pretty much unrelated to the concept of kinetic energy. I first heard the term in Neon Genesis Evangelion, when Shinji encounters an Angel that can suck objects into its shadow, which is actually a Sea of Dirac. I just wanted a shorthand term for a space that existed outside of the material dimension, where energy could be stored indefinitely.

Once the kinetic energy is stored in the caster’s sea, that energy can be released again in conjunction with a strike, depending on one of two triggers: when the Dyer says a trigger keyword, or when the Dyer’s hand conforms to a predetermined shape (in this case, a mantis strike) and meets an opponent’s body. Activating one of these triggers will dump all of the kinetic energy the Dyer has stored into the inertia of his right arm, which, if he times it correctly, means that his relatively weak strikes could become incredibly powerful.

According to this article, the amount of force some elite boxers can put into their punches can range from 776 pounds to 1,300. After receiving only five punches at 800 PSI, the Dyer would be able to redirect roughly 4000 PSI into one strike (if I’ve done my math right). That comes out to about 2 tons.

The next step with this spell is translating it into its own symbols and notation–a magical language. That’s going to be much more difficult, because it means creating a whole set of symbols that correspond not only to programming tokens (like “and”, “or,” or “true”), but to nouns and concepts, like kinetic energy and the Sea of Dirac. Then again, it might be fun to start creating a pictographic language like Chinese or Japanese, especially for small projects.

Hidden Layers: Spell Maps, Illusions, and Neural Networks

Anyone who’s ever watched Serial Experiments: Lain remembers the scene when Lain goes to greet her friends at school, but instead a doppelganger detaches from her and goes in her place–it’s the perfect expression of alienation, and evokes the idea that someone else is living your life. It also brings up questions about reality and identity: can we trust our senses to tell us what’s there or not? How many other things lie beyond sensory perception? Could someone fabricate reality? Are we who we think we are?

I like the idea of doppelgangers, but I like the idea of creating illusions even more. In Ursula LeGuin’s Wizard of Earthsea series, illusions are the easiest thing in the world, but when I sat down to figure out how to create illusions using my own system’s logic, I realized there were all kinds of difficulties: how do you trick all five senses? What sustains the illusion? What happens when you need to create something new, something that has never existed? The goal I had in mind was to create an illusory doppelganger, a kind of puppet that could be controlled by an unseen mage nearby.

Part of the process of creating an illusory person could be accomplished with an AutoCAD-like process–sculpting a person like a 3D model in isolation, adding details and textures like a video game character. But from there you run into the same problems video game characters do: how does the doppelganger ‘model’ interact with it’s environment realistically? How do you simulate the flapping of clothing when running, or when it’s windy out? How do you correctly recreate the sounds of footsteps on tile floors vs. cobblestones?How does the model deal with gravity and changes of elevation in terrain, let alone clipping through things like doors or tables? The model would need to be meticulously crafted to keep it from coming across as a glitchy mess.

The other issue is how to make it move, walk, and talk at all. One solution is to have its controller act out the movements verbatim in real-time with the situation, but that leads to all kinds of problems–if the controller is hidden somewhere, observing the situation, they need to react perfectly in time with outside actions, meaning that if there’s any disruption in line of sight, the whole facade is ruined. The biggest problem is when people or objects try to interact with the illusion model–if someone throws an apple at the doppelganger, the apple will pass through the illusion. Even if a controller were able to weave more illusions on the fly to correct this, by say, making an illusion that the model had caught the apple, the real apple would still make a sound as it hit the floor. The latency issues would be rough.

So there are a lot of issues here, and ones I didn’t really know how to solve practically. Luckily, Google came to the rescue.

One of the big recent announcements from Google’s I/O conference was that developers had created a method called AutoML, which is a system that guides artificial neural networks in creating other neural networks for a specific purpose, like speech or image recognition. Some of the networks created using AutoML actually surpassed the ones created by humans–meaning that an artificially intelligent system had beaten humans at creating systems similar to itself. What really caught my attention, though, was the structure of neural networks:

Image result for neural network structure

The nodes and interconnecting lines reminded me of summoning circles and occult diagrams, like the Tree of Sephiroth:

Here’s the thing about neural networks: they’re incredibly difficult and time-consuming to create and alter. The amazing thing about AutoML is that using a neural network to create other neural networks means that human programmers can delegate the heavy lifting to the AI, which is very adept at trawling through millions of nodes and collecting/changing basic information. With that kind of automation, all the programmers need to do is give it feedback on whether the networks it’s creating are doing a good job.

Here’s an example of what an AutoML-created daughter neural network looks like (right), compared to a human-designed neural network (left) meant to solve the same problem):

With this in mind, I started thinking about how a mage might use the structure of a neural network (and the techniques of AutoML) to create a doppleganger that is not only realistic and responsive, but is (for the most part) autonomous.

Now, just like a real neural network, this magical, semi-autonomous doppelganger would be a dumb automaton–maybe Turing complete, but not capable of doing anything it wasn’t instructed to do. This, however, is where deep learning comes in–the ability for neural networks to independently develop more complex layers to deal with problems. Given enough data and power and a competent neural network, there can be an element of emergence–the arising of a large phenomenon from smaller interactions.

It’s important to realize that neural networks are based off the structure of the human brain, and that when you create a new one, you’re essentially creating the possibility of a new brain to develop, one that can learn, make decisions, and change itself based on inputs. The problem, however, is allowing the system to change itself–as XKCD brings up, you could make a fully functional computer with rocks and enough space, but it would be extremely slow. So how could a neural network-like spell develop and change itself?

What I imagine is a mage who turns their body into a living canvas, with their skin becoming the hardware and the spells becoming the software. After laying down the basic structure of the neural network and employing the techniques similar to AutoML, the spell would begin to spit out output spells, which the mage would then look at and give feedback on. In this case, magic would be the stand-in for electricity, and the human body would take the place of a terminal or OS. Once the networks became complex and developed enough, the mage would essentially be walking around with a second brain on their body, operating in real time and generating a doppelganger like a projector. Creating illusions is just one use–reprogrammed, this same structure could be used for all kinds of magical purposes, including creating new custom spells.

Of course, the process of training the magical neural network and doing backpropagation would still take time, effort, and expertise, but the great thing about the AutoML system is that it can conceivably be used by non-experts to create an intermediary network that can do the more complicated tasks of creating and altering new, purpose-crafted networks. It essentially offers a shortcut to more complex creations.

In the end, it all comes back to Lain and Ghost in the Shell–can we create a facsimile of a person with the emergent property of consciousness? At what point does the illusion become indistinguishable from reality? When do we give up on our senses to tell us who is real and who isn’t? Who slips into my robot body and whispers to my ghost?

My New Grimoire

grimoire-1 grimoire-2

I love this book. I picked it up from Poetic Earth’s booth at New York Comic-Con this year, and it’s got a hand-tooled leather cover. Last night, I made the first entry in it on the title page (see above).

The triangle-tesseract design is the same one that came to me in a dream several years ago, after a night of reading too much about fractals. If you place each letter of the word “OROBORO” at the right vertices, the name should repeat perfectly across the whole design, meaning you can read “OROBORO” forever in three dimensions.

Beneath that is the phrase “ONE THOUSAND EYES OPEN.” This is the same phrase I used for one of my artists books, which used origami and an eye design to create an interactive little book that read “ONE THOUSAND EYES OPEN” no matter how you folded it.

At the far bottom, I drew the symbols of the three gods in my canon: Erroth, Sol, and Ormun.

I’m planning on using this book as a reference document for my worldbuilding, especially magic systems. Right now, I’m thinking of including diagrams of the Sephiroth, Qliphoth, Eightfold Path, the Five Skandhas of Existence, Pascal’s Triangle, and the Sierpinski Gasket, along with notes from my notebooks. This way, I’ll have all my notes and inspirations in one convenient tome.

Worldbuilding: Spell Maps and a Pathfinder Puzzle

A group of New York friends have asked me to DM a short Pathfinder session for them, which means the last couple days have been spent rummaging through my notes from the last campaign I ran, which was about four years ago, back in Washington State, with about 7 people. It ended up being a fantastic experience, despite the fact that, over the course of that 8-month campaign, every character tried to kill themselves at least once out of a combination of despair and existential angst.

But this group doesn’t know that.

The Pathfinder session is going to take place in the fantasy world I’ve established in my stories, which means house-ruling a lot of the magic. It also means I end up spending hours on designing extremely complex puzzles for my players.

This particular puzzle stopped being a puzzle at about the 3-hour mark and became an Occult Triangle Lab project. It’s got everything: triangles, some research into magnetism, mathematics, and a practical application in a fantasy setting.

occult triangle lab

These are my notes for a spell map that will allow one of the mages to enchant a piece of magnetite so that it becomes a strong, permanent magnet. This is meant to be a major plot point in the upcoming session, so I wanted to take some extra time to create something more engaging, rather than just have the players roll a dice and beat a hard DC.

The rabbit hole I fell down was creating a spell map for the enchantment (If you haven’t read my post on spell maps, you can check it out here). After reading up on magnetite, which is the source of naturally occurring magnets called lodestones, I found that it naturally forms octahedrons. Rather than having players working on a 3-D puzzle, I drew out a 2-D version of an octahedron on graph paper and started seeing if I could make a sort of Sudoku puzzle:

IMG_1637

The idea was that the spell map would be a miniature octahedron, reflecting the crystalline structure of magnetite, but the sudoku idea didn’t work out so well. Still, the diamond pattern ended up forming some interesting patterns: the octahedrons in magnetite are actually formed by thousands of smaller octahedrons, so it was cool to graph out a spell map that was made up of small versions of itself (huzzah, it’s recursive!).

But I wanted the players to feel like they’re actually learning about magic rather than just doing a stock puzzle, so I started seeing if I I could weave information about magnetite into the puzzle, such as its melting point, durability, metallic qualities, etc.

IMG_1638

But that didn’t lend itself to puzzle solving. I took a look at the cool, nested design of the 2-D octahedron and thought maybe it would be fun for the player to use the patterns found in magnetism itself to solve the puzzle. I tried superimposing the lines of magnetic pull on the octahedron pattern:

occult triangle lab magnetism

IMG_1640

 

 

 

 

 

 

I found out I could superimpose the patterns in a simple bar magnet on a lattice of octahedrons to create a pretty cool design that might have the material needed for a puzzle: structure, patterns, and a goal. That led to this design:

IMG_1639

The idea would be to build a sort of “connect-the-dots” puzzle built on the patterns in both magnetism and the structure of magnetite, with the player following rules to recreate the design formed by the magnetic paths (which are like big loops radiating out from the North and South poles).

Below are some of the important graph points I isolated (along with the qualities of magnetite). At the center are the two poles, with the outer dots forming the boundaries of the magnetic patterns. These are meant to form the guidelines of the puzzle, which will require the player to do some tracing to recreate the drawing in the previous picture.

 

IMG_1642

Eventually, I created a blank grid of numbers, which the player will use to reconstruct the whole design by following a set of instructions (sort of like a human computer program).

IMG_1643

IMG_1644

 

 

 

 

 

 

Compare the grids and sketches above to the sketches in the last post about spell maps:

occult triangle lab chris mahon worldbuilding fantasy spells

What I found was that this layout, made up of numbers arranged on a grid, ended up looking a lot like Pascal’s Triangle, which in turn forms the basis of the Sierpinski Gasket, one of my favorite fractals:

fractal triangle occult triangle lab

 

I don’t know if the puzzle will end up being a functional part of the upcoming session, but I thought I’d share it here on the blog. It’s a cool intersection of geology, mathematics, and fantasy, and it ended up being good practice for figuring out how a mage would go about enchanting a rock to become a compass.

 

Worldbuilding: Spell Maps and Magic Systems

Despite this being the Occult Triangle Lab, I haven’t spoken much about occult trigonometry. I’ve talked about using binary code as the basis for magic systems, as well as magic as poetry, but not much to do with triangles. Except for that origami pyramid wrapped up with Zen.

The origami pyramid Nirodha.

Magic in fantasy, as I’ve said before, shouldn’t be a science. It shouldn’t be a palette-swapped form of electricity or physics, where mages carry out “experiments” like Isaac Newton (though he himself was apparently a big fan of alchemy). The reason is that magic, when approached like a science, brings up same reductionism that haunts modern people: if we’re all just chemical reactions in our brains, is there space for truth, or meaning, or wonder? Because those are the very things fantasy can explore like no other genre.

I think magic in fantasy should have rules. The way I conceive it, it should undergird the workings of nature and the world, similar to how Ursula LeGuin’s used taxonomy as magic. But when I imagine magic, there’s something transcendental about it that goes beyond science and materialism. How do you begin designing a system like that? It’s like making up a fictional branch of aeronautics. But that’s what’s so amazing about worldbuilding: you get to make the rules.

What follows is the basic building blocks for a magic system that I conceived back in 2014, combining the art of Buddhist mandalas, computer coding, and musical theory with metaphysics, astronomy, and trigonometry. This is, in the realest sense, a product of an occult triangle lab. One note, however: this is all hypothetical. I don’t have a degree in linguistics like Tolkien, or in graphology. To actually create the symbolic language I describe and to embed these kinds of patterns in it would be something akin to making a crossword puzzle out of an entire language. It would take years of careful construction. So maybe a long-term project for me.

But in the meantime…

Spell Maps, COMPUTER CODE and GEOMETRY

A couple years ago, I started to sketch out the beginnings of a written magic system for my fantasy world. I imagined putting together a bunch of symbols in a sequence that expresses what you want to happen, like you’d do with a line of computer code. But there is something inherently beautiful about how these symbols would fit together: if you deconstruct the interactions between the symbols, you would find that all the symbols could be grouped into discrete units, with the groups’ unity based around shared markings in their graphic composition (similar strokes and dots in the symbols) or the part of the spell they affect (such as binding or flight). These rows of symbols would form rectangular paragraphs, and these rectangles could be oriented to one another like building blocks to form geometric shapes, with each paragraph forming a side of the shape.

occult triangle lab chris mahon worldbuilding fantasy spells

These shapes would be arranged into a “spell map,” a geometric representation of how the different parts of the spell work together. It would form a radial or symmetrical design based around a central polygonal figure, such as a square or hexagon. Arms extending from the central polygonal shape would represent the different aspects of the spell, and the smaller components of the arms would be based around their own geometric patterns, making a chain of hexagons, squares, triangles, and so on. So the patterns contained within the individual lines of magical code would eventually form spirals of meta-patterns.

A functioning, well-written spell would have perfect symmetry when all the symbols are arranged in this manner, so a mage writing a new spell could actually lay out their writing in a half-made spell map and figure out what to write next based on their knowledge of geometry and angles. They can also figure out where their spell is going wrong based on the symmetry of the design.

Spell Maps, Triangles, and Designa

The thing is, every polygon is made up of triangles. When you have a regular polygon, like a pentagon, you can subtract 2 from its number of sides and multiply that by 180 to get the sum of its internal angles. Why 180? Because that’s the sum of the angles in a triangle! If you’re trying to create huge, perfectly geometrical spiral designs, the key lies in the shapes that will work well with the central polygonal shape; linking together a hexagon and a pentagon will make for some crowded, chaotic spiral arms. Shapes made from the same sort of triangles that make up the central polygonal figure, on the other hand, might work to create perfect mandala-like designs.

Working with triangles as the basic building block of all shapes, you can figure out the angle measures of the “ideal” triangle for your central polygon (say, a hexagon, which is made up of equilateral triangles with angle measures of 60 degrees) and create a grid made entirely of those triangles. Using this grid, you can be assured that all shapes made from those triangles will have angles measures and lengths that will synch well together. If you’re a mage, it also means that you have all routes for the development of a new spell map.

occult triangle lab chris mahon worldbuilding fantasy spells
But in practice, single-triangle grids may not contain all the triangles necessary to create perfect designs, especially if you want a mix of different shapes. You’ll need permutations of the right triangle, the equilateral triangle, and 30-60-90 triangle, with angles and lengths adjusted to fit the angle measures of your central polygonal figure to have all possible options. This means, to see all possible shapes, you should be working with three triangles grids superimposed on top of one another, calibrated to the right angle measures.

So that’s where things get complicated.

A book I picked up from The Strand is a great guide to this kind of geometrical drafting–it’s called Designa by Wooden Books, and it walks you through the history, drafting techniques, and mathematics behind different designs from all over the world, including Muslim religious patterns and Celtic knots. Woven into these patterns are symbolic meanings and symmetries, reflecting beliefs about the universe, nature, and God.

So there you have the first stage: the idea of a spell map, a meta-pattern that gives a geometric structure to a normally linear, code-like spell made of symbols. Like a computer system, it can be revised and troubleshot based on the patterns embedded in its operations. When it’s evoked, it casts the spell coded into it.

SPELL MAPS, MAGIC, and MUSIC

After looking at the triangular grids I’d made, I used the horizontal lines made naturally when you mirror two rows of triangles vertically to measure the size of a map, which would express its “magnitude”: the larger and more complex the spell, the more space on the grid it will require, and the greater its “magnitude,” since larger spells means using more lines of symbols. And that led to a new idea.

As I looked at the designs I’d made, I wondered what it would look like if I tried to reduce all of the symbols and patterns to binary, so that a spell could be fed through a punch card-computer, like UNIVAC. I also realized that the “magnitude lines” I’d drawn also imposed something like a musical staff on the whole design. It reminded me of Deadmau5 playing the Castlevania theme on a bunch of modular synthesizers, and the Black Midi series, especially this one, where the designs made by the notes end up looking like large spell map. I imagined playing cross-sections of a spell map like Black Midi, with every symbol being a note.occult triangle lab chris mahon worldbuilding fantasy spells

Music is made of patterns and mathematics, and the same kinds of waves that describe sound can apply to light, energy, and matter (I dove into sound waves and quantum mechanics in this post). In my sketches, I started to see how a given spell could be expressed as a song as well as a mandala-like graphical representation. And if you look back to wizards like Vainamoinen, spell-songs are exactly what mages used to change the world around them. It’s a really cool piece of synchronicity, and it’s one of the fascinating coincidences that pops up when you delve into this kind of worldbuilding.

Metaphysics, Spell Maps, and the Universe

But when I looked closer at my sketches, another pattern started to appear. I started to see how a spell map could also be a reflection of the symmetry of the universe, in the same way that Buddhist and Hindu mandalas supposedly reflect the order of all creation. In fact, the structure of a spell map looks like a universe of sorts: it’s a miniature galaxy, with spiral arms containing dozens of individual ‘solar systems’ (symbol-rows grouped around the center of a shape) containing sometimes hundreds of individual ‘worlds’ (symbols) and comprising thousands of ‘people’ (individual strokes that make up the symbols).

In my conception of this magic system, this is where magic crosses over from being a computer program and reveals its ties directly to metaphysics. Like a fractal, the pattern of the whole universe is expressed in miniature in the spell map, because magic is essentially a way to change the universe. And in this system, the way to change reality is to build a microcosm of the universe and rewrite it by hand. In this way, a spell map could also act as a kind of divination or scrying tool, like the I-Ching (a book that fascinated Phillip K. Dick to no end), reflecting the conditions of the world rather than changing it.

mandala occult triangle lab spell maps

Conclusion

Great worldbuilding should work like an iceberg: 10% on the surface, 90% below the waterline. I think this is one of the reasons the worldbuilding in Dark Souls rakes in such unreal praise. There’s a sense that beneath the immediate information you’re given, there’s whole volumes of knowledge and secrets to learn and immerse yourself in. It’s the opposite reason people can’t get through Lord of the Rings or The Silmarillion. But whether you’re revealing all of it or letting the reader unravel how everything fits together, I think the best way to accomplish that feeling of a vast, immersive world is to actually build it behind the scenes. I spoke about this before, but the small details are crucial to making fantasy work, and this is especially true when it comes to magic.

So if you’re a fantasy writer building a world from the ground up, explore everything. Everything feeds into everything else, the world is a frightening and wonderful place, and when you dig deep enough, triangles lie at the heart of everything.

occult triangle lab mandala