A Look into our Improved Conversation System
Published on November 19, 2009 By ScottTykoski In Elemental Dev Journals

Before Elemental, most of us worked on a little title called Galactic Civilizations 2. In this game, you would do spend a significant amount of time conversing with AI players. They would plead, threaten, and barter with you in as intelligent a fashion as we could muster, with much of that 'intelligent' feeling coming from the PAGES of conversation text written.
 
Based on everything from relations to military might, the AI would pop up with dynamic dialog that changes based on gameplay. Needing similar dialog text for Elemental, and knowing the annoyances of the GC2 system, we've been able to implement a conversation system that's incredibly extensible that will allow awesome depth and realism to your/our AI opponents.

With that said, let's do a 'not as awesome' adventure through the new FlavorText XML...


<Topic>
Each section of flavor text has a 'topic'. When certain situations arise ('Step into Foreign Territory', for instance) the game will look for FlavorText that fit.
 
<Text>
The actual flavor text to use. This can have nested naming tags that allow you to interject the world name, faction names, etc.  The game accepts multiple <Text> values, storing them all and returning a random one whenever requested.
 
<SpeakingFaction>
<ListeningFaction>

For story and background specific text, we once again have the ability to specify dialog by faction, and like GalCiv2, you can also couple it to a Listening race to provide Race-To-Race backstory rich dialog.  If no factions are specified, the FlavorText is assumed to be for ANY faction.
 
Now, before you fall asleep, this is where Elemental's Flavor Text get's interesting....
 
<Rule>
This is where things get interesting.  In the GalCiv2 system, much of the more dynamic assigning of text had to be done in code. You'd have topics called DeclareWar_LowerDiplomacy,  DeclareWar_HigherDiplomacy, and DeclareWar_BiggerArmy, each with flavor text for a race declaring war who has a high diplomatic ability, low diplomatic ability, or a stronger army.  This wasn't HORRIBLE, but it did restrict the untethered creativity of the writers....the moment they wanted text for Declaring War by a race who had Low Diplomacy AND a Big Army they would have to dig into code.
 
This time, we have stackable RULES, which can identify special player requirements before using them in conversation....
 
 
- Race of Men -
0 - A Kingdom speaking
1 - A Kingdom speaking to another Kingdom
2 - A Kingdom speaking to a Fallen nation

- Fallen Race -
10 - A Fallen race speaking
11 - A Fallen race speaking to another Fallen Race
12 - A Fallen Race speaking to a Kingdom nation 

- Military Might -
20 - Speaker has a MUCH STRONGER Military than the Listener
21 - Speaker has a Slightly STRONGER Military than the Listener
22 - Speaker has approximately EQUAL Military Might as the Listener
23 - Speaker has a Slightly WEAKER Military than the Listener
24 - Speaker has a MUCH WEAKER Military than the Listener 

- Diplomatic Skill -
30 - Speaker is MUCH MORE DIPLOMATIC than the Listener
31 - Speaker is SLIGHTLY MORE DIPLOMATIC than the Listener
31 - Speaker is EQUALLY DIPLOMATIC than the Listener
33 - Speaker is SLIGHTLY LESS DIPLOMATIC than the Listener
34 - Speaker is MUCH LESS DIPLOMATIC than the Listener


So now the coders can unhide hundreds of different situations for the flavor text XML to tap into, which can be used at the writers discretion. The game will take these rules, crunch some numbers to determine the most applicable one, and bring that up to the player.
 
Have a dragon on your side, but a weak economy and low essence?  Imagine your enemy noting this and sending over a kind reminder...
 
'Your economy is broken and your magic has been spent. Even your mighty friend cannot save your heart from my blade. Give me your lands and perhaps I will show mercy.'
 
I feel intimidated and I'm just playing in my head. 
 
<RevisitedTopicBarrier>
The last value you can set is the 'Revisited Topic' barrier...basically the number of times this topic has to have come up before a given FlavorText is used.
 
Perhaps you keep grabbing artifacts within a peaceful neighbors territory. First it's a simple 'Pardon, friend. Perhaps you could refrain from the taking of lost items across our countryside?'. You keep doing it, and you get a 'Again, we ask that your units not pillage the lost goods from our lands.'.  One more snatched treasure brings up a stern, 'Your lack of respect disappoints me. I am breaking all treaties between out nations and demand that you leave our borders at once.'
 


Cool, eh? And all data driven!
 
Now obviously this creates an IMMENSE matrix of possibilities, and while we'll fill in the obvious and more likely ones, the system is set up to allow <FlavorText> entries to be read in from any file. We expect many mods that are extend and improve upon the conversations that popup throughout each game.
 
Some of my best GC2 memories involve being surprised by the intelligence displayed by the computer players (even if artificial). A similar system in Elemental will go a long way to bringing weight and history, and 'soul' to the inhabitants of each randomly generated world.


Comments (Page 1)
3 Pages1 2 3 
on Nov 19, 2009

Stackable conditions and escalating warnings for diplomatic speak should be very interesting to see.  Good luck advancing the idea and making it work.

on Nov 19, 2009

Awesome! I expect to see some funny ones thrown in, too. Maybe something about bear calavary?

on Nov 19, 2009

Good to see a dev post from you Boogie!

And this sounds like a great thing that even the novice modders could get into! Definitely sounds like this could be a very rich and deep aspect of the game, especially after a few dozen modders get ahold of it!

on Nov 19, 2009

This is very nice to hear, i would agree with your last statement, and am glad to see that you guys have managed to improve an already great system!

on Nov 19, 2009

Yes more ways for my enemies to tell me how much they hate me... When I betray them or win the game! Come on give us a new build already... Please.    

on Nov 19, 2009

Hmmmm........ I'm a very happy modder now......

on Nov 19, 2009

That sounds Awesome brother. Well done, well done indeed.

I guess I'm going to have to dig out my Dragonlance books and start copying coversations sooner then I thought.

on Nov 19, 2009

This is just a great base for a conversation engine! I like it!  I'll then like to add a few points (as a wish, or something to expand on).

1) Rgds to these rules, there is a lot of comparison clauses like 'XXX is Much Stronger than YYY'.   I like to make it that the result of the comparison is not always 100% accurate.  For example, if the AI opponent is Much more diplomatic than you, the favored text does not necessary use 20 all the time.  Maybe the engine will use 30 40% of time, 31 30% of time, 32 20% of time etc.   Thereby gamer cannot accurately guess what level of diplomacy the AI has.  This kind of competitive info should not be given away so easily (from the perspective of both sides)

2) Secondly, gamer should be given a chance to pick from one of the top 3 choices based on the result of 1).  This is especially important in multiplayer games.   I don't want to give away the fact that my Military strength is way higher than yours, considered there is fog of war & etc, that you don't otherwise possibility know how strong/weak I am.

3) This is an awesome engine that should not be restricted just to fraction vs fraction diplomacy situations.  Heroes, Sovereigns or independent units should be able to use it too.  This can provide more flexible RPG element.   This engine can be used to script 2 way conversation for every situation.   For example, when your Sovereign meets a NPC defending a gate, depending on how diplomatic the Sovereign is, how big his stack is, or how much $ he is willing to pay, the gatekeeper will take appropriate scripted action like defend at any cost, open the gate or negotiate a higher price to open the gate.

I assume this engine can evolve easily to 2 way conversation.  However, IF it can be easily evolve into scripted actions, it will be even better.   In diplomacy, one can only have a limited number of ways to answer the 'flavored text', i.e. declare war or not.   But on other conversations, the engine will need to have a way to either link to AI or many more scripted actions.

 

on Nov 19, 2009

That system sounds great. I've never really thought much of the diplomacy text in TBS games since most of it is rather generic and dull. This system sounds like it could change all of that.

on Nov 19, 2009

mmmm nom nom nom flavour  nom nom nom

on Nov 19, 2009

not just flavor ... but conversations with an AI that has the illusion of thought. (as a possibility). Certainly would be nothing more than a cleverly crafted illusion .. but still tis a good start ....

on Nov 19, 2009

This looks nice.  Remember to add the <locale> tag so it's easy to translate into other languages.  In multiplayer, AI player 1 could send a message to me in English, and a message in, say, Portuguese to a player in Brazil.

For <SpeakingFaction> and <ListeningFaction>, it'd be helpful if the tags recognized lists of factions.  That way we wouldn't need to repeat large blocks of text if we wanted the text to apply to conversations between (A OR AND (C OR D).

I have a feeling this is going to wow me as much as Ultima V did back in the day...

on Nov 19, 2009

My own favorite GC2 moment was when I got a message to this effect from one of my allies...

 

Hello, "ally".  We cannot help but notice that you are building up a large fleet of heavily armed ships just outside the orbit of one of our planets.  Now, our advisors have told us of so-called "strategy games" that were once popular on your world, in which the player confronted shallow mimicries of intelligence who would not notice such looming treachery.  Perhaps you learned to govern by playing these games, but we are not computer simulacra and we are to be taken seriously!

 

...that said, as you probably know, we don't actually have the resources to, uh, do anything about this.  We just wanted you to know that WE KNOW WHAT YOU'RE DOING.  So there.

on Nov 19, 2009

I remember that one too.  It was a great moment!

on Nov 19, 2009

31 is a value twice for Diplomatic Skill.

 

3 Pages1 2 3