A strange, mad idea... a programming language for fiction

Try the following prompt:
CODE:
@d=description
@c=dialog
@a=action

WRITE:
@d.tree (old, gnarled, threatening)
@c.me.tree.shouting(why you here, what you want)
@a.me.tree.chop_down(axe.heavy.old, hard work)

RESULT:
The tree was ancient. Its gnarled roots clung to the ground as though holding on against the cruel wind. The boughs twisted strangely skywards then leered down again, leaning curling down over me. I had no choice but to picture the twigs reaching, curling around my throat.

“why are you here?” I roared up at the branches. “What do you want from me?”

I forced myself forward, hauling up the axe in my hands. It was heavy. I swung it back, hurled it at the trunk of the tree. The blade was old and dull, but the bark splintered all the same. I swung again and again until the trunk was a yellow, splintered wound.


WRITE:
@d.old_man(kindly, toymaker, soft eyes)
@a.me.go_into_shop(smell, sight)
@d.old_man(help you?)
if old_man(happy)
@a.me.laugh
elif old_man(sad)
@d.me(cheer up)

RESULT:

… I think you can see where I’m going with this… Thoughts?

6 Likes

I love the idea. I think instead of a programming language, it should be a prototype game, so you could work out the kinks. Similar effort, but more iterative.

The biggest problem I see is that GPT-3 doesn’t manage state (e.g. that you tried to chop a tree three paragraphs ago or that the old man was kind).

It’ll probably have to be more similar to functional programming, where you feed it the state over and over each time.

text-davinci-002 appears to do surprisingly well with short prompts like “old, gnarled, threatening”, better than a human like me would. So I think that part is just fine.

One thing I do like from solo RP is the concept of a GM Emulator. The simplest form of a GME is you ask it a yes/no question like “Can I chop the tree with my axe by today?” Then roll 1d8. A 1 might mean “Yes, and something unexpectedly good happens”. 2-3 is Yes. 4 is “Yes, but something bad happens.” And so on.

1 Like

This just looks like a compressed movie script to me.

2 Likes

The idea of a “grammar” for fiction has been around for a while now. Pre-neural nets, it was thought that these techniques were the way to Natural Language Generation… (Also, Plotto, etc…)

With that said, it wold be interesting to revisit some of those older ideas and see how they could be merged with LLM’s…

There’s still quite a few old thesis and other papers about NLG before 2016… A lot of them are in dead programming languages, but they’re still interesting.

2 Likes

You should look into Inform. It is a natural programming language used to create interactive works of fiction. Seems to be precisely what you are asking for.

3 Likes