Orangy Tang wrote:I've been toying with a game that needs quite a lot of procedurally generated text, but haven't made much progress on it. All the academic literature is super dry and generally deals with things like generating weather reports, and most games just used canned text. Any good references you could point me towards?
Are you slamming together canned sentences, or are you generating fragments / statements and then gluing them together with grammar rules?
I haven't any reference material I'm afraid - I had a good idea of what I wanted to achieve and just went for it, and have been refining it ever since.
Having said that it's very unwieldy, and probably quite ugly, but not being a particularly adept coder I'm happy it's working and that's about all that matters to me. If I find better ways to do things later so be it.
What I wanted is to make all my tribes/NPCs as individual as I can - give them ways of speaking, attitudes, mannerisms and character. I also need them to shape their speech based on how much they like the player, and things the player has done, or is doing, and possibly on status effects they have active etc. Not much of this is implemented yet. I had intended to keep much of the text generation for this general, but ended up making it very specific.
So what I end up doing is writing a first pass of the text I want then look at which bits I can randomise, or adapt to the circumstances. In some very little will give, so I then write alternatives. So the last line of the porn mag text about it being well-thumbed is currently intact, and I've written a couple of alternatives for the entire line (one about it having been handled quite roughly, but not as roughly as the chap/lass on page X, and another similar one about the binding being loose). If I can think up enough lines for this I'll have it included always - if not I'll make it so there's a chance it gets skipped. Or I may add a completely different type of comment, or use it as an alternative for the previous comment about there being an informative article on caravels (or moustache-grooming, oiling-ones cricket bat etc...).
However a lot of the time I separate out lots of componenents of a sentence and randomise them/adapt them. Here's an example of a piece of text that you can get if you've fetched sugary stuff for the fairy queen, and then try to talk to her again (in my version of fairies sugar makes them go a bit nuts).
I am Wendy, Queen Whimsy's Lady-In_Waiting. If you're looking for her majesty I'm afraid you're out of luck. She went a bit mad with the marmalade you fetched and is now ripped to the tits on the stuff. She was last seen heading toward the poppy field with plans to teach the mice to play Hopscotch.
This is the first time we've met Wendy, so she tells you her job, she won't next time. The next line references "her majesty" - this is randomly chosen (her majesty, the queen, Queen Name, her highness etc.). "I'm afraid" is optional (bits like this seem to work well - the fairy queen has optional "quite frankly"s and the like which change the structure of the sentences nicely). "you're out of luck" isn't randomised yet but will be. In the next line "went a bit mad with" is randomised ("over indulged in", "took a little much of" etc.), "marmalade" is quest-dependent (could be honey or jam for example), and "ripped to the tits" is also random ("a little bit squiffy", "off her pretty little bonce" etc.). The last line is similar - the location, critter and activity all random but all chosen to be things fairies would know about. I want to get some alternate behaviours in here to add variety, so I have one where she goes off to sort the wildflowers into alphabetical order, for example.
What I still mean to do is add completely different sentence constructions for some lines. So rather than "If you're looking for her majesty I'm afraid you're out of luck" you might just get "The queen's unavailable right now." for example.