Show us yer programming projects!

Coders forum. Discuss techniques, swap code snippets, ask for help etc. relating to all forms of software development.
Post Reply
User avatar
zip accident
Sheepie Whore
Sheepie Whore
Posts: 13928
Joined: Sun Feb 20, 2005 1:58 pm 0
Location: Bristol, UK

Re: Show us yer programming projects!

Post by zip accident »

Orangy Tang wrote:
Mark wrote: Much of this is already random, so the species and title change accordingly, and instead of the line about the candles, you might get a comment on how tricky it's going to be to get the stains out of the chaise-longue, or whether the hostess trolley was engineered to withstand the kind of treatment it's getting. Lots more to do though - and this is just one outcome of several that I plan to do for finding an item in the woods.

Great fun to work on, but slow-going.
This looks really neat!

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?
Natural language, in it's full glory is a difficult subject. It's not been done yet because it's difficult. Look at Universal_grammar if you want to know more, which for a programmer is probably not an effective use of their time.

As a bodge job, consider the 1960's Eliza that's a program that was the leading edge of AI at the time, there should be examples of it about in source code.
"My way is the way of not fighting":- the book of Enter the Dragon.
User avatar
tufty
Sheepie Whore
Sheepie Whore
Posts: 12524
Joined: Fri Jan 07, 2005 4:52 pm 0
Location: French Alps

Re: Show us yer programming projects!

Post by tufty »

zip accident wrote:As a bodge job, consider the 1960's Eliza that's a program that was the leading edge of AI at the time, there should be examples of it about in source code.
or https://olabini.com/blog/2008/09/language-generation/
"massive retard™", "full of shit™", "tiny bitch™", "retarted™", "a bit of a one trick pony™", "petty™", "simple minded idealistic twat™", "miserable humourless fucker™"
adam
Baaaaaa!
Baaaaaa!
Posts: 4418
Joined: Sat Jun 24, 2006 9:15 pm 0

Re: Show us yer programming projects!

Post by adam »

thanks simon, theres this one too (python) http://nltk.org/
User avatar
Mark
Baaaaaa!
Baaaaaa!
Posts: 3611
Joined: Mon Apr 22, 2002 7:53 pm 0
Location: England

Re: Show us yer programming projects!

Post by Mark »

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.
Benevolent Dictator of Bearcat Games
Twitter: #BearcatGames
User avatar
failrate
Baaaaaa!
Baaaaaa!
Posts: 2354
Joined: Sun May 23, 2004 6:54 am 0
Location: Sandy Eggo
Contact:

Re: Show us yer programming projects!

Post by failrate »

I've tried to do similar things for a long-term labor of love I've been working on. My problem is that I can either get well-structured sentences randomly, or I can get well-structured game data generated randomly, but my code falls to bits when I try to combine them.
User avatar
Darkflame
Sheepie Whore
Sheepie Whore
Posts: 18236
Joined: Mon Mar 31, 2003 11:06 am 0
Location: Not the UK

Re: Show us yer programming projects!

Post by Darkflame »

I have tried to do the same thing in the past.
I could easily get grammatically correct total gibberish - merely by following "subject object verb" patterns in various combinations. Also question/response was fairly easy.
But, all gibberish.

In the end I also just used template text and randomized it as much as I could, based on parameters.
The results are here: http://www.fanficmaker.com/beta/Fanficmaker.html
Quickly becomes very labor intensive though to get a decent number of combinations per paragraph - and largely I failed.
adam
Baaaaaa!
Baaaaaa!
Posts: 4418
Joined: Sat Jun 24, 2006 9:15 pm 0

Re: Show us yer programming projects!

Post by adam »

i met someone who autogenerated a paper for his degree or masters i think it was, came back with the comment "don't really understand this but looks interesting, b+"
User avatar
failrate
Baaaaaa!
Baaaaaa!
Posts: 2354
Joined: Sun May 23, 2004 6:54 am 0
Location: Sandy Eggo
Contact:

Re: Show us yer programming projects!

Post by failrate »

I've tried templates. I've also tried statistical analysis of some text, and that worked very nicely as well. Basically something like a generated Markov chain, but with trigrams instead of single words. Then, I made a choose-your-own-adventure (sort of) generator.
I'd recommend downloading a bunch of sci-fi off of project gutenberg for it.
1. 'consume' the plaintext
2. run 'produce-branch-interactive'
Attachments
scN.py
(7.31 KiB) Downloaded 12 times
User avatar
Mark
Baaaaaa!
Baaaaaa!
Posts: 3611
Joined: Mon Apr 22, 2002 7:53 pm 0
Location: England

Re: Show us yer programming projects!

Post by Mark »

Having done a little more work today I thought I'd elaborate on the kind of thing that's taking me so much time.

The fairies are just one of a number of tribes I plan to create. If you find the home of the fairies you get a first time visit message, where the queen of the fairies asks for your name. If you return obviously she now knows you now so the text changes, and the plan is to make it so that if you become friendly or hostile the text develops accordingly.

If you visit after 6 pm the fairies are in bed (each tribe has a bedtime - I reckon fairies get an early night (though pixies may well have all-night parties :))), so there's different text for that. But if you haven't already met the fairies I figure you need to know that this location is significant even though you don't know why - so that's handled with text recommending you return.

So this in turn creates a situation where you visited first at night when they were asleep and were told this was significant, and then return in day time and meet the queen for the first time. So I have to handle that too. You can't stumble into a fairy glade that you already suspected was a fairy glade.

Basically, a lot of the effort I'm putting in is to make text situational and based on what you've done. Acknowledging the player's actions is one of the key goals. It means I'm writing an awful lot of text that won't get seen often, but I'm hoping when it is seen it's appreciated. Or at least read, because it will be different because last time you did stuff in a different order.
Benevolent Dictator of Bearcat Games
Twitter: #BearcatGames
User avatar
failrate
Baaaaaa!
Baaaaaa!
Posts: 2354
Joined: Sun May 23, 2004 6:54 am 0
Location: Sandy Eggo
Contact:

Re: Show us yer programming projects!

Post by failrate »

That's a similar conundrum to what I'm dealing with. One possible solution is to make it very replayable, like a rogue-like.
User avatar
super charlie
Baaaaa!
Baaaaa!
Posts: 1809
Joined: Wed Mar 31, 2004 7:53 pm 0
Location: Ipswich, suffolk
Contact:

Re: Show us yer programming projects!

Post by super charlie »

New thing! Made a little prototype and have begun porting my stuff over to C so it'll work on the vita, which is where this thing is headed:



prototype's just for look and feel.

Cheers
Charlie
Visit my website here to have a look at my game.
User avatar
tufty
Sheepie Whore
Sheepie Whore
Posts: 12524
Joined: Fri Jan 07, 2005 4:52 pm 0
Location: French Alps

Re: Show us yer programming projects!

Post by tufty »

Neat!
"massive retard™", "full of shit™", "tiny bitch™", "retarted™", "a bit of a one trick pony™", "petty™", "simple minded idealistic twat™", "miserable humourless fucker™"
User avatar
super charlie
Baaaaa!
Baaaaa!
Posts: 1809
Joined: Wed Mar 31, 2004 7:53 pm 0
Location: Ipswich, suffolk
Contact:

Re: Show us yer programming projects!

Post by super charlie »

Thanks! I'm trying to get it feeling nice and swoopy between levels, and having colours that'll do justice to the vita's amazing screen! At some point i'll probably put a game in there too! ;)
Visit my website here to have a look at my game.
User avatar
nyarla
Baaaaaa!
Baaaaaa!
Posts: 2820
Joined: Tue Jan 14, 2003 1:53 pm 0
Location: i said kiss me you're beautiful these are truly the last days
Contact:

Re: Show us yer programming projects!

Post by nyarla »

YEAH! That's ace, I'm stoked you're doing a Vita thing too :D
User avatar
nyarla
Baaaaaa!
Baaaaaa!
Posts: 2820
Joined: Tue Jan 14, 2003 1:53 pm 0
Location: i said kiss me you're beautiful these are truly the last days
Contact:

Re: Show us yer programming projects!

Post by nyarla »

speaking of vita.... i remember posting the first pic of the mazes from my forget-me-not game in this thread what... over two years ago! well yeaaah i'm back at it again making a new super version, mostly from scratch..

Image
Image
Image

not really going to use silly backgrounds like those, just been messing around tonight with feedback bits that were already there from that last tunnel thing i posted in here... it will probably eventually look much like the original but higher res, more variety and animation and only a light dusting of trippy.
Post Reply