Wednesday, 22 December 2010

Random Item Fluff

Yes, I'm still alive. Due to other things, work on the next version of Kharne is progressing slowly. One feature I'm thinking of adding to the next version (0.06, which will also include NPCs and potions) is random flavour text for items, e.g. when you inspect say a +1 Spear you get something along the lines of:
“This ruby-encrusted spear was formerly the prized weapon of JoeBloggs the Hero of Xyzzy. He used it mainly in the war 600 years ago against the Goblins of Zzyyyzzzy. He fell in battle against Bob the Goblin Chief and the weapon was subsequently lost. What it was doing in the hands of a common goblin you have no idea.”
This is fairly easy to program, e.g. it is nothing more than a series of randomized phrases in a format such as:

“[description] [owner] [owner legacy] [now]."

Each of these could be constructed out of further tags like [weapon description] [weapon name] [time period] [owner fate] [weapon fate] etc, which may or may not be present in an individual description. Some tags require randomly generated names, which can be done using the existing name generator routines.

So the example above could be broken down into:

[weapon description] = "This ruby-encrusted"
[weapon name] = "spear"
[owner] = "was formerly the prized weapon of"
[owner name] = "Bill"
[owner famous] = "the Hero of Xyzzy"
[owner use] = "He used it mainly in the war"
[owner timeperiod] = "600 years ago"
[owner use reason] = "against the Goblins of Zzyyyzzzy"
[owner fate] = "He fell in battle against Bob the Goblin Chief"
[weapon fate] = "and the weapon was subsequently lost."
[weapon now] = "What it was doing in the hands of a common goblin you have no idea".

But as ever, my creative juices are failing. Any suggestions and ideas for randomised phrases to use in this generator are most welcome.


James McNeill said...

A couple of random thoughts:

I always like it when the flavor text ties into the game as much as possible. I guess I would be interested in one or more of:

* How is this item special? A flavored description of "+1 vs. trolls" or whatever.
* How did it get to be special? The story that a salesman would tell you, or that would be on the box copy if it was a boxed product. "The secret of the varnish was Stradivarius' most closely held secret. After his death many tried without success to replicate it." "The material bears a curse with long exposure. A lifetime of honing his craft with it eventually drove him mad."
* How did it get into my hands? (Both how it arrived where I found it, and how I actually acquired it.) "The sword you plundered from the captain of the raiding party in Glen Cove."
* What have I done with it since? Is it my favorite? Was there a particularly epic encounter that was resolved with the help of this item?

James McNeill said...

...and because I love good box copy (making something sound wonderful without actually saying much of substance), here are some excerpts from a box of tea I was given for Solstice:

The lexicon of tea is full of exotic terms. Oolong. Pu-erh. Matcha. Mao Feng. To these, we humbly add Smith. Personally crafted by Steven Smith, teamaker, in wonderfully small batches at the Smith atelier, these teas offer a drinking experience like nothing else in the world. Each is created from ingredients picked at their peak and combined with rare verve and imagination.

Preparation Instructions: Steep for five minutes. Raise your cup gently with both hands as a quiet salute before drinking.

Jotaf said...

If you keep this info in an external file you can add to it whenever you feel inspired, bit by bit, so I wouldn't worry about not having a ton of ideas right now :)

I posted some code to generate messages automatically from recursive random choices. You can download it here, and run it if you have Python installed (no other dependencies) :

It's cool because the syntax is free-form, you don't have to adhere to a pre-made recipe. BTW James' tea box sounds deliciously pretentious, I like it :D

I know that Jice liked the idea of a random text syntax and was considering implementing it in libtcod (no promises though). The functionality is fairly independent of the rest of the lib so you could use it for that, or just see if it gives you implementation ideas since it's open source. If you show some interest he's more likely to finish implementing it. My code of course is free to rip apart :P