A quick and dirty explanation of Diplomacy.txt

Joined
Jan 12, 2001
Messages
309
Location
Hunt Valley MD
Saw a request for this on the Tech Support forum so here goes:

Diplomacy.txt is what drives the text displayed in diplomacy dialogs. It's a plain text file, no formatting. Comments are denoted by semicolons.

The file is broken into sections which correspond to specific game conditions. Each section begins with a #LABEL which denotes the game condition we're describing. Generally the labels are self-explanatory, but if you come across one you're not sure about, let me know and I'll try to find out what it's for.

This label is followed by four control lines, each starting with a # sign, which tell the game how to parse the section. The order of these lines is important as well, because it determines how the strings are organized / sorted.

I'll explain each control line in order:

#civ (0 or 1) - if true (1), this means the strings are grouped by and correspond to each civ in the game. If this is true you should multiply the total number of strings you need to create by sixteen. The order corresponds to the position of the civ in the BIC file (see the editor to figure this out). If this is false (0), the value of the #random control line (see below) should be set to true (1).

#power (0 or 1) - if true (1), the strings are next grouped by relative civ power. There are three possible values (in order): more powerful, equal power, and less powerful. This will triple the number of required strings. If you are sorting by civ, this means you'll need three power-based strings per civ.

#mood (0 or 1) - if true (1), the strings are next grouped by the speaking civ's mood (attititude) towards the other civ. There are three possible values (in order): happy with, indifferent, and angry with. This will triple the number of required strings. If you are sorting by civ, this means you'll need three mood-based strings per civ. If you are also sorting by power, you'd need three mood strings per power string, and three power strings per civ.

#random (1 - ??) - perhaps this value is better thought of as "numchoices" because that's what it really determines: how many choices the computer can pick from, per civ, power, and/or mood.

A quick formula to determine how many choices you're going to use is like this:

total number of lines = (16 * #civ) * (3 if #power == true) * (3 if #mood == true)* #random

And as mentioned before, the order of those control lines is important, because they're hierarchical starting from the top, i.e.:

<PRE>

_
_ | random 1
| mood + | random 2
| |_ random 3
| _
_ | | random 1'
C | power >| mood ~ | random 2'
i | | |_ random 3'
v | | _
i | | | random 1"
l | |_ mood - | random 2"
i | |_ random 3"
z | _
a | _ | random 1
t | | mood + | random 2
i | | |_ random 3
o | | _
n | | | random 1'
| power =| mood ~ | random 2'
1 | | |_ random 3'
| | _
| | | random 1"
| |_mood - | random 2"
| |_ random 3"
|
|
|
|
| power < ...
|
|_

_
C |
i |
v |
|
2 |
. |
. |
. |_

</PRE>

<P>
Replacement Strings are variables denoted by a dollar sign
(e.g., $LEADER0) which can be used in your strings. Each block of text should have a commented out list of recognized strings that you can use. DO NOT TRY TO USE DIFFERENT REPLACEMENT STRINGS in other text blocks as they will not work and could crash the game.

So let's look at an example:

#USERGIFT
#civ 0
#power 0
#mood 1
#random 1
"Please accept this gift as a token of friendship and goodwill."
"I offer you this gift as a token of goodwill."
"Accept this gift as a token of goodwill."

#USERGIFT denotes that this is a new block, and we can surmise that it's called on when the user decides to give a gift to the AI.

#civ 0 tells us not to worry about sorting by civ.

#power 0 tells us not to worry about sorting by power.

#mood 1 tells us we are sorting by mood, which means we will have 3 choices times the number of random choices.

#random 1 tells us there is only one random choice per player mood.

So, we end up with three choices, one if the human player has good relations with the AI it's gifting to, the next if it's somewhat indifferent, and the last if it doesn't have such a good friendly relationship.

Hopefully this helps explain it, the best way to really see what I've explained is to pop open diplomacy.txt and give it a whirl.

Dan

edit: fixed formula
 
Good job, Dan! :goodjob:

I wonder what the modmakers' life will be like without people like you, Dan. ;)

This is certainly a very helpful bit of information especailly for those who totally change the Civs. :)
 
Dan, the formula you posted, total number of lines = (16 * #civ) * #power * #mood * #random, is incorrect, because it could yield a result of zero. There is no formula for it unless you include logic operators.
 
Originally posted by skywalker
Dan, the formula you posted, total number of lines = (16 * #civ) * #power * #mood * #random, is incorrect, because it could yield a result of zero. There is no formula for it unless you include logic operators.
Yes, you are right, but I think that people will get it any way.
 
Heartfelt thanks, again, Dan
If you have a moment would you expand briefly on the editing process.
Is it ok to insert or remove lines, provided the civ, power, or mood values are amended, and move the rest of the text downwards or upwards as appropriate. For example by altering civ 1 to civ 0 presumably fifteen 16ths of a group could be removed?
In other words is the space for the text strings allocated by the values in civ, mood etc rather than by a constant elsewhere in the program?
One other miscellaneous clarification. Reading the text it is clear that when the AI speaks it is the human who is the more powerful in the first lines. For mood read relations. Thus relations are happy in the first lines. When the human speaks I have not noticed any lines where the power is a factor, but presumably the human would be again more powerful in the first lines?
 
Thanks, Dan, for all the info.
I have created a utility program that edits the diplomacy.txt file via a graphical interface. Thanks for your clear explanation of this file.
I have added so many new quotes to the diplomacy.txt file!! It's great! Once again. Thanks for your help.

See the diplomacy editor here:
Civ III Diplomacy Editor
 
Top Bottom