[SDK] Advanced Diplomacy

Afforess

The White Wizard
Joined
Jul 31, 2007
Messages
12,239
Location
Austin, Texas
Advanced Diplomacy

Version: 1.05
Last Update: 8/06/10

First off, I must give credit to Dom Pedro II. He originally had the idea for much of what is Advanced Diplomacy, and had the framework for the code; but it was incomplete and non-functional. I saw his idea in his Test of Time mod, used his framework, and completed it, added working AI, and made it functional. If it was not for Dom Pedro II, this would not exist.

Also, a forewarning: my short playtests should no obvious bugs, but seeing how this is pulled from the large codebase in A New Dawn, there may be bugs from mis-merged or forgotten code. If you find a bug, report it here, and I'll do my best to fix it.


New Trades:

  • Embassies
    • Embassies are a vital agreement that must be made before Open Borders or any form of alliance can be made with any other civilizations.
  • Right of Passage
    • Rights of Passage are a limited form of Open Borders. They only allow non-combatants and trade through the borders.
  • Contact
    • Players can sell contact with other civilizations, if they have not met the third party.
  • Trading Workers
    • Players can buy and sell workers on the market.
  • Trading Military Units
    • Siege machinery can be bought and sold to other players.
  • Trading Corporation HQ's
    • Players can sell and buy the headquarter of corporations.

The AI:
The AI will make trades for all different options, except for Corporations, (I am unsure there is ever a situation where the AI should sell or buy a corporation HQ); however the AI will properly value a Corporation HQ if a human offers to buy or sell one. There are several new trades for old items in Advanced Diplomacy as well. The AI will use techs and gold to encourage other AI's to declare war or trigger embargo's on their enemies. The AI will also sue for peace for it's friends.

Various Screenshots:

Spoiler :








To Players:
Advanced Diplomacy is fully functional as a standalone mod component, if you would like to test out the changes yourself. Simply place the folder into your Mods directory, and choose it in the mod menu in-game.

To Modders:
There are 2 new XML tags controlling which workers and units can be traded, as well as 2 new XML tags for when Embassies and Right of Passages are unlocked. There are also 4 new XML tags for Leaders, for attitude trading thresholds for the new trades. They are all fairly well named and self explanatory. If you have any questions, please ask.

Download Here
 
I love you for releasing this as standalone modcomp. :)

Is there also a new game option included? Or is it hard to make those changes controlled by one?


Edit: I just saw the new game option. <3
 
You have forgotten to add something to CvPlayerAI.h:

PHP:
1>CvPlayerAI.cpp(15303) : error C2065: 'CONTACT_TRADE_JOIN_WAR' : undeclared identifier
1>CvPlayerAI.cpp(15305) : error C3861: 'CONTACT_TRADE_JOIN_WAR': identifier not found, even with argument-dependent lookup
1>CvPlayerAI.cpp(15420) : error C3861: 'CONTACT_TRADE_JOIN_WAR': identifier not found, even with argument-dependent lookup
1>CvPlayerAI.cpp(15420) : error C3861: 'CONTACT_TRADE_JOIN_WAR': identifier not found, even with argument-dependent lookup
1>CvPlayerAI.cpp(15460) : error C2065: 'CONTACT_PEACE_PRESSURE' : undeclared identifier
1>CvPlayerAI.cpp(15462) : error C3861: 'CONTACT_PEACE_PRESSURE': identifier not found, even with argument-dependent lookup
1>CvPlayerAI.cpp(15474) : error C3861: 'CONTACT_PEACE_PRESSURE': identifier not found, even with argument-dependent lookup
1>CvPlayerAI.cpp(15474) : error C3861: 'CONTACT_PEACE_PRESSURE': identifier not found, even with argument-dependent lookup
1>CvPlayerAI.cpp(15497) : error C2065: 'CONTACT_TRADE_STOP_TRADING' : undeclared identifier
1>CvPlayerAI.cpp(15499) : error C3861: 'CONTACT_TRADE_JOIN_WAR': identifier not found, even with argument-dependent lookup
1>CvPlayerAI.cpp(15609) : error C3861: 'CONTACT_TRADE_STOP_TRADING': identifier not found, even with argument-dependent lookup
1>CvPlayerAI.cpp(15609) : error C3861: 'CONTACT_TRADE_STOP_TRADING': identifier not found, even with argument-dependent lookup
1>CvPlayerAI.cpp(15637) : error C2065: 'CONTACT_EMBASSY' : undeclared identifier
1>CvPlayerAI.cpp(15639) : error C3861: 'CONTACT_EMBASSY': identifier not found, even with argument-dependent lookup
1>CvPlayerAI.cpp(15655) : error C3861: 'CONTACT_EMBASSY': identifier not found, even with argument-dependent lookup
1>CvPlayerAI.cpp(15655) : error C3861: 'CONTACT_EMBASSY': identifier not found, even with argument-dependent lookup
1>CvPlayerAI.cpp(15723) : error C2065: 'CONTACT_TRADE_CONTACTS' : undeclared identifier
1>CvPlayerAI.cpp(15725) : error C3861: 'CONTACT_TRADE_CONTACTS': identifier not found, even with argument-dependent lookup
1>CvPlayerAI.cpp(15767) : error C3861: 'CONTACT_TRADE_CONTACTS': identifier not found, even with argument-dependent lookup
1>CvPlayerAI.cpp(15767) : error C3861: 'CONTACT_TRADE_CONTACTS': identifier not found, even with argument-dependent lookup
1>CvPlayerAI.cpp(15825) : error C2065: 'CONTACT_TRADE_WORKERS' : undeclared identifier
1>CvPlayerAI.cpp(15827) : error C3861: 'CONTACT_TRADE_WORKERS': identifier not found, even with argument-dependent lookup
1>CvPlayerAI.cpp(15882) : error C3861: 'CONTACT_TRADE_WORKERS': identifier not found, even with argument-dependent lookup
1>CvPlayerAI.cpp(15882) : error C3861: 'CONTACT_TRADE_WORKERS': identifier not found, even with argument-dependent lookup
1>CvPlayerAI.cpp(15907) : error C2065: 'CONTACT_TRADE_MILITARY_UNITS' : undeclared identifier
1>CvPlayerAI.cpp(15909) : error C3861: 'CONTACT_TRADE_MILITARY_UNITS': identifier not found, even with argument-dependent lookup
1>CvPlayerAI.cpp(16023) : error C3861: 'CONTACT_TRADE_MILITARY_UNITS': identifier not found, even with argument-dependent lookup
1>CvPlayerAI.cpp(16023) : error C3861: 'CONTACT_TRADE_MILITARY_UNITS': identifier not found, even with argument-dependent lookup
 
Really? Do you also use BBAI? Will try again.

Edit: Again errors. -.-

Edit2: No Chance. I've merged all into my sources... will always get those errors.

Edit3: I don't even know where to look at. :(

Edit4: Got it. Afforess did not comment all with "Advanced Diplomacy" in CvEnums.h. I missed merging it.
 
Argh... BUG Mod errors -.- Can somebody help me on this?

 
humm, in some files ive look the "advanced diplo'" tag, but in some i went through the changes through the compared file in winmerge, so i probably added all of the tags.

i have merged it with revdcm 2.8, which i also added to it bbai 1.02a.

i haven't loaded the game to test this actually but i bet the python error wil appear on my end as well.


edit: yap - i have the python error as well.
 
Oh, I know the problem, I forgot an XML file for the new memory; one second folks.
 
Okay V1.01 is up, with a new file in BasicInfos, and a minor change to CvGameTextMgr for some code I left out.
 
sweet!

thanks for the fast fix! of to the merge.

also thank for pointing the exact change in the version, easier to merge :)



edit:

by the way, afforess, you have in the sdk files - cvplot.h - and it has no change in it - so is it ok - or there some code missing?
 
edit:

by the way, afforess, you have in the sdk files - cvplot.h - and it has no change in it - so is it ok - or there some code missing?

Oh, yeah, that slipped past me. Feel free to remove it; I will get rid of it in future versions.
 
Found several bugs.

1) Tooltips for new agreements are not shown on diplomacy screen.
2) When an AI asked me to cease war with another player, nothing happened when i'm was pressing on 'yes' or 'no'. After a few tries i was forced to quit a game.
3) After Suryavarman several times started and ended a war with Ragnar i find out that i'm having three embassies with him.
 
Also, I don't know what FREE_TRADE_ZONE is. This got added to CvDeal.cpp, but there are no text links included.
 
Updated to V1.02.
  • Fixed Trade Hover Text - Changes in CvDLLWidgetData.cpp
  • Added Changes to CyEnumsInterface.Cpp
  • Updated Python Files For BUG-Based Mods
 
PHP:
1>CyEnumsInterface.cpp(1343) : error C2065: 'TRADE_SECRETARY_GENERAL_VOTE' : undeclared identifier
1>CyEnumsInterface.cpp(1343) : error C2228: left of '.value' must have class/struct/union type
1>CyEnumsInterface.cpp(1343) : error C2065: 'TRADE_PLEDGE_VOTE' : undeclared identifier
1>CyEnumsInterface.cpp(1343) : error C2228: left of '.value' must have class/struct/union type
1>CyEnumsInterface.cpp(1343) : error C2228: left of '.value' must have class/struct/union type
1>CyEnumsInterface.cpp(1343) : error C2228: left of '.value' must have class/struct/union type
1>CyEnumsInterface.cpp(1343) : error C2228: left of '.value' must have class/struct/union type
1>CyEnumsInterface.cpp(1343) : error C2228: left of '.value' must have class/struct/union type
1>CyEnumsInterface.cpp(1343) : error C3861: 'TRADE_SECRETARY_GENERAL_VOTE': identifier not found, even with argument-dependent lookup
1>CyEnumsInterface.cpp(1343) : error C3861: 'TRADE_PLEDGE_VOTE': identifier not found, even with argument-dependent lookup

Looks like there are still 2 relicts from RoM AND. ;)


Also... there are double entries:

PHP:
		.value("TRADE_SECRETARY_GENERAL_VOTE", TRADE_SECRETARY_GENERAL_VOTE)
		.value("TRADE_PLEDGE_VOTE", TRADE_PLEDGE_VOTE)
		.value("TRADE_SECRETARY_GENERAL_VOTE", TRADE_SECRETARY_GENERAL_VOTE)
		.value("TRADE_PLEDGE_VOTE", TRADE_PLEDGE_VOTE)
 




Edit: Okay the first one was caused by me. I missed something in Scoreboard.py.

But I still get the second error... something should still be missing in the sources.
 
Top Bottom