Stu's Rusty Bucket

Fishguts I : Talking

Been working over the talk tree. Apparently Ultima 4 had each character have only two things they could say, and each location had a limit of the number of characters. Each keyword you typed was also restricted to 4 characters. (Its like a bad Scott Adams verb noun parser).

I think the smallest memory constraint I have to deal with is the GP32 has 8mb ram which should be plenty.








MachineRam
GP328
GP2X64
PSP32
DS4
PCn.a

I dont plan on supporting the DS, and PC’s today have more ram than the game needs.

Anyway, I’m getting side tracked. I dont need to squeeze bytes in the same manner as some of these old games did (but I do need to be conservative).  Realisticly it wouldnt have cost much more space wise to add some extra dialogue into U4.

The conversations will be keyword triggered. You (T)alk/Transact with a character, and they will say something. Internally these sentences have flagged words that get enabled in your dictionary. eg:

If Gumby says “I was once friends with Pokey”, Pokey might be a keyword. Until he says this sentence the Pokey keyword wont be activated, and if you ask about it it will returnfalse.

eg:

local talk_GUMBY {
    name 
"Gumby",
    
sex "it",
 
    
greet "Hi I'm Gumby. Lets be friends!"
    
keys { 1 }  -- for friends
    
    data 
{
        {
            key 
{ 1 } -- word for "friends",
            
good_result "I once had a friend called Pokey",
            
good_keys { 2 } -- word for pokey
        }
,
        
        
{
            key 
{ 23 },  -- pokeyhate
            good_result 
"Yep, I hate pokey now.",
            
bad_result "Who? I dont know, but I'd love a lemonade, fries or icecream",
            
bad_keys { 456 } -- 4=lemonade5=fries6=icecream 
        }
,
        
        
{
            key 
{ 456 },  -- any of 45, or 6
            good_result 
"Mmmm " .. GetTransactionWord() .. ". That would taste great right now.",
            
bad_result "No thanks, I'm not interested in " .. GetTransactionWord() .. ""
        
}
    }
}

The above is a contrived example of my talk data structure. Keys are keywords that are boolean on or off. When you first talk to Gumby, he will issue his ‘greet’ and the system will activate the keyword for friends. When you ask Gumby about ‘friends’, he will give you his pokey keyword. If you ask about pokey before you ask about friends, Gumby will pretend he does not know Pokey anf give you a different track on icecream or fries or lemonade. If you ask about lemonade.

Every action can have a good response with good keys or a bad response with bad keys.

Before the lua code generate is run it looks like this

char "Gumby""it"
greet "Hi I'm Gumby. Lets be |friends|!"

key "friends"
give "I once had a friend called |Pokey|"

key "pokey""hate"
give "Yep, I hate pokey now."
bad "Who? I dont know, but I'd love a |lemonade|, |fries| or |icecream|"

key "lemonade""fries""icecream"
give "Mmmm %1. That would taste great right now."
bad "No thanks, I'm not interested in %1"

Code Generation is good. Lua’s global string table is good, since there is only ever 1 copy of a string in memory, so no memory is wasted on duplicate string space. I could even optmise the codegen more to pullout the most frequently used words but that would be minor minor space savings at a cost of increased code size, plus scripts are localised, the script for Town X is only loaded when you are inside Town X.

One change to my codegen I would like to make is to allow for synonyms so this;

bad "Who? I dont know, but I'd love a |lemonade|, |fries| or |icecream|"

would become this
bad "Who? I dont know, but I'd love a |lemonade(soda,pepsi)|, |fries(chips,frenchfries)| or |icecream|"

giving synonyms (well extra keywords) to lemondate (soda and pepsi) and chips and frenchfries to fries.

This would auto expand keywords in the line

key "lemonade", "fries", "icecream"

to
key "lemonade", "soda","pepsi", "fries", "chips", "frenchfries", "icecream"

the knock on would be
bad_keys = { 4, 5, 6 } -- 4=lemonade, 5=fries, 6=icecream

being converted to
bad_keys = { 4, 5, 6, 7, 8, 9, 10 } -- 4=lemonade, 5=soda, 6=pepsi, 7=fries, 8=chips, 9=frenchfries, 10=icecream

This would cover 2 bug scenarios (keywords that are never given) and 2, keywords that are given across towns (global keywords).  There will be a lot of keywords that are global but some most definatly shouldn’t be. I may prefix globals, so I can trap any that become globals that shouldnt be......

Posted by on 04/06 at 11:54 AM    
Filed Under : ComputersDevelopmentFishguts
Comments are closed There are no comments on this entry.

Next entry: Fishguts I : State

Previous entry: Bazaar

<< Back to main