Implementing the Basic Unit of Meaning

I thought that I wrote about this project (the one I’m about to tell you about) before, but a search of my archives turned up nothing. So I’ll give you a basic introduction to the concept, and then talk about how the hell we’re supposed to implement it.

A friend from GameDev, a Russian Studies major, had an idea for a massively multiplayer game. He’s quite a dreamer, and he had many ideas for this game (some completely infeasable), but there was one that really stuck out. He was tired of the classic magic system of “click on a scroll, click on a thing, BOOM”. This isn’t magic, this is just a weapon shaped like a piece of paper. He thinks that each spell should be composed of basic words that aggregate into a final spell. These words would be written on scrolls and such, and the user would have to figure out how they go together.

This is a great idea. I think it would be even better if it were taken a little bit further. Magic is a complete language, the rules of which have been long lost (in the source code ;-). It has grammatical structure, inflections, irregularities, all the goodies that come with a natural language. Scrolls you find would have complete spells on them, and these scrolls would be abundant. Let’s say you find three scrolls and experiment with what they do:

nih’ou tou — Fireball

ciui tou — Fire shield

nih’ou kurou — Ice ball

(It’s fun making up words) If you’re a simple-minded player you’d have these three spells. But if you’re observant, you should generalize that ciui kurou means “Ice shield”. I have many more ideas about how this language is constructed grammatically and semantically (in particular, it won’t be nearly so straightforward) and I’ll discuss those another time. Now let’s talk about how the hell do you implement that!?

Implementation here is all about representation. Can we get a representation that’s easy to traverse and construct a spell? And I think going into the language of the context-free we can do that. The parser for the language of the game is simply a translator, which translates the complex and interwoven language into a simple, abstract form which fits into a context-free tree. This tree wouldn’t be representing text, but rather how abstract nodes fit together.

At the top of the tree would be the transit node, which specifies the method of transit (bolt, shield, enchantment, etc.) along with an elemental node, which is some combination of elemental effects, or something. What’s important is that we notice that it’s context-free:

Maintaining a mathematical foundation should also help the abstraction a bit (computing the inner product of two elements is somewhat an abstract definition, but it would make a useful linguistic tool).

The graphical effects for the spell would be methods build on top of the tree nodes, instructing how to combine the various subcomponents into a modular graphic. With special-case overrides, of couse. But it’s all very simple, and fits into an elegant, orthogonal architecture.

I can do this. And it will be very cool. I promise. The rest of the RPG I’ll leave up to my friend.