Elemental: Let's Talk, Good Sire.

A Look into our Improved Conversation System

By on November 19, 2009 4:39:49 PM from Elemental Forums Elemental Forums

ScottTykoski

Join Date 03/2001
+109

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.

Locked Post 45 Replies +1
Search this post
Subscription Options


Reason for Karma (Optional)
Successfully updated karma reason!
November 19, 2009 5:36:14 PM from Elemental Forums Elemental Forums

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

Reason for Karma (Optional)
Successfully updated karma reason!
November 19, 2009 5:43:14 PM from Elemental Forums Elemental Forums

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

Reason for Karma (Optional)
Successfully updated karma reason!
November 19, 2009 6:01:25 PM from Elemental Forums Elemental Forums

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!

Reason for Karma (Optional)
Successfully updated karma reason!
November 19, 2009 6:01:31 PM from Elemental Forums Elemental Forums

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!

Reason for Karma (Optional)
Successfully updated karma reason!
November 19, 2009 6:22:54 PM from Elemental Forums Elemental Forums

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.    

Reason for Karma (Optional)
Successfully updated karma reason!
November 19, 2009 6:43:25 PM from Elemental Forums Elemental Forums

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

Reason for Karma (Optional)
Successfully updated karma reason!
November 19, 2009 7:17:12 PM from Elemental Forums Elemental Forums

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.

Reason for Karma (Optional)
Successfully updated karma reason!
November 19, 2009 9:10:35 PM from Elemental Forums Elemental Forums

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.

 

Reason for Karma (Optional)
Successfully updated karma reason!
November 19, 2009 9:27:34 PM from Elemental Forums Elemental Forums

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.

Reason for Karma (Optional)
Successfully updated karma reason!
November 19, 2009 9:52:42 PM from Stardock Forums Stardock Forums

mmmm nom nom nom flavour  nom nom nom

Reason for Karma (Optional)
Successfully updated karma reason!
November 19, 2009 10:12:22 PM from Elemental Forums Elemental Forums

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 ....

Reason for Karma (Optional)
Successfully updated karma reason!
November 19, 2009 10:45:52 PM from Stardock Forums Stardock Forums

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...

Reason for Karma (Optional)
Successfully updated karma reason!
November 19, 2009 10:47:49 PM from Elemental Forums Elemental Forums

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.

Reason for Karma (Optional)
Successfully updated karma reason!
November 19, 2009 11:14:30 PM from Stardock Forums Stardock Forums

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

Reason for Karma (Optional)
Successfully updated karma reason!
November 19, 2009 11:49:07 PM from Elemental Forums Elemental Forums

31 is a value twice for Diplomatic Skill.

 

Reason for Karma (Optional)
Successfully updated karma reason!
November 20, 2009 2:35:56 AM from Elemental Forums Elemental Forums

Good luck advancing the idea and making it work.

Yes. I really hope that this idea will have a better ending than the Epic Story Generator in GC2 which was cool on the paper but horrible to implement. It has ended as an event logger (which is useful to remember what has been done)

Reason for Karma (Optional)
Successfully updated karma reason!
November 20, 2009 3:03:20 AM from Elemental Forums Elemental Forums

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 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.

Flipping awesome...great post! Given Stardocks track record for post-release love, I'm sure such a foundation is going to yield great goodness in the long run.

Reason for Karma (Optional)
Successfully updated karma reason!
November 20, 2009 3:16:18 AM from Elemental Forums Elemental Forums

having a wide variety of things to be said that relate to the situation at hand is something I really  enjoy.   Both as a player and somebody who wants to create such text (this is all going to be in python right?)

 

I am glad you have it set out here.  I might want to throw in a tid-bit.   Here you have "military might" being compared, but might you also want magical might compared?  Or possibly relating to the strategy choosen by the AI?  (Focusing on heroes vs. focusing on armies vs. focusing on super-channeler)

 

I can imagine a leader saying something like "I grow tired of the tension at our boarders.  Prepare to taste the cold steel of my army"   but that would not make much sense if they were 'going-gandalf' and were basically charging in with just their channeler and a few heroes or a dragon.   The dragon might make the military might higher than an army would, but certainly there is no cold steel here.   I would not expect you to have specific dialog refering to rare fantastic creatures, but the AI player was specifically building his economy (or at least essence distribution) based around "powerful channeler + heroes" mentality.  So it would be more fitting to say something like "I have grown tired of the tension at our boarders.  You will soon fall before my <insert most offensive powerful>"

 

(of course one could have better dialogue than what is above, but its just examples)

 

 

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.

you know what assuming does...   But a 2 way conversation is a bunch of 1 way messages.   Just because the code is setup as "faction sending message" and "faction(s) hearing message"  doesn't mean the listening faction(s) can't respond.  Instant messaging is setup very similarly to what is above, but people hold conversations through the "1 person sends, other person receives" format.  I guess you could say "If both parties are talking at the same time, nobody would be listened"

 

I put "(s)" on the end of faction just  because I would like to have 'wizard council' type diplomacy able to occur.   In Civ4, there was the UN.  And GalCiv2 had the  things you had to vote on from time to time.   But it wouldn't fire up a real discussion about it.

In theory there should be something similar to a 'group chat' where the factions put in a message or request that is sent to several people at once, and they can respond to anything put there.   So if there is agreed that a wizard council should be  formed to dictate the rules of Elemental, and all war declarations then must be done through the magical equivelant to the United Nations,   then the responces to such actions should be put straight into the council room, rather than told to you later in a barrage of "you declare war on my friend, me smash you" messages. 

Also then as a group, factions could decide how things result.   So lets say faction A declares war on faction B...    Factions C would start a council with factions D, and E saying "I am going to join A, but only if you both agree to join faction A's side as well.   Then faction D could respond "I will if I get money" and faction E could agree with C and decide to pay D's request so they are all on the side with A against B.

I guess then you wouldn't just have 

<SpeakingFaction> 
<ListeningFaction>

you might also need something like <TargetFaction> to specify to which faction the statement is referring, while still allowing for the "listening factions" to hear the conversation. 

(perhaps this would be better for an "idea" thread, but it seemed related to the topic enough for me, AND came up in discussion)

 

Reason for Karma (Optional)
Successfully updated karma reason!
November 20, 2009 3:46:37 AM from Elemental Forums Elemental Forums

I like this -- "soul" goes a long way!

Have you also considered having <RULES> for diplomatic breakthroughs such as (advanced, supreme, etc.) language skill as well as <RULES> for language barriers that may exist between Fallen / Human or Humans and other creatures in the world (e.g. trolls, dragons, etc.)? For the latter, you could imagine that things might get lost in translation (unless you have purchased the applicable diplomatic breakthroughs), so that the flavor text is suboptimal, e.g.

"We thanks you very muchly. My fondness four your kindship has grown to horse-size proportions. May I have a bite of your gold pieces? The consequences are thought."

So not quite "my hovercraft is full of eels", but not great either.

For the first aspect I mentioned, that would simply include better versions of flavor text choices depending on your and your AI opponent's level of Diplo skill. Low levels might give you the choice, based on the <RULES>, "Here is the treaty," but higher levels might allow you to say, "Your Lordship's signature has never looked more majestic than on this seal." or something like that.

Reason for Karma (Optional)
Successfully updated karma reason!
November 20, 2009 4:47:32 AM from Elemental Forums Elemental Forums

The talk with AI is nice idea. However bartering in GCII was great. You can see the stance of the other civilisation without the need of clicking on some button again and again. I hope the barter will be similar.

Reason for Karma (Optional)
Successfully updated karma reason!
November 20, 2009 6:06:40 AM from Elemental Forums Elemental Forums

Boogie,

This looks really cool, thanks for sharing.  However, so that I don't exceed my gratitude quota, two questions:

1) "Cool, eh? And all data driven!"

Oh yea?

"

- 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

"

So what if another base race is modded in?  Do you have rule numbers for "Other Base Race 1", "Other Base Race 2", etc?  Or a custom rule that takes the name of a base race or such?  Will the modder have to pick one of the "base base races" to put it under?  That would work as long as no mod wanted more than 2 base categories like that, but 3 or more would be a problem.

 

2) I hope to be much less of a jerk on point number 2, though perhaps invoking even more coder pain: what do you think about adding a rule type that takes as a parameter the name of a python method to call that returns true/false depending on whether the rule is met?  That would allow a much higher degree of flexibility for us insane modders out here.

 

Many thanks, even if you just totally ignore what I just said it should be great

Reason for Karma (Optional)
Successfully updated karma reason!
November 20, 2009 11:14:24 AM from Elemental Forums Elemental Forums

Just as a suggestion, a flavor adder for this might be insulting haiku's.  Once during a comment thread fued with a deeply irritating person, I concocted a series of dog insult haiku's to describe the individual and it just drove him bonkers.  While this isn't for everybody, and you might need to put a "no insulting haiku" buttion in the diplomacy options, this could provide a lot of interesting alternatives and opportunities for the community to contribute. 

For referance, I am including some possibilities. 

dog wants to open door
he lacks opposable thumbs
and licks his own butt

your fleets mass nearby
this alliance is in peril
grasping ankles now


cockatrices come 
resistant to flaming bolts
pity they can't swim

your army is huge
your economy in ruins
out of towns to loot

all your friends marching
alongside you to battle
so you came alone

I'm sure there are many more that could add flavor to a variety of situations.

 

Reason for Karma (Optional)
Successfully updated karma reason!
November 20, 2009 11:39:12 AM from Elemental Forums Elemental Forums

While were on the subject, I want to give my biggest pet peave with game diplomacy. Every game I've ever played has this problem.

Real life diplomacy is a very complex thing. Countries make requests of one another according to their interests, which they may or may not want everyone to know. There are also intangible things like national pride thrown into the mix. When you are making a diplomatic system in a game, you can only approximate the innumerable variables governing foreign relations, and you can choose any of them to emphasize arbitrarily. Depending on what diplomatic factors are modeled, and which ones are ignored for simpliciites sake, the expected results of the same situation can be very different.

In real diplomacy, the participants often keep their cards close to the vest as they say, and they don't always give honest reasons for their replies. This is very often the case in games as well, as replies to diplomatic requests are often completely unfathomable to the player. This is the problem I am trying to point out! This is one area where real life and games ought to be different.

In real life, it is possible to investigate and make educated guesses regarding how a certain mysterious communication might serve a countries interests. We are all humans with similar needs after all. In a game, you have no idea how carefully the diplomatic AI is modeled, and you end up having to read the developers mind to guess what is willful deception and what is just a bug in the AI.

I would like to see a game where the AI wears it's heart on it's sleeve for the most part so I have a chance to understand how the system works. I'm not saying that the AI can't bluff or deceive, but I want a plausable explanation for every response so I can get a feel for what factors are important to the AI.

I've actually played games where anytime I come up with a proposal that is even remotely fair, the diplomatic answer is always and forever 'no'. I want reasons, and I don't want the reason to be that the AI is sacrificing its own interests to present a challenge to the player.

"Ok, I have a huge army and you are down to one territory and a handful of defenders who could be wiped out next turn, I offer you peace with no strings attached. What is your reply?"

"No."

No? Is there a reason for this or are you just a bugged AI??

The system proposed in the OP seems like a great step in the right direction.

 

 

 

Reason for Karma (Optional)
Successfully updated karma reason!
November 20, 2009 12:25:28 PM from Elemental Forums Elemental Forums

advisor and heroes should be taking parts of the discussion too.

Reason for Karma (Optional)
Successfully updated karma reason!
November 20, 2009 12:59:12 PM from Elemental Forums Elemental Forums

Just a random thought.  It wouldn't be too terribly complicated to have certain words be replaced with more nuanced words in the flavor text.

So for ex, for a greeting to Friendly Nation, you could have "Hello [friend]. Do you want to discuss our treaties?" 

and then depending on the exact level of Friendliness the [friend] could be replaced with 'fellow emperor' ,'friend', 'neighbor', 'good buddy', 'my BFF,' 'you super sock puppet master and future ruler of my world'. 

It just seems that it would let you have an even more granular level of detail in the text.

I guess you could accomplish this with the aforementioned system, you'd just have to add a bunch more conditions and would have a bunch of nearly identical sentences, which kinda seems inefficient.

Reason for Karma (Optional)
Successfully updated karma reason!
Stardock Forums v1.0.0.0    #101114  walnut1   Server Load Time: 00:00:00.0002969   Page Render Time: