Showing posts with label nanodeities. Show all posts
Showing posts with label nanodeities. Show all posts

Wednesday, 30 November 2022

Further Encounters in AI

OpenAI have just added a new model, text-davinci-003, to their GPT-3 text generators. It is supposedly much higher quality than previous models, so I decided to generate some random encounters and some nanodeities using the same prompts as before. I also, for shits & giggles, decided to ask another AI to make pictures of the encounters, because: why wouldn't I? 

Here are the results:

Random encounters

* At the edge of a nearby lake, a giant 3-headed turtle is sunning itself on a rock. It has a large shell with powerful scutes, and its 3 heads have different expressions: one is smiling, one is frowning, and one is screaming. The turtle is friendly, and will willingly carry up to four PCs across the lake on its back. It is also a repository of knowledge, and will answer any question they ask it, but will only do so if they answer three of its own questions first.

The turtle's questions are:
1. What is the most beautiful thing you have ever seen?
2. What is the most powerful emotion you have ever felt?
3. What is the most important lesson life has taught you?

* The PCs come across a clearing in a forest, where four wooden pillars have been erected around a raised platform. On the platform, a circle of five humanoid figures stand, their heads bowed and their hands clasped together. As the PCs approach, the five figures begin to chant a strange, eerie melody in a language none of them have ever heard before. The chanting becomes more and more frantic, and soon the five figures are spinning in a circle and holding hands. The ground suddenly trembles and a shimmering red portal appears in the centre of the circle. The five figures continue to chant, and the portal slowly starts to open, revealing a strange and alien landscape beyond. If the PCs step through the portal, they will find themselves in a place called the Shadow Realm, where they will be able to explore, interact with the inhabitants, and find powerful magical items. However, they must be careful, as the Shadow Realm is a dangerous place, and they must be careful to not become lost in its depths.

* A small rock-strewn valley, at the bottom of which lies a shallow lake. In the lake is a small island, upon which stands a single, ancient oak tree. As the PCs approach, they notice that the lake is home to a small colony of giant fire-breathing dragonflies. The dragonflies are friendly and will offer to give the PCs a ride across the lake, in exchange for a few pieces of copper. Once on the island, the PCs discover a small shrine to the god of fire, surrounded by a ring of standing stones. In the centre of the shrine is a small altar, upon which sits a single, flaming gem. If a PC takes the gem, they will gain a permanent increase to their fire resistance.

Nanodeities

* Gurf, a deity of long-forgotten front doors made from oak and yew, has domain over the forgotten and misplaced. Gurf appears as a moss-covered door with a lion’s head knocker and a keyhole with a glint of starlight. To appease Gurf, kneel in front of an ancient door and whisper a prayer for the forgotten and the lost. Gurf will reward you with an entirely new door, with a shiny brass knob and a lock that can never be picked.

* Marilath is the god of half-forgotten memories, and can be found in the far corners of one's mind. Marilath looks like a silver-scaled catfish, but with a human face and a beaked nose. To worship Marilath, one must sit in a comfortable chair and recite forgotten memories in a soft voice. If successful, Marilath will reward you with a vision of forgotten memories, providing a glimpse into the past.

* Gorack the Great is the god of forgotten roads, appearing as a giant centipede with a glowing yellow eye. To appease Gorack, one must draw a map on a piece of paper and trace a route along a forgotten road. Once the map is complete, Gorack will reward the worshipper with an altered perspective on the world, and will offer guidance on how to find forgotten roads.

Conclusion

These responses do feel slightly superior to the set I generated with an earlier text model. The differences are subtle, but the biggest difference is the one you can't see: with the previous model, I generated perhaps 10 or 15 responses in order to get three which I felt were adequately creative and believable. This time around, I only had to generate the three which you see above.

As for the image AI: that was predictably terrible, but a lot of fun. The images themselves are nice enough, but scarcely representative of the text (although the deities are a lot closer than the random encounters). I could have made the images a little more accurate by tweaking and re-tweaking the text, but life's too short and, as my attempts to get an AI to depict a viking longship made of thorns have taught me, AIs are terrible at generating anything other than simple portraits or landscapes.

However, I adore the fact that the picture of Gorack the Great, god of forgotten roads, incorporates what appears to be a prehistoric version of Google Maps' location pin.

I also learned a new word, "scutes".

Monday, 4 April 2022

Generating random content for RPGs using Artificial Intelligence

Sea-biscuit cutting and rolling machine

The topic of Artificial Intelligence in TTRPGs (actually Machine Learning - but I'll call it AI for simplicity's sake) is something I've seen discussed a lot recently. noisms asked on his blog whether AI would change the hobby. On the NSR Discord server we've had AI-generated failed careers for Electric Bastionland posted by Chris McDowall, and some Cairn sparks from Yochai Gal, plus an ongoing discussion on how AI can be used in RPGs.

Machine Learning is something I've wanted to tinker with for a while now. I've been put off by lack of a powerful enough PC, a loathing of the Python programming language, and general laziness. Meanwhile I've poured hundreds of hours' hacking into my Deity Galaxy twitter bot, using Tracery and nested lists (a little like Perchance) to generate text which is... rarely satisfactory. I plan to publish a book of "nanodeities" based on curated output from Deity Galaxy (I wrote about this a while ago). But before doing so, I will  have to spend a lot of time sharpening up the bot's output.

A couple of weeks ago my friend, the horror writer James Burt, came to visit. We had a wonderful walk around the hills about Allenheads where, among many other things, we talked about my nanodeities plans. James has written previously about using AI as a writing partner, and our shared acquaintance Shardcore published what may be the world's first AI-written book, "The Future is Already Here" by Algohiggs (a computerised riff on the book The Future Starts Here by John Higgs which, BTW, is a fabulous book; if everyone read it then the world would be a better place). James suggested that I try generating deities using AI and the GPT engines.

So that's what I've done. I used the OpenAI Playground to paste in some prompt text (which you'll find at the end of this post) and was blown away with the results:

Mallus, deity of the abandoned sock, is a small, slightly furry creature, not dissimilar to a ferret, that can be found in the laundry basket of most homes. Mallus is a mischievous god, and often delights in hiding one sock of a pair, or tangling up clothes that have just been ironed. To please Mallus, leave a sock out on the floor for him to play with.

Kerfuffle, goddess of tangled wires, is best worshipped by knotting together at least 7 different electrical cables, and then throwing them into a puddle. The resulting sparks will be a sign of Kerfuffle's favour. Kerfuffle herself is a small, spiky sphere, not unlike a hedgehog made of barbed wire.

Snorfle is the god of hiccups. Snorfle is an amorphous blob of green slime with a single eye in the center. To worship Snorfle, drink a pint of milk and then try to hiccup. If you are successful, Snorfle will grant you a wish, provided that wish is related to hiccups.

Schnarf is the god of electronic bleeps and bloops, and can be found in most electronic devices, especially those with a lot of buttons. Schnarf is especially fond of mobile phones, and can often be found lurking in the background when someone is taking a selfie. To worship Schnarf, simply take a selfie with a mobile phone and then offer it up to the god.

Those were all written by a computer! Wow. OK, that got my attention.

Suddenly I'm thinking of all sorts of uses for GPT-3 powered text generation. Tables of random content are a Big Deal in TTRPG-land, people can't seem to get enough of them (witness the wonderful d4 Caltrops). Right out of the box, GPT-3 understands these tables. When I asked it to "write a table of random encounters for a fantasy TTRPG", here is what it came up with:

10 believable but rather vanilla possible random encounters

As an aside, something which initially appears surprising is that this output includes the gaming-specific term "2d6". One of the great things about GPT-3 (in comparison with its more readily-available predecessor GPT-2) is that it was trained on a mind-boggling number of web pages, undoubtedly including many gaming blogs (and probably a sizeable number of random encounter tables). It is really great at understanding context, and using the relevant domain-specific language in its output. It can even write computer code, given just a very simple prompt:

To get improved random encounters, I started writing ("crafting"?) prompts to seed the AI-generated list. i.e. I started to write the sort of encounters that I would like to read. This took many iterations and, as you'll see from the prompts at the end of this post, required adding a huge amount of spice to the seed text in order to get encounters that didn't sound too generic.

Here is what the AI came up with when I tasked it with creating some random wilderness encounters (I had to hit "submit" several times to collect all of these examples):

* A small village of mud-huts is in the process of being slowly buried by an encroaching sand-dune. The villagers are in a state of panic. A quick check will reveal that the sand is being controlled by an evil sorcerer, who lives in a crumbling manor-house in the centre of the village, surrounded by a low moat. The sorcerer’s name is Hamza Omri, and he is a wicked man. In his basement, he possesses d6 bottles of a potion which, when drunk, will transform the drinker into a sand-dune. These potions are worth 100GP each, and Omri is willing to sell them. The sorcerer also possesses a magical amulet, which will allow the wearer to control any sand-dune within 100 miles. Omri is very reluctant to sell this, but will do so if offered d1000GP.

* A group of d6 pixies flutter down from the trees, laughing and playing. They carry with them a large number of brightly-coloured flowers, which they offer to the PCs. If the PCs accept the flowers, they will find that they are unable to move from the spot. The pixies will then proceed to strip the PCs of their clothes and possessions, and will fly away, laughing. The flowers are actually poisonous, and will cause the PCs to become paralyzed for d6 hours.

* A large group of d6+12 unicorns approaches, led by a magnificent white stallion. The unicorns are on their way to a magical spring, where they will drink the water and be transformed into Pegasus. The stallion is the only one who knows the location of the spring, and he is very reluctant to reveal it. However, if the PCs can convince him that they are worthy, he may show them the way. The spring is located in a hidden valley, guarded by a ferocious dragon. The dragon will allow the PCs to pass if they can answer three riddles.

* A small campsite, in which a fire is burning and a pot is bubbling. Sitting around the fire are 2d4 humanoids, with the heads of eagles. They wear colourful feathers and have beaks made of gold. These are the Aaracockra, a race of bird-people. They are friendly, and will share their food (a stew made of insects and small rodents) with the PCs. They will also give the PCs 2d4 feathers, which can be used as currency in some cultures, or as quills for writing.  
* A d4-1 skunk-like animals are chasing a small golden-furred creature with a long tail. This creature is a “chai”, a small, intelligent, furry creature who is being hunted by the skunks, who are known as “chai-hunters”. These chai-hunters are attracted to the chai’s fur, which is used to line cloaks and blankets. If the PCs help the chai escape the chai-hunters, the chai will invite them back to its village, where they will be welcomed with a feast and a chai-fur-lined cloak.
* 3d20 flying bats, each with a wingspan of around 9 feet, descend from the twilight sky, circling around the PCs, hissing and squawking. These are not ordinary bats. They are “shrieking bats”, which can emit a loud shriek which can be heard up to 5 miles away. This shriek can be used to warn other animals of danger, or to call for help. The bats will only attack if provoked. If the PCs capture one of the bats, they will find that its fur can be sold for 5GP.
* A column of luminous green slime slides across the ground towards the PCs, slowing as it nears them. This is a “slime-beast”, a predatory creature which feeds on small animals. If the PCs do not move out of the way, the slime-beast will envelop them, and begin to digest them. The slime-beast can be killed by fire, or by being frozen solid. If killed, the slime-beast will leave behind a sticky green residue which can be used as a glue.
* A large, slow-moving, armoured creature, resembling a cross between a turtle and a snail, emerges from a nearby pond. This is a “turtle-snail”, a harmless creature which is often hunted for its meat. The turtle-snail’s meat is tough and stringy, but can be roasted and eaten. The turtle-snail’s shell can be used as a bowl, or as a shield.

* A pink elephant-like creature, with trunk outstretched and a gleaming white tusk. It is covered in dozens of colourful umbrellas, hanging from its sides like leaves. The elephant is the reincarnation of a local rain god, and the umbrellas are his “holy symbols”. He is friendly and curious, and will follow the PCs around, trundling along behind them. He is also very clumsy, and has a habit of knocking over small trees and stepping on things. If the PCs give him a basket of fruit, he will be overjoyed, and will bestow upon them a magical blessing: for the next 24 hours, they will be able to breathe underwater.

* 2d6+6 very tall (around 12 feet) humanoids, with ashen grey skin and long white hair. They are wearing simple white tunics, and each carries a large wooden staff. These are the ash-walkers, guardians of the forest of Ashes. They are friendly, but will not allow the PCs to enter the forest of Ashes, as it is a sacred place. If the PCs are persistent, the ash-walkers will tell them a story: “Once, long ago, there was a great kingdom, whose people were just and good. But the king was corrupted by power, and he became a tyrant. His people rebelled, and the kingdom was destroyed in the ensuing war. The forest of Ashes is all that remains of that kingdom. It is a place of sadness and loss, but also of hope. For one day, the ash-walkers believe, the kingdom will be reborn, and its people will be just and good once again.” 

Well. That's rather interesting. There's still a clear tendency for these encounters to revert to something rather more generic than the examples I've fed them, and there are inconsistencies which need tidying-up and details which need filling-in. But I'd say that these encounters are at least as creative as 75% of the equivalent human-written content out there.

I'm really tempted to keep fiddling with this and creating more encounters, but OpenAI Playground costs money (I'm still well within my $18 initial free credit, but I have lots of uses I want to put that remaining credit towards). 

In the future I'm sure we will see more and more AI replacing (or at least providing an increasingly-used alternative to) old-school tables. The key, as ever, is the seed text, and so there will still be a need for humans to craft texts which lead to interesting results from the AI. Unlike with tables though, a single set of well-written prompts can generate pretty much unlimited outputs forever more. So it may not be true to say that we will need good writers as much as ever. We may only ever need them once.

The other thing that this type of AI is great for - and which I intend to explore a lot more over the coming months - is providing inspiration and feedback for human-written text. This might operate in a similar way to existing writing partnerships, allowing ideas to be bounced back and forth and refined before the human partner settles on a final revision. Also a great way for breaking out of writer's block!

Below are the hand-written prompts I put into the OpenAI playground to generate the texts above. To generate your own encounters, sign up for an account at OpenAI, then head to the playground and paste in the second list below (or write your own prompts). I'd be really interested to hear of any good results that it comes up with - please write them in the comments below.

Thursday, 27 January 2022

Nanodeities

 

A small god by Richard Tingley

Have you seen my Twitter bot, @deitygalaxy?

 Deity Galaxy, AKA All The Deities, invents new gods, goddesses and goddexxes. Tiny, eeny-weeny deities. Deities so small that they may not even have any followers. Deities who are desperate for somebody to notice them, accept them, worship them. The idea was inspired, in part, by the Terry Pratchett book Small Gods, in which the Great God Om finds himself without any divine powers, due to a distinct lack of anyone who is the slightest bit interested in him any more.

I'm happy to announce that I am planning to publish a book based upon Deity Galaxy, called nanodeities. Nanodeities will contain a collection of small gods, all of them generated at random by the bot. For each there will be a portrait by Richard Tingley, a descriptive backstory written by me, and a set of stats, should you want to include this deity in your D&D or OSR game.