Page 1 of 1
Does anyone know where diplomacy information is stored in the host file?
Posted: Sat Apr 17, 2021 10:08 pm
by Spore18
You may have seen another post about removing peace treaties, and this is directly related to that. There's a peace treaty that we really need to see removed in our game, and I'm perfectly willing to fiddle around in the host file to try to make that happen, I just don't know where to look. Given that the entire gamestate is defined by the host file, data on the state of diplomacy has to be in there somewhere, but with a lack of any labeling or relevant keywords that I can find it's probably just a series of integers somewhere. Does anyone happen to know which of the many, many series of integers in that file relates to diplomacy?
Re: Does anyone know where diplomacy information is stored in the host file?
Posted: Mon Apr 19, 2021 9:50 am
by Pocus
I'm looking at the old code base, but can't run it on this computer. I see that a treaty item or matrix is defined by several tags, here they are. It might help you figure where things are
const TagDIItem = '[TDII]';
TagDISingle = '[TDIS]';
TagDIParam = '[TDIP]';
TagDIFacUIDList = '[TDIFUL]';
TagTMIntListMatrix = '[TMILM]'; // TreatyMatrix IntegerList-Matrix
TagTMTreatyDB = '[TMTDB]'; // TreatyMatrix DiploItemDB
TagTradeTreatyParams = '[TTTP]';
Re: Does anyone know where diplomacy information is stored in the host file?
Posted: Mon Apr 19, 2021 9:53 am
by Pocus
I'm not allowed to publish the entire code, that's still a property of Slitherine, but here are some excerpts, if it can help you figure more.
I see there are two entities saved in the diplomacy code. One is a matrix, one is an object.
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// SERIALIZE
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function TTreatyMatrix.Serialize: string;
begin
Result := TagTMIntListMatrix +
fTreatyMatrix.Serialize +
TagTMIntListMatrix +
TagTMTreatyDB +
'NULL'{fTreatyDB.Serialize} +
TagTMTreatyDB;
end;
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// SERIALIZE
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function TDiploObject.Serialize: string;
begin
if fString1 = '' then fString1 := 'NULL';
if fString2 = '' then fString2 := 'NULL';
if fString3 = '' then fString3 := 'NULL';
if fString4 = '' then fString4 := 'NULL';
try
Result :=
'#DO#' +
ITS(fSenderFacUID ) + _delim1 +
ITS(fTargetFacUID ) + _delim1 +
ITS(fStartTurn ) + _delim1 +
ITS(fEndTurn ) + _delim1 +
ITS(fDefUID ) + _delim1 +
ITS(fState ) + _delim1 +
ITS(fRqDuration ) + _delim1 +
ITS(fSndMargin ) + _delim1 +
ITS(fRepMargin ) + _delim1 +
ITS(fWarscore ) + _delim1 +
ITS(fInteger1 ) + _delim1 +
ITS(fInteger2 ) + _delim1 +
ITS(fInteger3 ) + _delim1 +
ITS(fInteger4 ) + _delim1 +
ITS(fInteger5 ) + _delim1 +
ITS(fInteger6 ) + _delim1 +
fString1 + _delim1 +
fString2 + _delim1 +
fString3 + _delim1 +
fString4 + _delim1 +
'#DO#';
except
on E : Exception do
LogMsg(['TDiploObject.Serialize','Exception caught:', E.Message], _Critical);
end;
end;
Re: Does anyone know where diplomacy information is stored in the host file?
Posted: Mon Apr 19, 2021 10:06 am
by Spore18
omg thank you so much Pocus. The key was that #DO# delimeter, turns out the entire thing was stored on line 29 in our host file. Thank you for the specific code as well, that should be very helpful for finding the peace treaty within the line.
Re: Does anyone know where diplomacy information is stored in the host file?
Posted: Mon Apr 19, 2021 11:00 am
by Morgan
This is a wealth of information. I see now how the treaties are represented. Thank you very much!
Code: Select all
#DO#1000001|1000003|2657|2681|19|6|-1|0|0|0|0|0|0|0|0|0|NULL|NULL|NULL|NULL|#DO#
That's a peace treaty (19) between France (1000001) and Russia (1000003).
Code: Select all
#DO#1000001|1000002|2569|12568|15|6|-1|0|0|-11|0|0|0|0|0|0|NULL|NULL|NULL|NULL|#DO#
And that is a war (15) between France (1000001) and Great Britain (1000002) with a warscore of -11.
Thank you so much for bothering to look this up!

Re: Does anyone know where diplomacy information is stored in the host file?
Posted: Tue Apr 20, 2021 2:10 pm
by Pocus
Happy to help!