r/worldbuilding • u/-DEATHBLADE- • Mar 04 '24
Lore Coding As a Written Magic System
A written magic system for spells that resembles what you might find in a line of code.
What are your thoughts?
582
u/Ascended-vessel Mar 04 '24
My thoguhts are as a programmer I love it. Too much magic is based on emotion for my taste, I love harder systems. I've done something similar with my own runic magic system. Though, your's is more line of code though instead of following programming line-logic. What I don't get is the casting part of this: when a person uses this system, do they write the spell each time? Do they carry something with the spell written on it? With the first that is obviously way too much time taken for many actions, and for the second you would have to whittle your selection down to a few spells so that you aren't carrying too many spells. Unless there is something I'm not thinking of.
262
u/-DEATHBLADE- Mar 04 '24
You don't necessarily have to write it everytime, but you can if you don't currently have the spell on you.
As for carrying around the line of code, that's what spell books are for. They have lots of pages and you could even fit several on a single page. Have a new spell you'd like to cast in the future? Just write it down.
141
u/Ascended-vessel Mar 04 '24
You know, that makes way more sense than what I was thinking. I imagined like a scroll per individual spell.
→ More replies (11)37
u/vezwyx Oltorex: ever-changing chaotic energy Mar 04 '24
How do you cast once you have the written spell with you?
→ More replies (7)22
u/PM_ME_C_CODE Mar 04 '24
I've been thinking of something similar for years, but could never put down something that didn't look like garbage.
I guess I'm just not math enough :D
Good work, op!
As for "how does this help?", IMO Jack Vance did us all dirty with his magic system. He didn't mean to become the basis for most of our modern fantasy magic, but he is.
I've hated the idea of "spellbooks are recipe books" for a long time. I mean, how does anyone expect to get anything done in D&D if all you have to work with is shit like
1 cup salted butter
1 cup sugar
1 cup brown sugar
2 teaspoons vanilla
2 eggs
3 cups flour
1 teaspoon baking soda
1/2 teaspoon baking powder
1 teaspoon salt
2 cups cholate chips
Mix well and bake for 15 minutes @ 375FIf that's fireball...and Lightning bolt is basically the same, only with cashews...how the fuck are you supposed to get rain of fire? What about delayed blast fireball? Meteor swarm?
Is Meteor Swarm just two cookies with ice cream in the middle?
How the fuck does any of this work?
What OP has here is not something that goes into a cookbook. The hedge wizards aren't going to understand any of that. The sorcerers and warlocks aren't going to "get it".
That shit is pure wizarding. That's the shit you find in a textbook that explains how fireball works in terms of Assembly code, or C-code in the kernel.
That shit is trying to explain how you properly implement the elf-headers. That's not something you find on a spell scroll. That's something you read, comprehend, and then use to write a dozen different fire spells that are all related but work differently.
If you can understand that, you're not just casting fireball. You're getting fire bolt, flame lash, pyrotechnics, wall of fire, spontaneous combustion, fireball, delayed blast fireball, and incendiary cloud out of the resulting research.
16
u/ryschwith Mar 04 '24
What does actually casting the spell look like if you’ve written it out ahead of time?
→ More replies (1)31
u/royalhawk345 Mar 04 '24
Just need to use libraries. "I cast pip install fireball!"
→ More replies (5)→ More replies (6)14
u/TabletopHipHop Mar 04 '24
What about spells that act as a copy/paste to mesh code together from various pages? Or indexing spells to short-hand spell codes that can be inserted and rearranged, creating new spells on the fly. I'm not a coder at all, so idk, but this sounds cool.
→ More replies (1)23
u/A_random_poster04 Mar 04 '24
Tbh, I find the idea of having to carry a tablet and pen instead of a wand is sick, like you speed type your spell and then swipe it to launch it? That makes for a magic system with a very tangible skill level. Easier to quantify how fast you can write then “how well you channel an emotion or something”.
Practically sounds quite a pain tho. Instead of mana you have resistance to hand cramps? Well, I’d suck
11
u/Genesis2001 Mar 04 '24
Tbh, I find the idea of having to carry a tablet and pen instead of a wand is sick, like you speed type your spell and then swipe it to launch it
Practically sounds quite a pain tho. Instead of mana you have resistance to hand cramps? Well, I’d suck
In a fairly (fairy? :P) popular anime, there's a thing called script magic that you trace in the air to cast spells. It worked kinda like how strict some DM's interpret the Wish spell in D&D, where you had to be precise in the wording to do what you want to do. Words directly had meaning in your spells. So you could potentially have it tripped up on nuance and wordplay as a way to "encode" spells if you needed, since spells tend to take the form of your thoughts in such a system.
→ More replies (1)22
u/ExtensionInformal911 Mar 04 '24
I always base mine on having a solid mental image, so you can program the mana to do a specific thing by imbuing it with the image. Emotions just cloud your focus.
That said, I could see this as a video game magic system, especially an educational game that teaches the basics of programming. Imagine adding arrays to the effect, or having the element being an enum you can select before casting.
11
u/corvus_da Mar 04 '24
when a person uses this system, do they write the spell each time? Do they carry something with the spell written on it? With the first that is obviously way too much time taken for many actions, and for the second you would have to whittle your selection down to a few spells so that you aren't carrying too many spells.
Limitations like this are good, because they force the characters to use their powers creatively!
10
Mar 04 '24
It's modular. Like java.
Once you inscribe it, it can be cast via tattoos.
Or an entire altar.
15
u/InTheDarknesBindThem Mar 04 '24
My thoguhts are as a programmer I hate it.
Bruh I explore fantasy to get away from my day job ffs
5
u/Lonewolf2300 Mar 05 '24
Well, if using Vancian/D&D rules, the spellcaster probably memorizes the code, running it in a "standby" or "incomplete" form, before finalizing/activating it when needed.
→ More replies (1)→ More replies (2)8
u/Caleth Mar 04 '24
I might not be telling you anything new here, but have you heard of LitRPG? It's a whole genre of stories written with "harder systems" in place. Usually more about codified stats and the like rather than how the magic is cast, but you can get that too depending on the book.
For example, a decent pulpy series is the Completionist Chronicles. Dude is a ritualist that can cast basic preset spells the system gives him, but also writes up rituals using component parts to get much larger effects.
Now if you do decide to read it, just skip the very first chapter of the first book. Just do it it's terrible and hard wall for most people after that it's off to the races for most people I've suggested it to.
But many of the things you talk about get looked at in one way or another in the series sometimes directly sometimes indirectly by the systems the author uses.
35
u/TintedMonocle Mar 04 '24
I'm not sure I understand how the range works. What does it mean for the fireball to be within 5.4 decimeters?
47
u/-DEATHBLADE- Mar 04 '24
It's not a fireball spell. It's a fire spell.
It creates a fire within 5.4 decimeters of the caster
→ More replies (4)35
u/arkhound Mar 04 '24
So just a circle of fire around the user?
What about a fire originating from a specific point? Or like the above mentioned, a directed projectile? How about a laser-type designation for something that isn't a projectile, like a spell on a certain person far away that requires specific aim?
→ More replies (1)
24
u/Jeroen-lang Mar 04 '24
Nice reminds me of the knights and magic anime. He is a programmer and dies by a car accident but then he wakes up in a magical world and he realises quickly the magic seems similar to programming code. Then he breaks the world as he's way better at magic than anyone else
2
u/No_Nefariousness513 Mar 04 '24
Can you share me the title?
→ More replies (1)3
u/-DEATHBLADE- Mar 05 '24
The anime is quite literally called "Knights and Magic"
→ More replies (1)20
u/FunnyForWrongReason Mar 04 '24
I liked that anime but I do really wish the explained more on how it was like a programming language than just stating it is. I love world building especially when it comes to magic systems. I would love an anime that was mostly just a lecture on how magic works with the plot being less important.
12
u/Jeroen-lang Mar 04 '24
Check out "Akashic Records of Bastard Magic Instructor" it goes more insepth on a magic system based on language and how one can write spells in a different way to get different effects. Super inspiring stuff I think.
→ More replies (1)
19
u/wat_wof Tat_Wof Mar 04 '24
You need some line separations or statement terminators. Unless that's all one statement which is strange. Also a lot of unused declarations. Unless this is calling a class constructor, in which case you need to separate your parameters.
17
u/-DEATHBLADE- Mar 04 '24
I haven't actually done much programming, so I don't actually know all the bits and terms about it. This is just an attempt from me who likes math and has only done a bit of arduino and html. So any help with learning more about programming helps a lot.
→ More replies (3)
9
u/-DEATHBLADE- Mar 04 '24 edited Mar 05 '24
This is just an idea I had for one of my stories I'm making, but still unsure if it'd make the final cut in it. So I thought I would post it here to see what you guys think.
Edit: For added context, I designed this written magic systems for one of the 6 type of magic casters in the story I'm writing. I may keep it in, but this magic systems should be able to warrant writing a whole other story with lore written around it.
5
u/Tyiek Mar 04 '24
What you have so far is pretty cool. I would spend some time figuring out what kind of magic you want there to be in your setting, and how to represent it. The example you've given seems to be a spell for setting the caster on fire.
3
u/Poddster Mar 04 '24
What use is the specification symbol? What meaning changes in the example sentence if we remove it?
2
u/-DEATHBLADE- Mar 04 '24
It's meant to represent an equal sign. So it'd be written like Range = 5.4 Decimeters. Just makes it clear what it's refering to.
2
u/Poddster Mar 05 '24
Just makes it clear what it's refering to.
If it's not present, is there any ambiguity?
→ More replies (3)
3
u/ThatGuyFromTheM0vie Mar 05 '24
You should look into Phyrexian. I think it will be up your alley and provide even more inspiration.
1
u/-DEATHBLADE- Mar 05 '24
I actually do play magic: the gathering. So yeah I know about it. Haven't got into trying to learn their language yet tho
→ More replies (1)
164
u/Protochill Mar 04 '24
I love it and I am informing you that I shamelessly copied this for inspiration. My system of written magic is partly runic and I have like six pages of symbols with notes and this genious idea of yours gave me inspiration how to make it not seem like dwarvish runes.
I thought of it kinda like electricity and sound synthesis works and this programator way of thinking is something I haven't thought of.
44
22
u/QuarkyIndividual Mar 05 '24
I think I'll steal it for ideas as well. My runic system so far is, "I dunno, some god created it so it covers all cases and is super small so you can't make out the symbols."
11
u/Protochill Mar 05 '24
My symbols can get quite big, rune of holding is carved on side of great wall of fuckup (4000km x 4km), but "so small you can't read it" didn't occurre to me. Well, more inspiration.
→ More replies (1)
2
u/questionable_fish Mar 05 '24
Have you got more examples of these spell-codes? It's really cool!
2
u/-DEATHBLADE- Mar 05 '24
I don't currently, but would totally be glad to make some more. Is there any in particular you'd like to see?
2
2
u/N7Quarian Mar 05 '24
Hey there! We ask that all posts here have some context with some in-universe information (or "lore") about what is being shown or how it relates to the larger world. It doesn't need a ton of information—just a few sentences is fine!
Would you be able to add this?
1
u/-DEATHBLADE- Mar 05 '24
I've updated my context reply to add a bit of context for why it was designed
2
u/Jikiru Mar 05 '24
What was the inspiration for this may I ask?
2
u/-DEATHBLADE- Mar 05 '24
Mostly on a whim, but I always wanted to make a hard magic system and I enjoyed programming when I did it for a bit.
→ More replies (1)
2
2
u/Xywzel Mar 05 '24
I could see that as a form of a function call, rather than as a program, It seems you write what you want to to get, rather than instructions on how to get from specified parameters to desired result.
How does the written magic work? Is the formula on paper with special ink some type of filter, that one pours magical power to and then the magic that gets trough is in the shape of the spell. Is the writing just a description for actions one needs to perform to cast the spell, or is writing the spell itself the act of casting.
1
u/-DEATHBLADE- Mar 05 '24
Compared to more well known spells such as a fire ball or lightning bolt, this is a pretty simple spell that's similar to a lighter.
And in terms of function call, I believe this magic system's version of that would be the subject symbols like fire.
And in my story at least, people have a thing called mage cores which is like a small stone/organ in their bodies that allows for spell casting. People would use the magic from that to write it out mid air or by using a mix of their bodily liquids like blood or sweat to inscribe it into objects.
2
u/RedEagle8096 Mar 05 '24
But how do you compile/cast it?
2
u/-DEATHBLADE- Mar 05 '24
Once it's been finished being written down, it's ready to cast. Just put in some magic into it and it'll activate.
2
u/RedEagle8096 Mar 05 '24
Like concentrating mana into it?
2
u/-DEATHBLADE- Mar 05 '24
The source of energy comes from a thing called a mage core which is like a stone/organ that only mages have to use magical energy. So by using it and pouring in the magical energy, you can activate such spells
→ More replies (3)
2
u/Jawshable Mar 05 '24
What does the “anol time” portion mean?
1
u/-DEATHBLADE- Mar 05 '24
Those are separate words "and" and "time." Just my hand writing being weird
→ More replies (1)
82
u/TheGrumpyre Mar 04 '24
It feels like it's too understandable. I get that it's just a simple example, but it reads like the equivalent of writing a program that says "display an image at coordinates X,Y", when the actual code that's needed to display an image on a screen is incredibly obscure, relying on math and logic and knowledge of hardware that a layperson would read as complete gibberish.
This doesn't feel like the kind of magic code that's commanding the fundamental forces of the universe, it feels like a code that's reliant on generations worth of user-friendly wizard infrastructure that makes the forces of the universe accessible to beginners. It speaks of a world where the ancients that created the first "make a fire" spell in coding language were reclusive geniuses who spent their entire lives inscribing thousands of lines of code to bend the laws of thermodynamics and protect the spellcaster from the inherent chaos. And modern spellcasters do their work from within a thick shell of tools and interfaces and automatic scripts that insulate them from ever having to deal with the true language of the universe.
72
u/rodejo_9 Too Creative for My Own Good ✨ Mar 04 '24
It feels like it's too understandable
You underestimate the sheer laziness and simplicity of my comprehension abilities.
32
u/FunnyForWrongReason Mar 04 '24
Many languages libraries that do that for you where you can just kinda say display image at x and y. Although at some point those libraries are obviously working on that complex snd obscure math snd logic. So perhaps the universe has various built in libraries, or perhaps there are multiple kinds of magic languages and some work on that much lower level and others are built up from them like real life programming languages. Perhaps other wizards have made “library” or “module” spells others somehow call or add to their spells.
38
u/TheGrumpyre Mar 04 '24
"Built in" libraries raise some fun questions. Language modules created by an ancient lost civilization? Created by the gods? Stolen from the gods?
→ More replies (2)10
→ More replies (4)4
80
u/Mavil64 Mar 04 '24
What keeps someone from jacking up the parameters to extreme degrees?
89
39
u/LiamApRhys Mar 04 '24
I would go with some sort of mana limitation - increased parameters means increased mana cost. You can get around that with workarounds and knowing some clever add-ons to your code, maybe?
10
u/Jeggu2 Mar 05 '24
Optimization
For complex spells, there might be an easier way to do it, such as your teleportation algorithm using quicksort instead of bogosort, and using a binary search
Or messing with mana itself
You can include a transmutation algorithm that makes the material it is on turn slowly into more mana, to create batteries to apply to other spells, or you could be creative and transmute the air around the object instead, but also needing a lot more surface area in the process
→ More replies (1)32
u/FunnyForWrongReason Mar 04 '24
If I was programming a robot I can’t just jack up the speed variable to the speed of light or something. That would tithed destroy the motor or it won’t have enough energy/power to get to those speeds.
So the amount of mana and how the magic hardware(I were like assume caster or material/item it is on) can take. There is also the idea of integer overflows so perhaps going to high means you get some completely different result.
There might also simply be a max and/or min input. Some functions check to make sure input is valid and throws an error if it isn’t. Perhaps an error just means it doesn’t work or some negative effect happens to the caster.
15
u/Krinberry Mar 04 '24
This is why proper unit testing is important.
22
u/Caleth Mar 04 '24
Yep first guy who did it transposed some numbers and ended up blowing his head off with mana overload. Next guy opened a dimensional pocket to unreality and was pulled in by tentacles. The third just fell over dead.
But the fourth! The fourth guy made a really bitching candle flame that ran on mana. That dude was Flickum Bicus and we honor his name to this day!
4
32
u/MaxSizeIs Mar 04 '24
Can a spell-line execution stack modify itself? Meaning, can I write a spell such that it reads another spell-line that has been written somewhere somehow at some specified time and location and copies it into the current execution stack?
Can I write a spell that writes a spell? Like a Quine, perhaps? (A quine is a computer program that takes no input and produces a copy of its own source code as its only output.)
How does the magical stack handle recursion?
How does the magical stack handle linguistically valid, but paradoxical or unbounded commands? "Every rule has an exception" (If this rule had an exception it would be paradoxical)
11
u/Adrewmc Mar 04 '24 edited Mar 04 '24
Think of it like crypto, you can’t have the stack go to deep because the block wouldn’t end (some decay of magical potential on execution over time) , and you have to pay gas (mana) to do anything, the more efficient you write the code (spell) the less mana required. If you run into an infinite loop, the decay eventually runs into reversion on the caster, attempting to draw out more mana than the caster wants/has and the fight crashes the whole system, caster getter rugged comparatively to the initial resource investment, Boom.
→ More replies (1)
22
u/BlackBrantScare Outlander’s workshop (engineer isekai) & JMSRP (space SMP) Mar 04 '24 edited Mar 05 '24
<magic>
spell.fire {
Range: 5.4dcm;
Duration: dependant;
}
</magic> ```17
15
u/some-app-dev Mar 04 '24
holy crap, i'm doing this too! mine is a little different though, since i like to have visuals. instead of written language, it's represented as a graph. the code is in english and formatted similar to regular languages, and then outputs the effects of the spell as well as the "spell graph" which is what the spell would look like in canon. we should talk sometime!
7
10
u/GammaRhoKT Mar 04 '24
I love it, this is what I want to do with my magic system too. I love when magic is a language, but a very crude and binaric one that you have to, ideally, ponder on clearly.
10
8
u/IntrepidRoyal Mar 04 '24
A version of this was done in Foundryside by Robert Jackson Bennet.
→ More replies (1)
7
u/Teb453 Mar 04 '24
Programmers/mathematicians should do more creative writing of magic systems/fantasy this slaps
7
u/Tuga_Lissabon Mar 04 '24
Good one. Now tell me, *who* is that formula being told to? What compiler reads, interprets, makes the executable and runs it? What is the OS? Is it the world? Gods? Spirits?
7
u/Deus0123 Mar 05 '24
Everybody gangsta until your fireball fizzles out because you forgot a semicolon at the end of like 337
6
Mar 04 '24
I like the idea. I've tried mathematical expressions before and never got to anything I wanted to use. I had the concept of the magic system being created by highly orderly beings or gods, but it's possible to hack or break the system in ways it wasn't intended by the extremely knowledgeable. Like, what mechanism or intelligence validates that the right arguments are used with the right subject? That sort of thing. Plus mage hackers sounds cool to my geeky brain.
6
u/ChainmailPickaxeYT Mar 05 '24
Dammit! Why is my spell not working??? I guess I’ll have to check ManaOverflow…
… Never doing that again. They told me I should never scribe spells again and linked me to an arcana book from two millennia ago that creates a similar but slightly altered effect. Dammit all
Edit: Turns out I simply missed a semicolon. Blasted magic.
1
u/-DEATHBLADE- Mar 07 '24
If anyone wanted to see a more complicated spell. This is Mage Hand from D&D written in this magic system.
5
u/Witty-Exit-5176 Mar 04 '24
Looks awesome.
Also it reminds me of the Virtual Adepts and the Matrix movies.
5
5
Mar 04 '24
You might want to investigate magic in the mahouka franchise. One of the few systems that ever felt right for me.
They have computers to create magic sequences (programs) that are then transferred into their brains to execute them. Mages differ in brain capacity and speed and some come with inate magic (sequences burned into their brain). For practical usage, they only enter a few variables into their computer (size, location, strength, direction, etc.) and then press play.
8
u/miletil Mar 04 '24
Programming as magic isn't super original
But actually going the extra mile and actually having a magic language is incredibly neat
4
4
4
u/3-Username-20 Mar 04 '24
It's all fun and games until some wizard makes an indentation error and blows up the whole building.
Also, nice idea honestly.
But i have a few questions, you said that it's a spell that causes a fire ring spawn around the caster(or an area of fire?), so does this mean "spawn a ring around the caster" magic(ring for short) is a class?
And how would this type of writing handle a spell calling other spells? (Things like a function's output being used as another one's input)
Also, please include line breaks because i can assure you that if you start to add more stuff that single line will be longer than Everest.
Also, also. (I keep getting new questions, sorry. It's a fun idea to think about while I'm also doing my programming class) Would there be different languages for this? Like there is some coding languages that are more human readable(simple language statements like if and such), would there be different magic languages that are better at handling different types of magic than the others?
Something like AoE effects being cast %10 faster than MagicLang1 in MagicLang2 but the downside is that MagicLang2 is much more harder to master and handles Healing spells very poorly for example.
4
u/Hylock25 Mar 04 '24
Neat! I have a magic system that uses “blood runes” for its writing, which are just representations of nucleotides, as the magic is inherently biological in manner.
4
u/HerryKun Mar 04 '24
I actually created a programming language for my magic system :). It uses actual programming and is represented ingame as runes.
4
4
3
3
3
u/SlightlyInsaneCreate Walls of text, please! Mar 04 '24
How long did it take you to make this?
Also, what was your process to make it?
3
u/Zomburai Mar 04 '24
This is a lot like what I'm doing for my magic system (though the "program" can, and usually does, include non-written elements), only way more clean and elegant.
Fucking excellent.
3
u/xeuis Mar 04 '24
I love magic a more structured language.
All the magic in my project is structured, but none more then Rune nation.
Their magics are written and represent the underlying language of the universe. Visually look similar to Viking ruins, Egyptian hieroglyphics, and any other old language I like. But "fire" on its own will do little. They need a way to extract ,store ,and transfer mana into the useful components. Even if the did that with just fire it would be little more then a source of fire that scaled with mana input. Even more runes are needed to give it momentum or allow it to store it's mana for use while in travel like a traditional fireball.
One limiting feature that prevents rune form simply having an advantage over other nations is their are secretive even among their own people. Limiting the spread of runes and words of power (spoken equivalent).
3
u/The_Suited_Lizard ἀθε κίρεκτει ἀδβαθα Ραζζαρα Mar 04 '24
I’m definitely taking and adapting this idea, this is a fun concept
3
u/bevaka Mar 04 '24
love the idea. A spell as a "function" (ExpelEnergy()) that produces different results based on the params passed.
3
3
u/packetpirate Mar 04 '24
The magic system in my world is also a programming language. I absolutely love this. I might have to do something similar with the writing system.
3
u/ollietron3 Mar 04 '24
Have you heard of the hex casting mod for Minecraft? I think youd like it
→ More replies (1)
3
u/Griffemon Mar 04 '24
This is actually really cool. Basically runes but with the syntax of coding languages.
3
u/DreamsUnderStars [Naamah - Magitech Solarpunk] Mar 04 '24
I love this so much!! I am absolutely horrible at math, but I love seeing complex equations written out, it's like art, a puzzle to be solved.
3
3
u/Draklitz Mar 04 '24
I've been meaning to do something similar for a few years but never got to it, tbh I might try again, I really like the equation like style of your magic system
3
3
u/Thatguy_Koop Mar 04 '24
I wanted to do something like this with magic circles so, of course, i think this is a fabulous idea. wizards are typically seen as incredibly intelligent, so in my head it only makes sense that they would try to understand and apply formula to magic.
i also think this approach to spell casting would be fun as a game. give the players a kit where they control the components and find out what kind of spell comes out of it.
3
u/Vladmirfox Mar 04 '24
I read a book series like this once. WebMage or something? I vaguely remember transforming laptop goblins and literal magic computer code.
It was PEAK 90s 'ohh tech is cool'
3
u/VeloxiPecula Mar 04 '24
I'm in love with this concept. It also makes me think of wizards as reality programmers/hackers which is such a unique world building take!
3
3
u/Ok_Abrocoma3459 Mar 04 '24
I love this idea. Imagine being able to build a magic computer that automatically does spells
3
u/declan5543 Mar 04 '24
As someone who is not a programmer I might have to steal this idea because it makes so much sense with the magic system I was trying to create which was in part inspired by Ars Magica's system
→ More replies (1)
3
u/LuriusOnada Mar 04 '24
Imagine the obfuscation on scroll while some reverse engineering thief try to develop an open source society...
3
u/LittleKing68 Mar 04 '24
Not going to lie, although a prefer magic do be more of an imagination thing, I feel this is how magic would really work if it was real.
Because if you are working with a force that can alter and shape reality I feel like it would need to have very precise and specific commands to work.
I think that’s why I always liked runic magic more .
3
u/Aerodrache Mar 04 '24
As long as you don’t allow loops. One loop gone wrong and either the mage burns to a crisp (if magic is powered by the caster) or you get Larry Niven’s disk (if magic is drawn from the environment.)
3
3
3
3
u/HB_DS2013 Mar 04 '24
I like this. The MC in my fanfic often describes spellcasting like programming. One of the things in her bucket list is to create a healing spell from scratch that isn't faith-assisted- not that she has the aptitude for anything beyond the bare basics of programming. The only spell she knows is fireball and absolutely nothing else.
In my world, spellcasting has been dead until the MC's programmer BIL brought it back. Programmers as a result are modern mages and the strength of high-level spells is dependent on internet connection bc internet is the equivalent of leylines. Programmers can learn and cast spells on their phones, laptops and notebooks. Though with notebooks writing with pen can be dangerous bc the wrong letter, word or phrase can create a different and sometimes dangerous new spell.
Other rules for coding as a magic system in my world include the programmer must know basic math at the bare minimum, necromancy is forbidden and spells must be laws of physics-compliant.
I've been looking for a post to justify coding as a magic system so sorry if my post doesn't make sense
3
3
3
3
u/InjuryPrudent256 Mar 04 '24
This is the first magic system idea I've seen for ages that I love, damn cool
→ More replies (1)
3
u/HeadpattingFurina Mar 05 '24
I employed a very similar system in my worldbuilding. It's called Sorcery (confusing, I know) to differentiate from the more freeform Magic that my demon race wields. In this system sorcerers cast magic by utilising the Language of Creation, either in spoken or written form, or in a hybrid of both. For example, a magic loop (Language is written in layered concentric circles.) contains the instructions for, say, elements to be used (anything from the classical elements to "The hair of the first person to be hit with this spell". Multiple elements can be used in one spell.), duration, direction of the spell movement, etc. The rest can be specified by the spoken component. For example,
"Cast start. Generate spell substance, set spell substance as fire. Shape is orb. Initialized location is 10 cm from open palm. Initialized size is 5 cm in diameter. Primary activation condition is cast finish, set primary action as movement, set direction of movement as on vector drawn from palm to center of spell, set movement rate as 20 meters per second. Secondary activation condition is contact with non-air substance or 5 seconds elapsed time after cast finish, set secondary activation as detonation, set detonation radius as 1 meter, set additional effect as fire's properties of heat, light, burning. Cast finish."
Spoken in the language of creation, would be the scriptless standard chant for the spell "fireball". Obviously nobody wants to recite an entire recipe in the middle of combat, so spells are often written out in creation script beforehand. Casting a prewritten spell can be as simple as:
"Cast start. Evoke spell "fire ball". Cast finish."
Much faster than scriptless casting.
1
u/Szygani Mar 05 '24
Then there's the sorceror coming in just being able to do it without learning the system, going purely on intuition
1
1
u/eugene2k Mar 05 '24
If you're going for a setting where the gods are programmers and decided to make a magic system for programmers - it's okayish. When should the spell activate? As soon as it's written? That's not very useful. As soon as the mage says "run this spell"? In that case where would the spell be written? What if there are two spells there - how does the magic determine which one is supposed to run? Also, what about the temperature of the fire and its location? They aren't specified.
1
u/-DEATHBLADE- Mar 05 '24
The spells are mostly written in spell books and don't activate until the mage puts in magic power into it.
And the "fire" here is more like a function being referred to. It's not written out because the predetermined temperature is kept in their mage core like a library.
As for location, in this case as written, I'd appear randomly in an unoccupied space within the range. Not the best, but can be specified within the code.
2
u/eugene2k Mar 05 '24
Wait, what's a mage core? It seems like a crucial part of your magic system, that you left out.
Edit: Also, can you define an "unoccupied location"? What shape and size is it and what do you mean by "unoccupied"? Can light occupy it? Air? Water? Can it be in the lungs of a mage?
→ More replies (1)
2
2
2
Mar 04 '24
Fascinating!!!
I wish I had more to say!!
Like take all the existing diagrams from Analog Electronics!!
What about the Graffiti within tech before we let Robots do all the solder!!
Could you 'hack' the magic system to make it to wacky-ass things?
'Evil' Wizards in it for laughs?
Develop it moooooore!!
→ More replies (1)
2
2
u/feor1300 Mar 04 '24
Start
if(!enemy.dead)
{
cast Fireball
goto Start
}
call Celebration.Teabag;)
But seriously, I had tinkered with one story that was going to be on a space colony being run by AI and which had been abandoned long enough that the residents had mostly forgotten about technology (~2500 years), seeing most of it as magic and the AI as Gods. Clerics are the people who have received instruction in the "sacred syntax" which allows them to intone "prayers" to entreat certain actions of the Gods (the AI, for their part, had been at it long enough they'd started to buy into their own mythology and actually thought of themselves as Gods). I even had an order of semi-maverick monks dreamed up who were exploring the depths of the colony looking for the sacred knowledge of the Rootusr that was supposed to grant mortals absolute power over the Gods.
2
u/swedishplayer97 Please Excuse My Brain-Hound - He Savors Your Thoughts Mar 04 '24
I thought the 7th line spelled "anal time"
2
u/maX3Xam bad writer (malicious, perhaps (maybe even evil)) Mar 04 '24
This is literally just noita, albeit more advanced
2
u/WhiteNova2 Mar 04 '24
Beautiful system, but I pray to every divine being you wake up feeling tired even after 8 hours of sleep for creating this
2
2
2
u/darklighthitomi Mar 04 '24
There is one thing I'd recommend changing, get rid of the absolutes. Instead of defining a fireball's exact area, let the area be a derived result.
With derived results like that, it makes it easier to justify why certain spells have certain limits (when used narratively), and why the exact numbers are used when balancing for use in an rpg. You can let the amount of energy and control the caster has affect those derived results, allowing better practiced casters have better results from the same spells.
However, by letting numbers such the exact duration and the exact radius of a fireball be explicit in the spell, what stops casters from just one-upping each other by expanding the radius and duration of their fireballs to ridiculous limits?
Thus I suggest duration, range, area, etc be simple categories in the written spell, such as short, medium, long, or perhaps, 1 to 6 stars/tiers/lvls, then better casters with more control over their mana and more discipline can get more out of the same written spell. For example, a master and an apprentice might both use the same short range spell, but the master can reach further with the spell despite defining the same distance.
Additionally, if you have the different aspects of the spell affect various aspects of the result, say perhaps making fire spells into a cone increases area but decreases range as an example, then suggests that casters are always trying to write spells in different ways to try and balance the outcome because the way they are written might describe the same thing but have different ranges, areas, durations, etc.
It leaves some mystery and leaves flexibility as a creator to adjust the exact results, either to show how one wizard is more capable than another, or to balance spells when used in a game.
2
u/Aubrimethieme Creater of Worlds Mar 05 '24
I do programming (C++ & C#) and I hate this. I want to escape programming not be stuck having to use it for magic as well lol.
2
u/NYXs_Lantern Mar 05 '24
This is really interesting! Love how it's written out and looks great
A concept I've been considering for mine is making them like electric blueprints
2
u/saichampa Mar 05 '24
I kinda like the idea, especially for magic read from a scroll, it's like a program being executed by the reader. It also makes me think about how different programming paradigms could resemble different kinds of magic
2
u/siresword Olerand Mar 05 '24
Can you refactor it to cast testicular torsion?
Jk, that is an awesome looking magic system, I love the idea of being able to manipulate magic as code, kinda gives makes me think of the Matrix but with magic.
2
2
u/rogerthelodger Mar 05 '24
This reminded me of "Wizard's Bane" by Rick Cook from way back in 1989. Though that was spoken magic programming, not written.
2
u/BadAlternative6573 Mar 05 '24
Nice! I was working on something very similar, but now I have a visual to work with.
2
u/Southern-Wafer-6375 Mar 05 '24
This is how magic work in a thing I’m doing(it’s a Minecraft pathfinder game) in it the other way is sucking up to gods to do the cording for you.
2
u/TheCrafter1205 Mar 05 '24
Do you play Minecraft? If so, I suggest looking into hex casting. It has a very similar feel to this. Even if you don’t, you may get some ideas by looking at it.
2
u/AwesomePurplePants Mar 05 '24
IMO it would be more interesting if it you had to adjust it when cast to accommodate for variables like the time of day, or when it last rained, or whatever.
Basically thinking of stuff like ancient trigonometry tables. Someone methodically measured the ratios of different angles in a circle, wrote it down on a tablet, then probably referenced it to pull off engineering tricks. Which might have seemed quite magical to people who didn’t understand wtf the person was doing.
It also explains why concentration matters for spells. If you have to do mental calculations based on what your current elevation or how many days it’s been since the god of magic last sneezed to pick the right symbol, focus matters.
And explains why casting long lasting enchantments is harder than casting on the fly. A person can mentally do the calculation. But an autonomous spell needs the arcane equivalent of external sensors and look up tables to do the same thing
2
u/tiparium Mar 05 '24
I've always found the idea of coding as magic to be absolutely fascinating. After all, how are new spells made? What do all those runes we see appearing actually mean and do? Hard magic is best magic.
2
u/Gracel2mart Mar 05 '24
I love it - I read a fanfiction that worked with that system before and it was semi-relevant to the plot bc of the fantasy AU!
2
u/Weary_Ad2590 Mar 05 '24
This makes so much more sense. Just like code, one wrong number or bracket, will completely change the outcome
2
u/Quackthulu Mar 05 '24
Basically just a maths equation using different characters, with Roman numerals as inspiration. Very Nice
2
2
u/Equal_Pomegranate_69 Mar 05 '24
I can't program a "Hello World!" to save my life (yet), but I'm absolutely loving the comment section here!
I can imagine an Artificer literally inscribing something like this in a construct, a weapon or a piece of armor and channeling mana/magic/ki/whatever and running the spell with a single word! Or the archetypal version of a wizard, walking down a stone-paved road mumbling to himself and doodling weird shapes in the air as he's trying to optimize his "code" for Fireball or Lightning Bolt!
Please don't let this comment section die. Y'all are amazing!
2
u/pnam0204 Mar 05 '24 edited Mar 05 '24
I usually compare my world magic to coding and different systems as different coding languages. But yours is an even better and more concrete example.
For context, reality is subjective and human collective belief actually bent reality and create magic systems to manipulate the existing energy. When enough people believe magic works certain way, magic will start behaving that way thus creating many multiple magic systems for different group of people. Runic mages think the ancient words hold mystic power, monks think it’s life qi, alchemists think of the 4 element, etc.
Over the millenia of development, magic got easier as more spells are recorded into system to be used by beginners with less steps; similar to how coding languages have built-in functions - like instead of doing x = 2 x 2 x 2 x 2 x 2, you can do x = pow(2,5)
Incantations are like calling up a magic function you built and input variable. How fast the casting speed is how compressed your code is. You cannot cast spells from another system simply due to syntax error
2
u/Cl0udSurfer Mar 05 '24
This is really cool. I imagine that curses and trap-style magic in this world are complex and extremely powerful
2
u/twoScottishClans Mar 05 '24
i think there's an opportunity for coding style magic to be in a matrix-like world. life is actually a computer simulation and the inhabitants don't know it, and because their life is run on code, the magic in their life is code-like. it could be like a little clue for readers in a mystery novel or something
2
u/Particular-Welcome-1 Mar 05 '24
Diane Duane did something pretty similar in their series "Young Wizards". I don't recall the specifics right now, but they talked about constructions they could make that had to be written out like programming. A difference I see is that Duane's system had to specify a power source, as if the construction were a machine and a programming statement in one. I think it might be worth some research:
2
u/austsiannodel Mar 05 '24
This is close to something me and my friend/cowriter have come up with for 2 separate magic systems, one of which being a runic system designed around programming
2
u/onko342 Mar 05 '24
Can I have spells with conditions and massive logic loops? If yes, I’ll have this spell on a magic item:
on = true;
manaContainer c;
while(on == true){
if(owner.mana == owner.mana.max){
StoreMana(c, 0.01*(owner.mana.max));
}
if(owner.alive == false){
cast(resurrection, target = owner, manaSource = c);
}
if(owner.health < owner.health.max){
cast(heal, target = owner, potency = owner.health.max - owner.health, manaSource = c);
}
}2
u/duckie_pluckie Mar 05 '24
This looks cool as fuck and I love it, but I'm also dumb and would never remember how to even put a string of "magic code" together lmao.
2
u/ViLe_Rob Mar 05 '24
I absolutely love the idea of breaking down magic into code or a science, this is awesome.
2
u/sludgecoin Mar 05 '24
This shits never gonna beat kolmi, you gotta add some piercing or homing or maybe some heavy shots smh
2
u/Yoshi2255 Mar 05 '24
And here I thought that fantasy world building couldn't get any nerdier than it already is. But in all seriousness that's a very cool idea.
2
2
2
2
u/Justlearning2504 Mar 05 '24
Remember waking up in the middle of the night with the single thought of spells are like a programming language now this crazy
2
u/Dayner_Kurdi Mar 05 '24
I’ll use my pointy stick to referee to that awesome spell on my desk!
Let hope no one move that book, or change the page!
2
u/Dovacraft88 Mar 05 '24
Could you combine spells to do certain things? I.e. when fire spell hits entity, ice spell activates upon contacted area. I'd imagine that would take a lot of mana or whatever magic fuel you are thinking of using.
Also saw you say on another comment you talk about spell books holding the code spells, but I was thinking of adding to that by using copy stones/capsules to store a certain amount of charges of one spell so you have the spell you want and a reloading system, the more bigger/longer the code, the bigger the storage of the copy stones/capsules need to be.
2
2
u/TheReaperAbides Mar 05 '24
This is giving off major XKCD vibes and I love it. All it's missing is a mouseover punchline.
2
2
u/DanjelRicci Mar 05 '24
I love the concept. In Miss Kobayashi’s Dragon Maid they had the opposite idea: programming languages were copied from magic formulas.
2
2
Mar 05 '24
I love the idea, and how you represented it. Where does the energy come from? That is something that is rarely addressed by magic systems and I feel ties in nicely here. Also what is the runtime, what reads and processes what you do to turn it into fire? Are there strands that respond to certain basic inscriptions like this and in turn have an effect on fire?
That's what I love about thinking of magic as programming, it opens up a lot of useful hard worldbuilding questions
2
2
2
u/UnreasonableFig Mar 05 '24
Just saw this x posted to r/noita, so I figured I'd mention it in the thread here. The system you've got worked out here is remarkably similar to the wand building mechanic in Noita, one of the most insane, addictive, deceptively simple but incredibly complex, frustrating yet awesome rogue-like video games I've ever played. Y'all should check it out. I feel like you'd love it. Let us know how you die. (:
2
2
u/icabax Mar 05 '24
im also thinking of having one of my magic syems be coding based, the one made by the MC becasue they cant remeber speel names
2
u/Bright-Trust6790 Mar 05 '24
This is something that has already been thought of. In the book series schooled in magic by Chris Nuttall the magic system operates almost exactly like this with new spells being written down first in a way similar to coding. The magician then has to remember the code, in order to execute the spell. Also too much power poured into the spell can cause the magician brain damage and infertility among other side effects. I would recommend it as a good series to read with one the best hard magical systems devised.
2
u/SlimeustasTheSecond I'm *definitely* writing down my ideas... Mar 05 '24
It's nice seeing a "Magic is Coding" system that actually shows how the code looks like.
506
u/SonicLoverDS Mar 04 '24
Is magic compiled or interpreted?