Tuesday, February 19, 2019

Recursion

Recursion is a beautiful thing, I tell you.
As a non-computer science person, you might be unfamiliar with the concept, which is simply said, the definition of something in terms of it self.
Imagine fractals, like the sierpinski triangle, made out of more sierpinski triangles.

Man I love fractals
This concept is pretty useful in computer-science, because you can declare functions or objects pretty elegantly at times.
Consider the mathematical operation of factorial "!".
It is defined as n! = 1*2*3*...*n, you just multiply every number from 1 ascending to n. This can be defined recursively, with n! = n * (n-1)! , where 0! = 1.
Applied, it would look like this:
4! = 4 * 3! = 4 * 3 * 2! = 4 * 3 * 2 * 1! = 4 * 3 * 2 * 1 * 0! = 4* 3 * 2 * 1 * 1.

You might ask:
edi, what are you smoking, what does that shit have to do with gaming?
Oh just wait, my eager friend.

There's a theory in comp-sci, that every regular looping procedure can be defined recursively. And in my last post, I created a weird recursive version of magic-missle. So if we break down spells in looping components, we can create recursive versions of them. That's what I want to do.

Yes, this idea is not gameable and unusual, but it might serve for inspiration.
And I like fractals and recursion, shut up.
Every non-infinite recursive structure has an ending point, which will somewhere hidden in the spell.

Fractal Spells

Charm Person, recursive
Duration: One or more days (see below)
Range: 120'

A single, humanoid creature must save versus spells or be charmed, as follows:

-the subject regards he caster as its trusted friend and ally and will come to the caster's defense.

-If they share a language, the caster may give the charmed creature commands, which it will obey.

-Actions that the charmed creature wouldn't ordinarily do, based on its nature or alignment, may be abstained from

-An affected creature never obeys suicidal or obviously harmful orders

Humanoids of greater than 4+1 HD and undead are not affected.

The charm lasts depending on the INT score of the target.

-A creature with an INT score of 3-8 stays charmed for a month.

-A creature with an INT of 9-12 stays charmed for a week

-A creature with an INT of 13-18 stays charmed for a day.

If the spell ends this way, Charm Person, recursive is immediately recast at the target.

Detect Magic, recursive
Duration: variable
Range: 60'

Enchanted objects, areas, or creatures are caused to glow. Both permanent and temporary enchantments are revealed. If this is the casters first casting of Detect magic, recursive, the duration will be 1 turn and after the spell ends, he immediately recasts Detect Magic, recursive. If not, the duration will be 1 turn.

This one's rather silly and convoluted. But there's not much to get out of the spell, in terms of a looping effect.

Floating Disc, recursive
Duration: variable
Range: 6'

The caster conjures a slightly concave, circular disc of slightly concave circular discs, that follows him or her about and carries loads.

-The disc is n/2 feet in diameter and 1 inch deep at its center, where n is the precious size of Floating Disc, recursive. If this is the first casting, this is 3.

-It can hold a maximum load of n/2 coins, where n is the number of the previous holding capacity of Floating Disc, recursive. If this is the first casting, this is 5000.

-The disc floats at waist height and remains level, floating along horizontally within spell range.

-The spells duration depends on the duration of the previously cast Floating Disc, recursive spell:
    If it is first cast, It will stay 3 turns.
    Else, it will stay n-1 turns, where n is the duration of the previous floating disc. 

-When the disc winks out at the end of the spell's duration, Floating Disc, recursive is immediately recast twice, with the new Floating Discs supporting the load evenly.
If this results in a floating disc with a duration of 0, anything it was supporting is dropped and the spell vanishes.

I am sure that I don't make a point about how recursion can be elegant. Trust me on this one, it is a thing of beauty in computer science.

Hold Portal, recursive
Duration: 1d6 turns
Range: 10'

This spell magically holds shut a door, gate, window, or other kind of portal.

- A knock spell opens the held portal instantly.

- Creatures with at least 3 Hit Dice more than the caster can open the held portal with one round of effort.

If this is your first casting of Hold Portal, recursive, immediately recast Hold Portal, recursive on the Portal.

I don't want to create any more. I'll do sleep and magic-missle and that should be enough.

Magic Missile, recursive
Duration: 1 turn
Range: 150'

This spell conjures a glowing dart of glowing darts that the caster may choose to shoot at a visible target within range.

-The missile hits unerringly (no attack roll or saving throw is required).

-The missile does 1 damage. If this the casters first cast of Magic Missile, recursive in the chain, immediately recast Magic Missile recursive 1d6 times targeting the same target.

-Higher level casters may conjure more missiles: two additional missiles are conjured per five experience levels the caster has  gained. Multiple missiles may be directed at a single target.

Sleep, recursive
Duration: variable.
Range: 240'

If this spell is your first Sleep, recursive casting in your recursive chain, the duration of the spell will be 4d4 turns.
-If not, the duration of the spell will be the duration of the previous cast Sleep, recursive.

A sleep spell causes a magical slumber to come upon a creature, excluding the undead.
The spell may target either:
1. A single creature with 4+1 Hit Dice.
2. A single creature of 4 HD or lower.
3. A group of 4 HD creature or lower each.

When targeting a single creature with 4+1 Hit Dice, the following rules apply:
- If this spell is not the first Sleep, recursive spell in your recursive chain, it fails.

When targeting creatures of 4 HD or less, the following rules apply:
-If this is your first cast of Sleep, recursive in your recursive chain, recast Sleep, recursive 2d8 times. Targets with the least HD are targeted first.
-If not, it fails.

Creatures enchanted by this spell are helpless and can be killed instantly with a bladed weapon. Slapping or wounding awakens an affected creature.


I think you get the meat of it. I don't want to create more, lol.
Now, I am sure these are absolutely ungameable, but it serves as food for thought. Maybe you know of a concept that will streamline your mechanics or maybe will enhance your game with wonderful, weird and unique flavor.

I like Charm Person, Magic Missile and Sleep though. They were pretty simple to recursify. Maybe that tells us something about good game design.
But maybe I'm just smoking the bad shit.

Peace!

Mhmm look at this beauty.

No comments:

Post a Comment