Skip to content
Stefano Azzolini edited this page Jan 13, 2015 · 1 revision

A fun use for DynamicString: a fantasy RPG stories generator.

$generator = new DynamicString();

$name = "(Quick|Fast|Wet|Rusty|Warm|Curved|Old|Terror|Notched|Smelly|Loud|Heavy|Shiny|Sparkling|Fire|Laser|Cold|Fizzle|Power|Bad|Good|Rustle|Dark|Smokey|Super|Fishy|Pointy|Flash|Beauty|Bleeding|Foo|Master|Small|Big|Red|Gray|Hairy|Magic|Broken|Sharp|Grand|Straight)(mind|blower|killer|hand|ey(e|es)|fee(t|ts)|finge(r|rs)|nose|armpi(t|ts)|blaster|rhymes|bar|sword|blade|breath)";

$race = "(lion|human|worm|rat|orc|elf|pixie|walrus|rooster|dog|parrot|rabbit)";
$class = "(rogue|paladin|warrior|cook|cleric|psychopath|fisherman|wolf)";
$player = "$name, the $race $class.";

$sillystory = "(A (sloppy|quick|brave|small|gentle|cruel|fabulous|shiny) $class $race, named $name) (jumped onto|walked to|crawled under|entered|sprinted to|runned into) a( rooftop| bridge|n house| wormhole|n inn| dungeon) (shouting|whispering|saying|barfing|asking for) ((ancient|magic|modern|silly|awkward) (words|names|runes|spells|shouts|rhimes|swears|songs|tacos)).";

Now, we can generate a silly story with :

echo $generator->render($sillystory);

Some examples :

A cruel rogue orc, named Smellyarmpits jumped onto an house barfing magic tacos.
A fabulous paladin pixie, named Graybar jumped onto a rooftop shouting silly runes.
A brave paladin worm, named Pointyblaster runned into an inn saying awkward names.
A brave psychopath rooster, named Wetsword entered a bridge whispering silly words.
A shiny paladin worm, named Darkeyes walked to a bridge asking for awkward names.
A small psychopath rooster, named Bleedingbar crawled under an inn saying magic songs.
A sloppy warrior parrot, named Rustyblower jumped onto an house asking for ancient swears.

Or we can generate some fun names for our characters :

echo $generator->render($player);
Badblade, the rabbit cleric.
Hairykiller, the elf fisherman.
Bleedingblower, the pixie psychopath.
Notchedrhymes, the pixie paladin.
Fastfingers, the human psychopath.
Hairyfeets, the pixie fisherman.
Clone this wiki locally