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.