Season 1 Episode 6

Hello, World

Key scene illustration
Key scene illustration

In which our protagonist writes his first spell, and is unreasonably proud of it.


The morning after the flood, Kenji sat in the back of one of the wagons, Pip orbiting his head, and thought about fire.

It had been a week since the wave. The caravan had limped to a trading post, repaired what could be repaired, and resupplied. Kenji had spent the time recovering, observing, and writing mental documentation. He had a much better sense of the magic system now.

The world ran on mana. Mana was everywhere, in the air, in the ground, in living things. Spells were functions that drew on that mana, took parameters from the caster's intent, and produced effects. Simple spells were cheap. Complex spells were expensive. The cost scaled with what you were trying to do.

The cost also scaled, he had discovered, with how clearly you understood what you were doing. Casting light was cheap because he understood light. Casting redirect on a flood had nearly killed him because he had not really understood what he was doing. He had been guessing.

So: do not guess. Define. Specify. Cast.

He held out his hand. The Compiler pulsed, ready.

"Function create(name='spark', inputs={none}, outputs={small_fire}, cost=low, stability=high, side_effects=none)!"

He felt the function take shape. It was like writing a function definition in code: declaring the inputs, declaring the outputs, allocating the cost. The Compiler, which was essentially a magical IDE, translated his intent into a spell and bound it to his mana signature.

He cast it.

A small flame appeared above his palm. It was the size of a candle, the color of a sunset, and it did not flicker. It was, he thought, beautiful. It was stable. It was his.

"Hello, world," he said softly.

Pip pulsed, delighted. The flame did not go out.

[Spell Created]
- Name: spark
- Cost: low
- Stability: high
- Effect: small, stable flame
- Cast time: instant
- Notes: first successful function definition in this world. This is the "Hello, World" moment. Remember this.

He cast spark again. And again. And again. Each time, the cost got a little lower, the stability a little higher, the flame a little cleaner. By the tenth cast, the spell was essentially free. By the twentieth, he could cast it with his eyes closed.

He had, in the language of his old world, refactored the function. He had optimized it. He had, in the most literal sense, made the spell production-ready.

The guards, who had been watching, were impressed. The merchants, who were practical people, immediately began asking if he could make bigger ones.

"How big?" Kenji asked.

"Big enough to light a wagon. Big enough to signal across a valley. Big enough to keep us warm on cold nights."

Kenji considered. Then he sat back down, closed his eyes, and started defining a new function.

"Function create(name='torch', inputs={size=medium, duration=long}, outputs={sustained_flame}, cost=medium, stability=high)!"

The cast was a little harder. The flame that appeared was the size of his head, steady, warm. He held it for a full minute before the cost started to bite, then dismissed it.

"Done," he said. "I can make torches. I can make campfires. I cannot, yet, make fireballs. The mana cost is too high."

"Yet?" Orven asked, from the back of the wagon, where he had been listening.

"Yet," Kenji confirmed. "Give me a week. I'll figure it out."

Orven studied him for a long moment. Then he nodded, slowly, and said: "You're not lying. You really think you can do it."

"Yes."

"Why?"

Kenji thought about it. He thought about the wave, the way he had thrown logic at a physical phenomenon and the world had bent. He thought about Pip, and the Compiler, and the strange, beautiful, terrifying thing that had happened to him.

"Because I am a software engineer," he said. "And we believe that any sufficiently well-defined problem is solvable."

Orven, who had no idea what a software engineer was, took the statement on faith.

That night, alone in his corner of the wagon, Kenji kept casting. spark over and over, dozens of times, refining, optimizing, until the spell was so cheap he could cast it in his sleep. Then he started to experiment.

What happened if he gave spark a vector parameter? A direction? He cast it sideways. The flame flew. It did not travel far, maybe two meters, and it dissipated, but it traveled.

What happened if he gave it a temperature parameter? Higher temperature, more mana. The flame went from orange to white, and his hand got uncomfortably hot.

What happened if he gave it a radius parameter? It expanded. The flame went from a torch to a small bonfire, briefly, and the mana cost spiked.

He was, in the language of his old world, exploring the API surface of fire. Each experiment gave him a new understanding of what the spell could do, and each understanding opened up new parameters.

By the end of the night, he had a working theory: a fireball was just spark with vector and radius and temperature all set to high. It was not a new spell. It was a parameterized version of an old one.

He cast it.

A small ball of flame, the size of his fist, shot out of his hand and flew in a straight line for about ten meters before dissipating against a tree. The tree scorched. The grass beneath it smoldered. Pip pulsed, impressed.

[Spell Variant: spark_fireball]
- Base: spark
- Modifiers: vector=forward, radius=small, temperature=high
- Cost: medium
- Range: ~10m
- Damage: minor burns
- Notes: first offensive spell. Use with caution.

Kenji, who had just cast a fireball for the first time in his life, sat in the back of a wagon, in borrowed clothes, in a forest, in a fantasy world, and grinned like an idiot.

He had, he thought, just ported his old skills to a new environment. He was still, fundamentally, a programmer. The codebase was different, but the practice was the same.

Pip pulsed, and the pulse felt like: "Proud of you."

Kenji sent back: "Thanks, partner."

He went to sleep that night with a grin on his face and a small glowing dragonfly on his shoulder, and he dreamed, for the first time in this world, of clean code.